Repository navigation
feat(cli): add dagger update command - #8839
Conversation
e6c3c89 to
a6bf41a
Compare
15f89de to
9d22635
Compare
13aae6e to
08a6a56
Compare
|
As discussed in today's call earlier - currently an upgrade should only repin. So if a user installs We won't (for now) update the versions listed in
|
|
based on the discussion today, following would be the end UX for dagger update after this PR: Note: The current PR changes don't handle all the scenarios listed below yet. tl;dr;if user specifies a version update to that version, otherwise just re-pin to the latest commit of current branch/tag. testcases
|
|
Gonna move this out of the milestone - it's not a release blocker, and its still in draft. |
|
The dependency update UX makes sense to me. Can we talk about engine and SDK update?
|
Hm, good point. #8587 didn't actually include the SDK. We don't track the version separately from the pin, so we can't actually do it easily. However, Essentially: Lines 22 to 23 in fa4b0dc should become // The SDK this module uses
SDK ModuleConfigDependency `json:"sdk,omitempty"`Though, maybe the I think this can be a follow-up after this, maybe @rajatjindal would be able to help out with this one too?
Mm, I don't think I think when originally working on module compat, I was hoping it would be mostly invisible from users - when you work on a module, you run
I think we should maybe unpack this more - why is this a common and important task for devs? It wasn't originally intended to be, so I think I'm missing something. I think we should try and make the experience smoother (and keep it relatively hidden), if that's at all possible, instead of trying to surface it more in the API. One potential reason for surfacing it more would be to explicitly allow users to target old versions of the API - e.g. I want to write a module that works with dagger versions v0.12.0+, but I'm using v0.14.0. This doesn't work today though - we only guarantee to supply a compatible API to old versions, we don't guarantee to supply exactly the same API. We could change that though, if we were interested in that use case (though personally I'm hesitant to prioritize features that keep users on old dagger versions). |
cf47446 to
3cef1c1
Compare
| name: "existing dep has version, update cmd has version", | ||
| initCmd: []string{"init", "--sdk=go", "--name=foo", "--source=."}, | ||
| installCmds: [][]string{ | ||
| {"install", "github.com/shykes/daggerverse/[email protected]"}, | ||
| }, | ||
| verifySetup: daggerjsonContains([]string{`"github.com/shykes/daggerverse/docker@docker/v0.4.1"`}), | ||
| updateCmd: []string{"update", "github.com/shykes/daggerverse/[email protected]"}, | ||
| verifyFns: []func(t *testctx.T, daggerjson string){ | ||
| daggerjsonContains([]string{`"github.com/shykes/daggerverse/docker@docker/v0.4.2"`}), | ||
| daggerjsonNotContains([]string{`github.com/shykes/daggerverse/docker@docker/v0.4.1`}), | ||
| }, | ||
| expectedError: "", |
There was a problem hiding this comment.
initCmdis always the same - so can be removed.- We don't need
verifySetup- testing this behavior should actually be done inTestDaggerInstall(we shouldn't duplicate the testing) daggerjsonContainsis kinda neat, but I think we could just havecontainsandnotContainsproperties right?- The default value of
expectedErris""anyways - so we don't need to manually set it (same with all other zero values)
Just a heads-up - if the tests start to feel tricky to get all into one giant table test, that's not an issue - you can split up testing into subtests (e.g. you could one that tests the pin updating, another that tests upgrading to a specified branch/tag, etc). Not required, but that's another option if the table tests start to feel too large.
There was a problem hiding this comment.
initCmd is always the same - so can be removed.
This is done now.
We don't need verifySetup - testing this behavior should actually be done in TestDaggerInstall (we shouldn't duplicate the testing)
removed the verifySetup step. Also removed the dagger install step by using prebaked dagger.json files.
daggerjsonContains is kinda neat, but I think we could just have contains and notContains properties right?
done 👍
The default value of expectedErr is "" anyways - so we don't need to manually set it (same with all other zero values)
done.
| }) | ||
| }) | ||
|
|
||
| t.Run("installing a dependency with duplicate name is not allowed", func(ctx context.Context, t *testctx.T) { |
There was a problem hiding this comment.
Make sure to add a test for two dependencies without explicit --names.
(though, note, this will probably fail until #9052 is merged - since at the point of checking, the name is actually empty 😢)
There was a problem hiding this comment.
do we want to move the fix for this change to the other PR to keep similar functionality in same PR?
3cef1c1 to
4068c65
Compare
SGTM! @rajatjindal let us know how's your backlog coming to tackle this one 🙏 |
@marcosnils, I created a new issue for this: #9156 |
8239eaa to
a3730d3
Compare
a3730d3 to
d999dc8
Compare
Signed-off-by: Rajat Jindal <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
|
Oops, realized this didn't have a changelog - @rajatjindal feel free to add one as a follow-up, otherwise I'll add one during the release process. |
Co-authored-by: Justin Chadwell <[email protected]> Signed-off-by: Patrick Magee <[email protected]>
This PR adds the
dagger updatecommand. Based on discussion in this ticket, we have decided not to update the version of the dependency (unless explicitly asked) but instead move the pin to the latest commit of the current version.e.g.
given current dependency of
<github.com/path/name>@<branch/tag>:dagger update github.com/path/name, it will update thepinto latest commit of the branch/tag.dagger update github.com/path/name@<diff-version>, it will update thepinto the latest commit for<diff-version>branch/tag.potentially also fixes #8821