Skip to content

Commit b44e968

Browse files
author
Janne Rönkkö
committed
Add Git SHA to built Docker images as label
This allows an easy programmatic way to find out the commit from which a Docker image was built. This change needs to be deployed before some other GHA actions are updated so that the cypress image contains label containing source Git commit SHA.
1 parent 85f2c8d commit b44e968

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

.github/workflows/shared-build-and-publish-docker-image.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ jobs:
102102
tags: |
103103
${{ steps.variables.outputs.docker_image }}
104104
${{ github.ref_name == 'main' && steps.variables.outputs.docker_image_latest || '' }}
105+
labels: |
106+
git_sha=${{ github.sha }}
105107
cache-from: type=registry,ref=${{ steps.variables.outputs.docker_image_cache }}
106108
cache-to: ${{ github.ref_name == 'main' && format('type=registry,ref={0},mode=max', steps.variables.outputs.docker_image_cache) || '' }}
107109
push: true

0 commit comments

Comments
 (0)