-
Notifications
You must be signed in to change notification settings - Fork 26
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
Experiment with running rails/rails builds on Buildkite Hosted Agents #141
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 |
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