Skip to content

Commit

Permalink
fix: streamline GIT_SHA and GIT_BRANCH retrieval in docker/common
Browse files Browse the repository at this point in the history
  • Loading branch information
absternator committed Dec 3, 2024
1 parent 5cf6820 commit 0200a4b
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions docker/common
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,11 @@ PACKAGE_NAME=beebop-py
PACKAGE_ORG=mrcide
PACKAGE_DEV=dev

# Buildkite doesn't check out a full history from the remote (just the
# single commit) so you end up with a detached head and git rev-parse
# doesn't work
if [ "$BUILDKITE" = "true" ]; then
GIT_SHA=${BUILDKITE_COMMIT:0:7}
GIT_SHA=$(git -C "$PACKAGE_ROOT" rev-parse --short=7 HEAD)
if [[ -v "BRANCH_NAME" ]]; then
GIT_BRANCH=${BRANCH_NAME}
else
GIT_SHA=$(git -C "$PACKAGE_ROOT" rev-parse --short=7 HEAD)
fi

if [ "$BUILDKITE" = "true" ]; then
GIT_BRANCH=$BUILDKITE_BRANCH
else
GIT_BRANCH=$(git -C "$PACKAGE_ROOT" symbolic-ref --short HEAD)
GIT_BRANCH=$(git symbolic-ref --short HEAD)
fi

# production image
Expand Down

0 comments on commit 0200a4b

Please sign in to comment.