Skip to content

Commit

Permalink
Merge pull request #2 from seek-oss/feature/tag-with-branch-build
Browse files Browse the repository at this point in the history
Tag docker images with branch build
  • Loading branch information
blai-seek authored Feb 21, 2019
2 parents cee7e95 + 6989130 commit 7cc7ea8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ if ! docker pull "${image_name}:${image_tag}"; then
if [ "$BUILDKITE_BRANCH" == "$BUILDKITE_PIPELINE_DEFAULT_BRANCH" ]; then
docker build . --file "${docker_file}" -t "${image_name}:${image_tag}" -t "${image_name}:latest" || exit 1
else
docker build . --file "${docker_file}" -t "${image_name}" || exit 1
docker build . --file "${docker_file}" -t "${image_name}:${image_tag}" || exit 1
fi
docker push "${image_name}"
fi || echo "Not found"

docker tag "${image_name}" "branch-$BUILDKITE_BUILD_NUMBER"
docker push "${image_name}"

# Support using https://github.com/buildkite-plugins/docker-buildkite-plugin without an image
export BUILDKITE_PLUGIN_DOCKER_IMAGE="${image_name}"
export BUILDKITE_PLUGIN_DOCKER_IMAGE="${image_name}"

0 comments on commit 7cc7ea8

Please sign in to comment.