-
Notifications
You must be signed in to change notification settings - Fork 2
Optimize Docker builds and E2E #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| .idea | ||
| node_modules | ||
| docker-compose.* | ||
| **/.idea | ||
| **/node_modules | ||
| **/docker-compose.* | ||
| .dockerignore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thing is that all our sample app e2e tests in the core app rely on running the docker:up to run a MB based on a locally built MB uberjar.
The same way, they rely on
docker:downto completely kill everything related to the container (container, image)So changing the behavior of these commands will break the core app e2e.
But we can override
docker:up/docker:downcommands in core app for each app to run something differentSo:
docker:e2e:upanddocker:e2e:downcommands that behave like beforedocker-compose.ymlin it and just overrideimagewithbuild- would be nicedocker:e2e:up/docker:e2e:downdocker:e2e:upshould be used in CI workflow in this repo (instead ofdocker:up)docker:e2e:up/docker:e2e:downcan be handled by our team (me), but this PR must be merged ONLY after we merge a core-app PR, otherwise we break CI in core appUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense to me, though I think we can still avoid the build by directly mounting the JAR into the container instead? This should give us a decent speedup.
We could introduce a new
docker-compose.e2e.yaml(or whatever) file, like so:Then, introduce a
docker:e2e:upcommand that runs:It's not strictly the same as before but should still work I think. And we can add the
docker:e2e:downcommand as you suggested.This has the added benefit of failing early if we're running an E2E test without a custom JAR, which I think should never happen but is technically possible with the current setup.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me check tomorrow if this approach will work with Shoppy (we want to have a consistent setup for all Sample Apps).
At the first glance - it should but i want to be 100% sure, that there won't be issues with a custom entrypoint (defined in
docker-compose-e2e)Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just this - won't work well if the
metabase.jaris missing, and it may be missing. When a container is running, an emptymetabase.jarfolder is created and it looks weird and annoying.But we can use a long syntax with
create_host_path: falseIt also has cons: ideally if a file is not here - we want just to avoid the creation of a bind volume. With the approach above for a missing file it will throw an error. But after 57 it's fine, because to test SDK locally we anyway MUST copy a locally built
metabase.jarbecause it will contain the SDK hosted bundle code.Based on Shoppy adjustments, the proposal:
docker:up,docker:downcommands keep them as in your PR currentlyrmintodocker:rmdocker:e2e:upfor e2e on the level of this repo - for this repo and for Nextjs app it should just calldocker:upunder the hood. (For Shoppy it will run an additionaldocker-compose.e2e.ymlwith overrides)docker:local-dist:upcommand. It should rundocker compose -f docker-compose.yml -f docker-compose.local-dist.yml --env-file .env.docker updocker-compose.local-dist.ymlfile with the content:e2e-tests.ymllet's runnpm run docker:e2e:upinstead ofdocker:upSo we will have the
docker:e2e:upcommand for e2e CI workflows of this repo, that currently behaves just as a regulardocker:upcommandWe will have the
docker:local-dist:upcommand that will be used locally AND in e2e on the level of the core app to start containers based on the locally built metabase.jar and Embedding SDK package dist (note, that locally it can be either a local metabase.jar OR a local SDK dist, or both).Wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also i created a Shoppy PR with changes mentioned above
metabase/shoppy#161
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense to me. Most of the complexity (conditionally using a local or not) seems to be caused by using Docker Compose, since it doesn't support logic for mounting volumes. At some point it might be worth moving away from Compose and directly calling the Docker API/CLI, though definitely not in this PR :)
I don't work on these codebases enough to have an opinion on whether the increased complexity is worth it, so I'll defer to you to go ahead and merge this PRs and the others you've created. Thanks for taking this onboard @sanex3339!