From b8becff2e2c16e0dce3eaf14839eeb42474b30aa Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 8 Mar 2023 08:22:46 +0000 Subject: [PATCH] Enhancement (ci): Add `commit_sha` label (#120) This is useful for traceability. Co-authored-by: leo Co-authored-by: joe --- build.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.sh b/build.sh index 65e35c82..951f9046 100755 --- a/build.sh +++ b/build.sh @@ -99,6 +99,7 @@ elif [ "$PIPELINE" = 'update' ]; then BUILD_CONTEXT='update/' fi GAME_IMAGE_LATEST="$REPOSITORY:latest" +COMMIT_SHA=$( git rev-parse HEAD ) # Display pipeline echo "PIPELINE: $PIPELINE" @@ -149,6 +150,7 @@ if [ "$PIPELINE" = 'build' ]; then --label "game_version_base=$GAME_VERSION" \ --label 'game_update_count=0' \ --label "game_engine=$GAME_ENGINE" \ + --label "commit_sha=$COMMIT_SHA" \ "$BUILD_CONTEXT" if [ "$LATEST" = 'true' ]; then docker tag "$GAME_IMAGE" "$GAME_IMAGE_LATEST" @@ -171,6 +173,7 @@ elif [ "$PIPELINE" = 'update' ]; then -t "$GAME_IMAGE" \ --label "game_version=$GAME_VERSION" \ --label "game_update_count=$GAME_UPDATE_COUNT" \ + --label "commit_sha=$COMMIT_SHA" \ "$BUILD_CONTEXT" docker tag "$GAME_IMAGE" "$GAME_IMAGE_LAYERED" date