Skip to content

[lockfile] Fix built-in plugin issues #2189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 17, 2024
Merged

Conversation

mikeland73
Copy link
Contributor

@mikeland73 mikeland73 commented Jul 11, 2024

Summary

Addresses #2187 and other issues.

Fixes:

  • Adding a package with built-in plugin was not triggering file creation until shell/run. Now we do it on add instead.
  • plugin version was not getting added to lockfile on add and instead was getting added on next ensureState. Fixed this by ensuring plugin version added during add.

How was it tested?

  • Installed nodejs, observed plugin version was in lockfile.
  • Installed nginx and observed devbox.s files were created right away

@mikeland73 mikeland73 requested review from gcurtis and savil July 11, 2024 19:04
@@ -270,6 +270,16 @@ func (d *Devbox) ensureStateIsUpToDate(ctx context.Context, mode installMode) er
ux.Finfo(d.stderr, "Ensuring packages are installed.\n")
}

if mode != ensure {
// Reload includes because added/removed packages might change plugins. Cases:
// * New package adds built in. We wanna make sure the plugin is in config.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... adds built-in plugin...

Comment on lines 417 to 419
if err := d.PluginManager().UpdateLockfileVersion(pluginConfig); err != nil {
return err
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if this is the best place to add this, because we'll be updating the lockfile before the packages are actually installed in the nix store. In the event of an installation error, then the lockfile would be (wrongfully) updated.

In ensureStateIsUpToDate, we:

  • call d.installPackages()
  • ...// other operations that may also error
  • call d.updateLockfile

Could or should we move this pluginManager.updateLockfileVersion to d.updateLockfile()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that makes sense. I put it here because I wanted to keep the existing logic intact (i.e. d.PluginManager().CreateFilesForConfig was previously doing this).

I think putting at the end is good. Another question is if we should move CreateFilesForConfig to the end as well, but at least for this PR, I'm inclined to leave as is.

if mode != ensure {
// Reload includes because added/removed packages might change plugins. Cases:
// * New package adds built in. We wanna make sure the plugin is in config.
// * Remove built-in that installs multiple packages (e.g. nginx). We wanna clear them up so
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.. Remove built-in plugin ...

@mikeland73 mikeland73 requested a review from savil July 16, 2024 20:42
@mikeland73 mikeland73 merged commit ce17002 into main Jul 17, 2024
24 checks passed
@mikeland73 mikeland73 deleted the landau/plugin-in-lock branch July 17, 2024 00:46
Copy link

sentry-io bot commented Jul 19, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ **Generic Error: <redacted errors.withStack>: <redacted usererr.combined> go.jetpack.io/devbox/internal/boxcli/usererr in... View Issue
  • ‼️ **Generic Error: <redacted usererr.combined>: write shell.nix to file: <redacted fs.PathError>: <redacted syscal... go.jetpack.io/devbox/internal/shellgen in write... View Issue
  • ‼️ **json.SyntaxError: <redacted errors.withStack>: <redacted json.SyntaxError> go.jetpack.io/devbox/internal/cuecfg in Unmarshal View Issue

Did you find this useful? React with a 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants