-
Notifications
You must be signed in to change notification settings - Fork 26
Experiment with running rails/rails builds on Buildkite Hosted Agents #141
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,12 +48,14 @@ def install_plugins(service = "default", env = nil, dir = ".") | |
], | ||
compressed: ".buildkite.tgz" | ||
} | ||
plugin :metahook, { | ||
"pre-command": "echo \"+++ inspect docker image store\"\ndocker image ls" | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is for debugging only, we can remove it before considering merging There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✍️
|
||
|
||
plugin :docker_compose, { | ||
"env" => env, | ||
"run" => service, | ||
"pull" => service, | ||
"pull-retries" => 3, | ||
"tty" => "true", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
"config" => ".buildkite/docker-compose.yml", | ||
"shell" => ["runner", *dir], | ||
}.compact | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
# This file is never read -- it's just a copy of the pipeline's | ||
# configuration in the Buildkite UI. | ||
env: | ||
CONFIG_REPO: "https://github.com/yob/buildkite-config" | ||
CONFIG_BRANCH: "hosted" | ||
|
||
steps: | ||
- name: ":pipeline: rails-initial-pipeline" | ||
command: | | ||
echo "Fetching registry details" | ||
export REGISTRY="$$(nsc workspace describe -o json -k registry_url)" | ||
|
||
PATH=/bin:/usr/bin | ||
set -e | ||
|
||
|
@@ -30,17 +36,22 @@ steps: | |
echo "Fetching pull-request metadata:" | ||
(docker run --rm \ | ||
-v "$$PWD":/app:ro -w /app \ | ||
-v "$$PWD/cache/bundler":/usr/local/bundle \ | ||
-e GITHUB_PUBLIC_REPO_TOKEN \ | ||
-e BUILDKITE_REPO \ | ||
-e BUILDKITE_PULL_REQUEST \ | ||
ruby:latest \ | ||
.buildkite/bin/fetch-pr > .buildkite/tmp/.pr-meta.json) || true | ||
|
||
|
||
echo "Generating pipeline:" | ||
sh -c "$$PIPELINE_COMMAND" | ||
|
||
([ -f .buildkite/.dockerignore ] && cp .buildkite/.dockerignore .dockerignore) || true | ||
|
||
cache: | ||
paths: | ||
- "cache/bundler" | ||
name: "rails-initial-bundler-cache" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Create a cache volume for the gems used in this initial step. In most cases the cache will be warm and it shaves 10s of seconds of the initial step |
||
plugins: | ||
- artifacts#v1.9.3: | ||
upload: ".dockerignore" | ||
|
@@ -58,6 +69,7 @@ steps: | |
PIPELINE_COMMAND: >- | ||
docker run --rm | ||
-v "$$PWD":/app:ro -w /app | ||
-v "$$PWD/cache/bundler":/usr/local/bundle | ||
-e CI | ||
-e BUILDKITE | ||
-e BUILDKITE_AGENT_META_DATA_QUEUE | ||
|
@@ -72,9 +84,10 @@ steps: | |
-e DOCKER_IMAGE | ||
-e RUN_QUEUE | ||
-e QUEUE | ||
-e REGISTRY | ||
ruby:latest | ||
.buildkite/bin/pipeline-generate rails-ci | | ||
buildkite-agent pipeline upload | ||
timeout_in_minutes: 5 | ||
agents: | ||
queue: "${QUEUE-builder}" | ||
queue: hosted |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,9 @@ | |
use Buildkite::Config::RakeCommand | ||
use Buildkite::Config::RubyGroup | ||
|
||
plugin :docker_compose, "docker-compose#v4.16.0" | ||
plugin :docker_compose, "docker-compose#v5.4.1" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yob Was there a particular reason to update the compose plugin? Or just wanted to try latest? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIRC it was just to get to the latest major version while I was changing things. If sticking on v4.x helps with the transition, I doubt that'll be a problem on the hosted agents There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 Thanks for the quick reply! Makes sense, I just wasn't sure if there was a requirement to using hosted for this. I will try it out with the updated plugin. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://github.com/buildkite-plugins/docker-compose-buildkite-plugin/releases/tag/v5.0.0 does mention that it makes docker-compose v2 the default, and I assume hosted agents have v2. just a guess, but if you have issues maybe you'll need to explicit about the |
||
plugin :artifacts, "artifacts#v1.9.3" | ||
plugin :metahook, "improbable-eng/metahook#v0.4.1" | ||
|
||
if build_context.nightly? | ||
build_context.rubies << Buildkite::Config::RubyConfig.master_ruby | ||
|
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.
We now fetch the registry hostname from the environment dynamically in the initial job