diff --git a/.github/workflows/docker-integration-tests.yaml b/.github/workflows/docker-integration-tests.yaml index e091866d..74986a9e 100644 --- a/.github/workflows/docker-integration-tests.yaml +++ b/.github/workflows/docker-integration-tests.yaml @@ -61,12 +61,19 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} + - name: MD5 of Dockerfile + id: md5_result + run: | + echo "md5=$(md5sum "${{ matrix.dockerfile }}" | awk '{ print $1 }')" >> $GITHUB_OUTPUT + - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v5 with: images: | ghcr.io/${{ github.repository_owner }}/${{ matrix.image }} + labels: | + rocks.goss.dockerfile-md5=${{ steps.md5_result.outputs.md5 }} - name: Build and push tag uses: docker/build-push-action@v5 diff --git a/development/build_images.sh b/development/build_images.sh index 9238294b..fe1fd2b9 100755 --- a/development/build_images.sh +++ b/development/build_images.sh @@ -12,6 +12,7 @@ LABEL_REVISION=$(git rev-parse HEAD) for docker_file in $INTEGRATION_TEST_DIR/Dockerfile_*; do [[ $docker_file == *.md5 ]] && continue os=$(cut -d '_' -f2 <<<"$docker_file") + md5=$(md5sum "$docker_file" | awk '{ print $1 }') docker build \ --label "org.opencontainers.image.created=$LABEL_DATE" \ --label "org.opencontainers.image.description=Quick and Easy server testing/validation" \ @@ -21,5 +22,6 @@ for docker_file in $INTEGRATION_TEST_DIR/Dockerfile_*; do --label "org.opencontainers.image.title=goss" \ --label "org.opencontainers.image.url=$LABEL_URL" \ --label "org.opencontainers.image.version=manual" \ + --label "rocks.goss.dockerfile-md5"=$md5 \ -t "aelsabbahy/goss_${os}:latest" - < "$docker_file" done