Repository navigation
chore: tag all releases with semver - #7858
Conversation
b809ba6 to
066b90f
Compare
066b90f to
faddb41
Compare
5c765f1 to
1b7bccd
Compare
|
One thing I just noticed, we construct the default runner host to connect to based on This will continue working for tagged releases, but I think the change here would create a disconnect for CLIs published off main in that now we publish the engine image using just the git commit SHA and Getting CLIs built off main to automatically provision the correct engine image built off main by default was a pretty nice property to have, so it would be nice to maintain. It's not an utterly crucial requirement though |
sipsma
left a comment
There was a problem hiding this comment.
Makes sense on a high level! I do greatly prefer the explicit file with the next version that you added in the last commit over inferring from changie (since whether the next version is a patch or minor bump is a human decision)
379625a to
3497538
Compare
Oof, just missed this till now - I've split this behavior out to populate |
40e2fee to
0bca261
Compare
| // Add ldflags | ||
| ldflags := []string{ | ||
| "-X", "github.com/dagger/dagger/engine.Version=" + t.Dagger.Version.String(), | ||
| "-X", "github.com/dagger/dagger/engine.Tag=" + t.Dagger.Version.TagString(), | ||
| } | ||
| args = append(args, "-ldflags", strings.Join(ldflags, " ")) |
There was a problem hiding this comment.
So I ended up trying to use engine.Version somewhere in our tests. Previously I was making up v1000 as a version number, but we can't do that anymore: #7692
I also really really didn't want to have to update this test every single release, that was not something I wanted to do.
| ldflags: | ||
| - -s -w | ||
| - -X github.com/dagger/dagger/engine.Version={{.Env.ENGINE_VERSION}} | ||
| - -X github.com/dagger/dagger/engine.Tag={{.Env.ENGINE_VERSION}} |
There was a problem hiding this comment.
Don't we want to set this to a different value, i.e. WithEnvVariable("ENGINE_TAG", cli.Dagger.Version.TagString() here https://github.com/sipsma/dagger/blob/2a9bb343e013194b9153739fe17a06c55282a841/dev/cli.go#L85
There was a problem hiding this comment.
Hm, actually, the timestamps are an issue here 🤔 Because we publish the cli and engine in separate steps, the timestamps will be different, which is weird.
I guess we can get the timestamp in github actions, and pass it everywhere, but that's really annoying 😢
There was a problem hiding this comment.
Fixed this in the last commit, by adding a new ENGINE_TAG env that's populated from the new --tag parameter. dev builds won't have this set, so we should error out - which makes sense, the current behavior is to try and pull a non-existent image.
Additionally, the timestamps in version numbers are an issue for the github multi-step release - this is resolved by just having a version pre-calculation step, which is messy, but eventually we'll shift all of this logic into dagger, so it'll hopefully all go away...
65e5e48 to
508c89b
Compare
|
Marking as draft while I rework this a bit. |
f855540 to
2a3a63a
Compare
447114a to
d6e7540
Compare
|
So I think this is getting much closer to ready - this changes some release things, so I'll keep an eye on main once it's merged. However, the major changes are:
Future work:
|
bb684ad to
69bfa83
Compare
sipsma
left a comment
There was a problem hiding this comment.
LGTM so far, couple significant comments and some nits.
I'd generally say that we really need to lean on the tests here. There are just so many dimensions ((version, min version) x (engine, client) x (dev, not dev)) that it gets really hard to think about all of them purely by reading the code. That's just inherent though, so whatever we can do to make sure we have as much test coverage as feasible in a readable way will pay dividends I think.
| // can happen during dev builds | ||
| return "", fmt.Errorf("no builtin image tag available") |
There was a problem hiding this comment.
nit: I wonder if we should just default to docker-container://dagger-engine.dev 🤔 That's what you want most of the time and the other times you are explicitly setting the env var anyways. Not a blocker either way though, just if you agree
There was a problem hiding this comment.
Yeaaaa, this is already weird uncharted territory, so this makes sense to me.
| // MinimumEngineVersion is used by the client to determine the minimum | ||
| // allowed engine version that can be used by that client. | ||
| MinimumEngineVersion = "v0.12.0" | ||
| MinimumEngineVersion = "v0.12.1" |
There was a problem hiding this comment.
Sorry if I missed this somewhere else, but why is this bumped to v0.12.1?
There was a problem hiding this comment.
Hmmm, I did this for a reason - and I now cannot remember it. We can always re-bump it later if it turns out to have been for a good reason.
There was a problem hiding this comment.
Just saw in the tests that we only have cases where the engine sets Version and MinVersion to the same values. Would it be valuable to have additional tests where Version>MinVersion? That's the situation we'd find ourselves in most often so IIUC it seems like good to have too. Might be misunderstanding something though.
Also as a nit: these tests are extremely valuable for understanding what the intended behavior is in the first place (almost documentation of it), which makes me wonder if it would be worth the effort to refactor them as table-driven tests.
Then we can just easily look through every permutation of (engine version, engine min version, client version, client min version) in a centralized place (as opposed to a bunch of separate tests with boilerplate overhead) and know what the expected behavior is. It would also probably make it easier to see if we are missing some particular permutation.
- I realize this might be a tedious change from the current state, so not a blocker for me at all, just a suggestion if you agree
There was a problem hiding this comment.
Mm, agreed - I started doing some of this in version_test.go with pretty much exactly this kind of test (a lot more lightweight as well, though they aren't integration tests).
Does that kind of work? I can add more inline doc comments to explain those if they're currently unclear. I think we could keep the heavier integration tests with the current scenarios, and then use version_test.go to cover all the more detailed cases.
The reason I didn't go for table tests in the first place was that spinning up a bunch of engines with different versions is relatively heavy. We could definitely do it. The other problem is that the _EXPERIMENTAL_DAGGER_VERSION isn't perfect - it's the best way to test it right now, but really we'd want to have dagger dev-module tests I think to make sure they're properly propagated from the build process.
Still worth doing? I'm kind of in the balance and could be persuaded either way.
There was a problem hiding this comment.
Yeah we should definitely have the unit tests too, but the thing is when I look through them it's hard to connect them back to the actual version of the Engine/CLI/Module/etc. that is being compared in various places (you need to go look at the code where those comparisons are happening, see which value is which arg, what processing has been done on the arg already, etc.)
I think the table driven integ tests could be made to work with the right set of parameters to the test (i.e. provide engine service as arg so we don't need a new one for each test, etc.).
But maybe another approach would be to change the code such that we keep the current CheckVersionCompatibility/CheckMaxVersionCompatibility/etc. functions but wrap them with very specific functions like CheckEngineModuleVersionCompatibility/CheckClientEngineCompatibility/etc. and use those in our code instead.
So rather than calling
engine.CheckMaxVersionCompatibility(modCfg.EngineVersion, engine.BaseVersion(engine.Version))in core/schema/module.go, we instead call something like
func CheckEngineModuleVersionCompatibility(modCfgEngineVersion, engineVersion string) error {
return engine.CheckMaxVersionCompatibility(modCfgEngineVersion, engine.BaseVersion(engineVersion)
}Same idea for calling CheckClientEngineCompatibility instead of engine.CheckVersionCompatibility(engine.NormalizeVersion(c.bkVersion), engine.MinimumEngineVersion) in engine/client/client.go, etc.
Then we can unit test those higher-level wrappers and make it super clear what the intended behavior is for each specific case of all the different comparisons we need to make. That might make the code overall easier to keep track of too. WDYT?
- Like I said, all this isn't a blocker, not even 100% sure it would look as nice as I'm theorizing
There was a problem hiding this comment.
That might make the code overall easier to keep track of too. WDYT?
Yeah, this is honestly the most important thing for this change, so I've just sucked it up and converted it - it's an absolute pain, but it's now done 🎉
Now it should be super easy to add new tests there, I don't think there's anything major that's not covered?
2210f80 to
7c81e3d
Compare
Instead of just using commit hashes and directory IDs, which produces nearly incomprehensible versions (which is more of a pain, now that `engineVersion` is actually important). This makes it a *bit* clearer when and where a non-tagged build came from by using changie to get the last release we built. Frustratingly, it seems non-trivial to do version comparison on these, so we keep skipping these. In the future, we should work out on compromise. For an example of why this is hard: suppose that we add a MinVersion of v0.12.0 - the next pre-release will end up being something like "v0.11.10-dev-240709191414-1ccb8772510a". So this version will fail these checks. We could add a little piece of code to note what the *next* release will be - which would make these comparison a lot simpler (essentially, we'd treat pre-releases of vX as equivalent to X). But this would require too much extra maintainance for now - but maybe we could dupe this with MinVersion numbers in `version.go` today. Signed-off-by: Justin Chadwell <[email protected]>
Otherwise, it could potentially build two different timestamps - which would cause an amount of chaos. Signed-off-by: Justin Chadwell <[email protected]>
Without this, we hit some *pretty* big issues when comparing against dev versions (which we now have some more tests for). Essentially, we do two main things: - When comparing client/server/module versions to each other, we make sure that the versions are both, 1. normalized (handling empty version strings, old-style version strings, etc), and 2. stripped to their base version when we're using dev engines (so that vX.Y.Z-dev-123 is compatible with vX.Y.Z-dev-456). - Keep all schemaVersions as stripped versions without prereleases. This ensures that we're always serving the most up-to-date API view. Signed-off-by: Justin Chadwell <[email protected]>
de269f7 to
deedf99
Compare
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
Since dagger/dagger#7858, `engine.Tag` must now be populated. From that PR, quoting myself: > Because we add a new link-time variable, we need to update everywhere we do builds of dagger Without this, the dagger client will not be able to resolve external resources it needs to be able to operate.
Fixes #7760
Instead of just using commit hashes and directory IDs, which produces nearly incomprehensible versions (which is more of a pain, now that
engineVersionis actually important). This makes it a bit clearer when and where a non-tagged build came from by using changie to get the last release we built.Frustratingly, it seems non-trivial to do version comparison on these, so we keep skipping these. In the future, we should work out on compromise. For an example of why this is hard: suppose that we add a MinVersion of v0.12.0 - the next pre-release will end up being something like "v0.11.10-dev-240709191414-1ccb8772510a". So this version will fail these checks.
We could add a little piece of code to note what the next release will be - which would make these comparison a lot simpler (essentially, we'd treat pre-releases of vX as equivalent to X). But this would require too much extra maintainance for now - but maybe we could dupe this with MinVersion numbers in
version.gotoday.You get a semver tag!