Skip to content

feat: add module versioning compat checks - #7692

Merged
jedevc merged 1 commit into
dagger:mainfrom
jedevc:add-module-versioning-compat
Jul 10, 2024
Merged

jedevc merged 1 commit into
dagger:mainfrom
jedevc:add-module-versioning-compat

Conversation

@jedevc

@jedevc jedevc commented Jun 18, 2024

Copy link
Copy Markdown
Contributor

As discussed in #7640.

This is a follow-up to #5315, which will allow us to add a backwards compatibility check if/when we make breaking changes to the module API, etc.

This uses the engineVersion field introduced in 1377f13 (#6469).

@jedevc
jedevc requested a review from sipsma June 18, 2024 15:37
@jedevc jedevc mentioned this pull request Jun 18, 2024
2 tasks done
@jedevc jedevc added this to the v0.12.0 milestone Jun 18, 2024
@jedevc
jedevc force-pushed the add-module-versioning-compat branch from 3ae0452 to d94eacd Compare June 18, 2024 15:46
@jedevc
jedevc requested a review from helderco June 26, 2024 12:18
@jedevc

jedevc commented Jun 26, 2024

Copy link
Copy Markdown
Contributor Author

Hm, had an idea - so currently, in this PR, we have the ability to enforce a minimum version compatibility for modules that require engine versions that are too old.

Should we also enforce a minimum compatibility for engine versions that too new? e.g. if I try and run a module that has engineVersion v0.12.1 on an engine version v0.12.0, should we explicitly error out?

Obviously, this has the potential to introduce some more friction in upgrading, but on the plus side, we get a more useful error message about what's wrong (instead of getting weird type errors all over the place from each SDK as they encounter things that don't exist). Additionally, this constraint could hopefully motivate users to upgrade to more recent dagger versions - if a daggerverse module uses dagger v0.12.1, then a user has to upgrade to use that.

@jedevc
jedevc force-pushed the add-module-versioning-compat branch from d94eacd to a6f77c2 Compare July 9, 2024 11:38
@jedevc

jedevc commented Jul 9, 2024

Copy link
Copy Markdown
Contributor Author

Right, decided to implement my above comment - if a user tries to run a v0.13.0 module on v0.12.0, this should definitely fail - it will probably not compile.

This is similar in behavior to how go.mod works in compilation of it's code - so shouldn't be too unexpected.

Comment thread core/schema/module.go
Comment on lines +731 to +733
if err := engine.CheckVersionCompatibility(engine.Version, engineVersion); err != nil {
return nil, fmt.Errorf("module requires newer engine version: %w", err)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How strict is this? Feels like it could be frustrating if someone isn't enabled to directly upgrade their Dagger version.

While we're pre-1.0 this is probably closer to the reality of our releases (patch releases introduce new features all the time that the module might depend on), but I'd expect post-1.0 when our versions are more meaningful that this would be way too strict.

I guess we could codify that ahead of time? If version is < 1.0, require strict >=, but if >= 1.0, allow wiggle room at the patch level?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ooh that's a good point. Hm, I think I agree - but we can encode that constraint when we get to v1.0 right? Since the released engine will be the one doing the checks.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah - as long as we remember. 😄

Maybe we should make a v1.0 milestone for things like that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah I'm happy with that - aside from that, any outstanding issues?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Opened #7865 (+ milestone) for the v1.0 change.

I think the main question is whether this is still too strict even for today, but I don't have a great read on that.

@vito vito left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving in principle, have some concern over being too strict even for today, but it seems worth trying and we can always relax it later

Comment thread core/schema/module.go
Comment on lines +731 to +733
if err := engine.CheckVersionCompatibility(engine.Version, engineVersion); err != nil {
return nil, fmt.Errorf("module requires newer engine version: %w", err)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Opened #7865 (+ milestone) for the v1.0 change.

I think the main question is whether this is still too strict even for today, but I don't have a great read on that.

@jedevc
jedevc merged commit 8b392bb into dagger:main Jul 10, 2024
@jedevc
jedevc deleted the add-module-versioning-compat branch July 10, 2024 16:31
matipan pushed a commit to matipan/dagger that referenced this pull request Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants