Repository navigation
Update SDKs to pull CLI from S3 URL. - #4194
Conversation
There was a problem hiding this comment.
This is the ugliest thing remaining: basically, we want the ability to override the host we pull the CLI from in order to test it, but I really want to avoid using an env var for that (since that makes it much easier for SDK users to intentionally or even be tricked into overriding those env vars at actual runtime).
I went down a nightmare rabbit hole of trying to use rewire and a few similar things but had to give up because everything either wasn't compatible (w/ es6 + typescript) or was way over my head in terms of actually understanding. @slumbering let me know if there's any good ways of approaching this that work on our codebase or if this ugly workaround works. Main thing is I just don't want this to end up in our generated docs.
|
Thanks for the head start! I can update the python bits here soon, hopefully I won't block you. I haven't looked closely yet, but you say I mean, I'm sure that'll be obvious when I look at the code, just quick context catch up in the meantime if I don't say anything. If you can update the PR description with the issue where this plan is laid out, that'd be great. |
|
@helderco Updated the PR description with the backlink to the other issue and a summary, let me know what other questions come up! |
|
@sipsma Thanks! 🙏 |
|
@sipsma Weren't we going to use |
aluzzardi
left a comment
There was a problem hiding this comment.
Glad to see this! Definitely simplifies things a lot.
Overall LGTM, I'll let @helderco @slumbering @dolanor @TomChv dive deeper in the Node/Python parts.
I guess we could use this to "untangle" a little bit the dev environment at some point.
There was a problem hiding this comment.
Not sure about the utility of those old* variables (from line 60-62). Same in the after(()...
cc @sipsma
There was a problem hiding this comment.
Oh I guess it's because we're playing with process env and you want to reset everything in the after((...
I'm playing with Sinon.js that could stubs process.env values
There was a problem hiding this comment.
I'm still confused with oldCLIHost and oldCLIScheme
There was a problem hiding this comment.
@sipsma : I've just pushed a commit to remove them
There was a problem hiding this comment.
Hey sorry I didn't get back to this PR yesterday, but the reason for this is that CLI_HOST and CLI_SCHEME are set in the top level of the module, so changing them will affect any other tests. I think it technically doesn't hurt to leave them changed right now since no other test cases will hit the code paths that use them, but I'd rather leave the reset of them in since it could be very confusing in the future if someone is writing another test case and those vars have a different unexpected value. I went back to the original approach for now, but let me know what you think.
There was a problem hiding this comment.
We should find another way in a near futur, like stubbing with sinon.js for instance.
There was a problem hiding this comment.
Agreed, I tried a bunch of stuff like rewire but couldn't get it to work; I didn't think sinon would work because it would require we change our Connect method to accept a way of configuring all this, which means its configurable outside of tests too, which is what I was trying to avoid. Maybe it's just unavoidable though? Or I'm probably missing something obvious.
There was a problem hiding this comment.
As you say, can't really test default download logic but everything else seems to be working, just make sure to fix the typo.
I'm working on refactoring but I want to take the opportunity to fix a few more things so no need to wait for me if you need to move on, I can send a follow up PR.
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: jffarge <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
|
For some reason the engine tests are stuck on: Even after I tried restarting once. I'm gonna re-run those tests locally from a clean branch as a double check and will merge if they pass so we don't get blocked on that. |
Thanks @helderco, that sounds great. The PR coming after this one will add publishes of the CLI on every push to main alongside a few updates to primarily the test case code in each SDK to support running against those CLI builds. As of right now the changes to the actual non-test code in SDKs is extremely small (just support for pulling from a different url path, similar to the way they can change host/scheme already), so shouldn't need to worry about conflicts. |
|
Engine tests passed locally, merging |
Signed-off-by: Erik Sipsma [email protected]
Brings the SDKs fully in line with the description of the new session behavior here: #3830 (comment)
Basically:
DAGGER_SESSION_URLif set, connect to it over http directly, no binary_EXPERIMENTAL_DAGGER_CLI_BIN, if set, as a pointer to the CLI, call thesessionsubcommand on thatThis PR is probably on the border of too large, but a lot of the changes are just re-arrangements of existing code, equivalent code in 3 SDKs and/or tests. If other prefer I can start by just merging the Go stuff and then send out separate PRs for python+nodejs.
Overall current state:
@register_enginething anymore (I removed the equivalent of that in go+nodejs) but want to wait for your opinion first @heldercoEach of the SDKs have tests that setup an http server and use that to test the "pull from s3 url" code path. That's a good start but this code is still not tested against the real CLI deployed to S3 because we haven't done a release of the CLI yet that includes the new
sessionsubcommand that SDKs need.So the last follow up (besides more cleanup of python+node) will be to either:
I'd greatly prefer 1 and talked to Gerhard about it a bit last week. It seems relatively straightforward, but I'll see how it goes when I try tomorrow.