Skip to content
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

Cluster Secrets and Buildkit builds #142

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

zzak
Copy link
Member

@zzak zzak commented Feb 14, 2025

This extracts #141 save for switching the queue to use Buildkite hosted agents.

yob and others added 7 commits January 29, 2025 17:50
An experiment in changing the rails CI pipeline from "self-hosted"
agents to "hosted" agents, a recently release Buildkite feature [1].

The hosted agents linux environment is superficially quite similar to
the Elastic Stack for AWS, so the required changes are fairly minimal.
Roughly half the changes are to take advantage of some performance
optimisations available on hosted agents (like cache volumes, and
remote buildkit builders with cache that last across builds).

The essential changes:

* Read the OCI registry from the environment rather than hard code an
  ECR registry. The current self-hosted agents run in AWS and can access
  ECR, but the hosted agent environment has access to its own registry
  specifically for use cases like this - building an image at the start
  of the build and then reusing it in later jobs
* Changing the queue from `default` or `builder`, to `hosted`

Optimisations:

* There's no need to use the docker-compose plugins cache_from and
  image_name shenanigans. The images built at the start of each build
  use a remote buildkit builder with cache that is s hared between
  builds. The cache is typically warm, and when it is the image build
  time drops from ~2 mins to ~18sec
* Use plain buildkit to build the images, without the docker compose
  plugin. This avoids the image being exported from buildkit to docker,
  and when the buildkit cache is warm the jobs complete in as little as
  18s. This bypasses the docker-compse built in support for separating
  building and running, but the docker-compose.yml already kinda
  bypasses that by hard coding the image used in the run jobs (using the
  IMAGE_NAME env var)
* Create a cache volume for ruby gems that are installed in docker
  during the initial step. This shaves ~30s off the build time

[1] https://buildkite.com/docs/pipelines/hosted-agents/overview
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants