Repository navigation
Modularize CI - #6843
Modularize CI#6843
Conversation
|
I can help port or testing elixir part if you want. :) |
|
Don't port the Python and TS SDKs. Me and @TomChv will handle that as we have dev modules in these SDKs that were intended to be installed in the ci module so the mage code is outdated. |
SGTM - I'll just put in some stubs for now for where I think they should fit in to everything (though of course, we can change that later). |
I've now ported all the SDKs except for Python/Typescript - feel free to test the elixir SDK though! I've noticed dry-run doesn't quite work with elixir for whatever reason 🤔
Another few for my list:
|
Hmm, I am looking at it. |
|
By the way, I tried My machine runs docker under lima ( |
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]> add the rest of the test things Signed-off-by: Justin Chadwell <[email protected]> do a bit more Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
sipsma
left a comment
There was a problem hiding this comment.
Overall looks great, so glad we're finally doing this. Left comments but can all be done in follow ups if preferred.
There's obviously a ton more cleanups and improvements to iterate on here but 100% agree that starting here is the right place even if we can't rm -rf mage entirely quite yet.
| with: | ||
| go-version: "1.21" | ||
| cache-dependency-path: "internal/mage/go.sum" | ||
| - name: Install dagger |
There was a problem hiding this comment.
Not a blocker but can we use https://github.com/dagger/dagger-for-github for this?
There was a problem hiding this comment.
This is tricky - because we're doing ./hack/dev to the nested engine, it's not super trivial.
I'll have a think about this, and try and do a follow-up, but this also is entertwined with removing mage in general.
There was a problem hiding this comment.
All of this is going away in the CI setup.
Once we declare the Dagger version that we want - e.g. dagger-v0-10-3 - the runner is provisioned with all the necessary tooling, including the Dagger CLI. The code is available in this private repository: https://github.com/dagger/dagger.io/blob/3d37ad6abaf31634aa941796ea4fe8a107e68bcd/infra/ci/eks-2023-12-15/argocd/dagger-runners/dagger-gh-runners.yaml#L164-L202
We are integrating this in #7018, currently working through a few issues.
| // NOTE: wrapping the apk installs with this time based env ensures that the cache is invalidated | ||
| // once-per day. This is a very unfortunate workaround for the poor caching "apk add" as an exec | ||
| // gives us. | ||
| // Fortunately, better approaches are on the horizon w/ Zenith, for which there are already apk |
There was a problem hiding this comment.
non blocker but I guess we can actually do this now :-)
| // TODO: re-enable this, to avoid rate-limiting | ||
| // introduced in https://github.com/dagger/dagger/commit/20241ba7a8d39da8f6ff185d512953b6b0ec1a55 | ||
| // WithMountedDirectory("/root/.docker", util.HostDockerDir(dag)), |
There was a problem hiding this comment.
Oh you know what, I think I remember now why this was a thing.
As mentioned in the discord thread, in theory the auth session attachable should handle this. But the problem is we are creating a nested exec and currently nested execs end up as their own completely isolated session, so they don't get that auth session attachable.
Fortunately, that will no longer be the case after #6916 lands. So I think we can just rm these comments; it's not possible to implement this now and the need to should disappear soon.
cc @vito since you were on that discord thread too, just in case you're curious
There was a problem hiding this comment.
Uh oh, I've had a realization as to why we had it like this 😆
Since we spin up nested engines (for things like code gen / sdk tests / etc), we need a way of passing our token through. We seem to have hit this pretty quickly, so we either need #6916 to land soon, or we need to chuck in this little hack again, which is sad.
There was a problem hiding this comment.
Not necessarily a blocker, but while we still have mage involved, can we move this to a be subpackage of ci/ and share a go.mod with ci/? I've just been trying to think through all catch-22 scenarios that have bitten us way back when we first added the dagger-based CI for dagger and, while I haven't thought of any yet, the fact that there's now 3 modules involved gives me a headache 😅
There was a problem hiding this comment.
Yeah, this works! I've moved internal/mage into ci/mage, which I'm pretty happy with, and merged their go.mods together. Eventually, we can remove the old mage targest, but I'll keep them as a compat layer just for now.
There was a problem hiding this comment.
related to my comment on mage's go.mod, but I think we could actually share the go.mod of this ci module with the root go.mod up a parent directory (so just delete this one).
The reason we needed multiple go modules in the past was that we had to bootstrap mage on the previous dagger engine release via it's dep on the Go SDK, but afaict that's no longer gonna be a thing 🎉 Reason being that now the "previous stable engine" is entirely determined by the version of the CLI you use to call the ci module. This is awesome for general simplification and also specifically means we can simplify the step in our release process where we update mage's go.mod to the new engine (now it would just be a matter of updating the version of the dagger CLI in the GHA yamls).
Not a blocker though, can be in follow up if it's more complicated than I'm thinking right now.
There was a problem hiding this comment.
Ahhh, yes. So there's still one job I haven't converted yet, the helm.go job. I'll take a look at this one in a follow-up, but I guess after that it's probably possible?
One note - potentially this means that the build for the module is a bit larger? Not 100% sure, need to check this experimentally really.
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
|
|
||
| Start a little dev shell with dagger-in-dagger: | ||
|
|
||
| $ dagger call --source=. dev |
There was a problem hiding this comment.
Out of curiosity, would running this command result in entering a typical OS shell, or is this something much more specific to dagger, e.g. interactive dagger shell where you can run functions, etc.? 🤔
There was a problem hiding this comment.
This launches a shell into a linux container that's connected to the dagger engine so you can run little experiments, etc.
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
| if: ${{ github.repository == 'dagger/dagger' }} | ||
| # Use our own Dagger runner when running in the dagger/dagger repo (including PRs) | ||
| runs-on: dagger-runner-2c-8g | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: "1.21" | ||
| cache-dependency-path: "internal/mage/go.sum" | ||
| - name: "Build Dev Engine" | ||
| run: | | ||
| ./hack/dev | ||
| env: | ||
| _EXPERIMENTAL_DAGGER_RUNNER_HOST: "unix:///var/run/buildkit/buildkitd.sock" | ||
| DAGGER_CLOUD_TOKEN: "${{ secrets.DAGGER_CLOUD_TOKEN }}" | ||
| - name: "Scan Dev Engine for Vulnerabilities" | ||
| uses: aquasecurity/[email protected] | ||
| with: | ||
| input: ./bin/engine.tar | ||
| format: "json" | ||
| exit-code: "1" | ||
| severity: "CRITICAL,HIGH" |
There was a problem hiding this comment.
This job used to be different because we need to build a Dev Engine, but not run it. Good to see this refactored!
|
Boom 🎉 Let's do the typescript / python dev module integrations in follow-ups. |

This PR introduces a fully-operational
ci/directory, replacing the old non-functional one.This new CI allows for all of the following:
Warning
This isn't fully ready yet, but opening a work-in-progress PR to make it easier to track.
The aim isn't to get everything perfect on a first-pass, but to do a lift-and-shift of the existing
internal/mageCI into dagger functions. Then we can follow-up with improvements.A few things I've realized while doing this that I think are technically out-of-scope for this particular piece of work, but we should make sure to tackle:
dagger callCLI #6155)platformVariantsis unwieldy in modules #6675)--source=. ... export --path=.to generate code. I get the technical reasons for this, but the verbosity of this makes me want to reach for a wrapper, which I know we're looking to avoid.Syncin the middle of the chain, meaning that large parts are done in serial - this slows the build down, but struggling to work out how we can make those operations parallel again (cc @sipsma)TODO: