-
Notifications
You must be signed in to change notification settings - Fork 538
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
BuildKite jobs in Docker #4824
BuildKite jobs in Docker #4824
Conversation
7cf1a2e
to
5a37b37
Compare
This comment contains a record of what used to be in the description of the PR. DetailsContainersSo far all the jobs have minimal shell dependencies. The following obvious mechanisms to describe these containers seemed wrong to me: (1) Make a single Dockerfile and stick the union of all the deps in here. This seems wasteful for jobs that only need a few specific tools (2) Write Dockerfiles for each job. This seems annoying and tedious. Nixery seemed like an easy way in the short term to specify exactly what I needed in each job. In this draft PR, I ran a local instance (in a container) pointed to nixpkgs-unstable. We could host an instance of this on Gcloud, but Nixery is probably too obscure of a thing to depend on for critical infrastructure. Performance tricksA few extra steps were taken to increase build performance:
Unresolved Questions
|
.buildkite/hooks/post-checkout
Outdated
./.buildkite/scripts/generate-diff.sh > $computed_diff.txt | ||
|
||
# | ||
# TODO: Remove this when we figure out where to stick this cache long term |
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.
You can pre-bake the cache into the container. All you need to do is just do dhall <<< '<external_lib_wrapper_path>'
for each external library and the cache will be there for you. You will just need to re-build the container when you update dhall deps, which should be very, very infrequent. We can add a update_deps style step for enforcing that if we need to.
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.
oops, you're right. This is a simple way to do it
.buildkite/src/Lib/Command.dhall
Outdated
if Prelude.List.null (Map.Entry Text Text) agents then None (Map.Type Text Text) else Some agents | ||
if Prelude.List.null (Map.Entry Text Text) agents then None (Map.Type Text Text) else Some agents, | ||
plugins = | ||
[ { mapKey = "docker#v3.5.0" |
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.
toMap { `docker#v3.5.0` = Docker.build c.docker }
.buildkite/src/Monorepo.dhall
Outdated
label = "Monorepo triage", | ||
key = "cmds", | ||
target = Size.Small | ||
target = Size.Small, | ||
docker = Docker.Config::{ image = "codaprotocol/ci-toolchain-base" } |
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.
This should probably have a version tag so that it doesn't just pull latest (which is bad since we may have different branches with different image versions for their CI). Also, can you configure this value as a constant coming from some file? For instance, (./Constants/ContainerImages.dhall).toolchainBase
. That way it's easy to update it later.
e2bd11f
to
28eaff9
Compare
What
All jobs run in containers now. Builds remain quick and short-circuiting.
Details
So far all the jobs have minimal shell dependencies.
agent.nix
is extended to support both building of local shell environments and docker containers.Why use docker from nix instead of writing a dockerfile
FROM scratch
by default (the output containers are tiny )More details
For more
The details for building and pushing is in a comment in
agent.nix
.Future work
Pick a git commit hash for nixpkgs and you're done. The nixpkgs public cache stays warm for a few months at least, and we can keep caching ourselves if we're slow to upgrade if we use cachix. I like not pinning for now as it will force us to upgrade our scripts if required if the tip of the world changes.
This wouldn't take more than an hour or so, but Brandon doesn't want to spend time on that if we're eventually moving to a bread-and-butter dockerfile.
This can be fixed by adding one more file to our
make update-deps
job, namely something Dhall can read in. Then we can optionally apply this tag with a new field in Docker.Config.Type.Performance tricks
A few extra steps were taken to increase build performance:
chmod 777
the cache as root in the post-checkout hook (before the docker container is run with lowered permissions)