Repository navigation
check vendored package versions and prompt users to upgrade - #2321
Conversation
|
If I understood the code correctly If we release a new version of Dagger where we don't change any package we're still going to be warning all users to upgrade unnecessarily. Shouldn't we ideally warn the users to update when it's necessary? We could do this by making the check a bit more smarter and specify up to which dagger version stdlib/universe is API compatible / requires an upgrade. Ideally we should also dogfood this approach and make our CI follow the same approach instead of relying on the source packages so we can get tests to fail when someone changes the packages and doesn't does the proper modifications so Dagger warns upon initialization. Current solution LGTM if we decide that adding a |
632c6df to
668cd0b
Compare
|
Updated following your feedback @marcosnils with a couple of other changes
Example: $ dagger do list
failed to load plan: package "universe.dagger.io" (version 0.2.7) is incompatible with this version of dagger (requires >= 0.2.8). Run `dagger project update` to resolve this
Usage:
dagger do [flags]
Ideally, we should have a way to encode runtime requirements in the module itself. However it's trickier to do (anyone's got suggestions?) and I think in the meantime this will cause more good than annoyance. Worst case scenario, we force people upgrade dagger when not necessary. Versus getting weird runtime errors. Example: $ dagger do list
failed to load plan: this plan requires dagger 0.2.8 or newer. Run `dagger version --check` to check for latest version
Usage:
dagger do [flags]
I haven't figured out a way yet to test this properly. @marcosnils you suggested having CI follow the same approach but it's a bit tricky since there are interdependencies between the runtime, stdlib and universe. |
|
@aluzzardi PR LGTM as is. Leaving a few reflections after thinking about this for some time.
Well. nodejs's
What I had in mind is that we should have an automated (non manual review) way to know if someone changes a package in a non-backwards compatible way and forgets to update the requirements which would cause confusing runtime errors. So, for that to happen we should have independent version streams between the packages and dagger. That way it's easy to create a CI step that checks if a package has been modified but it's version hasn't been updated. So, to make my ideas more concrete what I'm thinking is: Having a Embed this file with the module inside dagger and do both an engine and module version check with the following constraints:
The thing that I like about this approach is that it gives us a bit more flexibility to keep the modules and dagger versions separately while providing a workflow to minimize potential errors when reviewing code and upgrading modules until the PM is fully ready. Thoughts? |
|
Ok I really like this:
To make a parallel with
Yeah, that's very interesting. I think this warrants a longer conversation as it's a complex topic, we should start a separate issue. I like where it's going.
re "engine and module version check": I don't know if that applies once we switch to proper package management, e.g. Specifically, regarding the module version check:
There won't be anymore the notion of "changes", right? For example, the module "universe" in I think having the runtime target version in the module should be enough. For instance:
The constraint we'd then apply is:
|
|
In the meantime, is this approach ok @marcosnils @helderco ? The hackish part is we're writing a |
Yep, this works until we brainstorm a more robust solution. Let's make sure to ping all @dagger/maintainers in Discord and let then know to have special care when changing modules so they check if version requirements should be changed 🙏 |
bc3c7f9 to
cb3b58f
Compare
|
I just revamped the logic to make it simpler. Here's the outline:
The logic is pretty straightforward: if vendoredVersion.LessThan(minimumVersion) {
return fmt.Errorf("package %q (version %s) is incompatible with this version of dagger (requires %s or newer). Run `dagger project update` to resolve this", module, vendoredVersion.String(), minimumVersion.String())
}
if vendoredVersion.GreaterThan(daggerVersion) {
return fmt.Errorf("this plan requires dagger %s or newer. Run `dagger version --check` to check for latest version", vendoredVersion.String())
} |
That's what I had in mind initially :D. Since it's simpler to reason the logic that way :). SGTM! it'd be great if someone else can also ✔️ |
helderco
left a comment
There was a problem hiding this comment.
In the meantime, is this approach ok @marcosnils @helderco ?
Yes, as a workaround it LGTM. We'll make it better with #2163 🙂
|
@sipsma I'm getting the |
|
@aluzzardi looking at your branch I think you didn't pick up this commit yet 5bd9077 |
cb3b58f to
24f314b
Compare
|
@sipsma Oh thank you! Indeed I forgot to rebase, done |
|
Still a |
@aluzzardi That's a different issue from the That issue with |
Signed-off-by: Andrea Luzzardi <[email protected]>
24f314b to
5153158
Compare
|
@marcosnils @helderco Made a couple of minor tweaks, I'll merge them but let me know if you want me to change anything:
|
This is a workaround to prompt users to run project update when a version mismatch of stdlib/universe is detected.
The workaround should go entirely away once we have proper package management.
For now, this writes dagger's binary version inside
cue.mod/pkg/<module>/version.txtwhenever wedagger project update, and checks if the version matches upondagger do.Example:
/cc @helderco @marcosnils