Skip to content

Commit

Permalink
Migrate Rally release job to Buildkite (#1720)
Browse files Browse the repository at this point in the history
  • Loading branch information
pquentin authored May 26, 2023
1 parent 4a0a533 commit 2470328
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 89 deletions.
15 changes: 13 additions & 2 deletions .buildkite/release-docker/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
steps:
- label: "Release Docker Artifacts for Rally :docker:"
command: echo "TODO"
- input: "Build parameters"
fields:
- text: "RELEASE_VERSION"
key: "RELEASE_VERSION"
default: ""
hint: "The version to release e.g. '2.8.0'."

- wait
- label: "Release Docker Artifacts for Rally"
command: bash .buildkite/release-docker/run.sh
# Run on GCP to use `docker`
agents:
provider: gcp
47 changes: 47 additions & 0 deletions .buildkite/release-docker/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash

set -eo pipefail

# based on https://gist.github.com/sj26/88e1c6584397bb7c13bd11108a579746?permalink_comment_id=4155247#gistcomment-4155247
function retry {
local retries=$1
shift
local cmd=($@)
local cmd_string="${@}"
local count=0

# be lenient with non-zero exit codes, to allow retries
set +o errexit
set +o pipefail
until "${cmd[@]}"; do
retcode=$?
wait=$(( 2 ** count ))
count=$(( count + 1))
if [[ $count -le $retries ]]; then
printf "Command [%s] failed. Retry [%d/%d] in [%d] seconds.\n" "$cmd_string" $count $retries $wait
sleep $wait
else
printf "Exhausted all [%s] retries for command [%s]. Exiting.\n" "$cmd_string" $retries
# restore settings to fail immediately on error
set -o errexit
set -o pipefail
return $retcode
fi
done
# restore settings to fail immediately on error
set -o errexit
set -o pipefail
return 0
}

set +x
RELEASE_VERSION=$(buildkite-agent meta-data get RELEASE_VERSION)
# login to docker registry
DOCKER_PASSWORD=$(vault read -field token /secret/ci/elastic-rally/release/docker-hub-rally)
retry 5 docker login -u elasticmachine -p $DOCKER_PASSWORD
unset DOCKER_PASSWORD

set -x
export TERM=dumb
export LC_ALL=en_US.UTF-8
./release-docker.sh "$RELEASE_VERSION"
49 changes: 0 additions & 49 deletions .ci/jobs/defaults.yml

This file was deleted.

34 changes: 0 additions & 34 deletions .ci/jobs/release-docker.yml

This file was deleted.

4 changes: 0 additions & 4 deletions .ci/views/views.yml

This file was deleted.

0 comments on commit 2470328

Please sign in to comment.