Skip to content

Commit

Permalink
Include the Dockerfile we build in the sha hash for checking whether …
Browse files Browse the repository at this point in the history
…a new image should be published
  • Loading branch information
jesper-friis committed Nov 29, 2024
1 parent 9a47df8 commit d290c62
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions .github/workflows/container_builds_weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,24 @@ jobs:
key: buildx-cache-${{ matrix.system }}${{ matrix.type }}-${{ matrix.arch }}-${{ github.sha }}
restore-keys: buildx-cache-${{ matrix.system }}${{ matrix.type }}-${{ matrix.arch }}-

- name: Create docker file
if: env.BUILD_NEW_IMAGE == 'true'
run: |
DOCKERFILE=docker_build_wheel/Dockerfile-${{ matrix.system }}${{ matrix.type }}_${{ matrix.arch }}
mkdir -p docker_build_wheel
bash .github/docker/gen_dockerfile.sh ${{ matrix.system }} ${{ matrix.type }} ${{ matrix.arch }} "${{ matrix.py_minors }}" \
> ${DOCKERFILE}
- name: Create file with SHA hashes
run: |
SHA_FILENAME=${{ matrix.system }}${{ matrix.type }}_${{ matrix.arch }}:latest.sha.txt
sha256sum ${DOCKERFILE} > ${SHA_FILENAME}
- name: Check 'latest' parent image SHA
run: |
IMAGE=quay.io/pypa/${{ matrix.system }}${{ matrix.type }}_${{ matrix.arch }}:latest
SHA_FILENAME=${{ matrix.system }}${{ matrix.type }}_${{ matrix.arch }}:latest.sha.txt
docker pull ${IMAGE}
docker images --no-trunc --quiet ${IMAGE} > ${SHA_FILENAME}
docker images --no-trunc --quiet ${IMAGE} >> ${SHA_FILENAME}
CACHE_DIR=.buildx-cache-${{ matrix.system }}${{ matrix.type }}_${{ matrix.arch }}
if [ -f "${CACHE_DIR}/${SHA_FILENAME}" ] && [ "$( cat ${SHA_FILENAME} )" == "$( cat ${CACHE_DIR}/${SHA_FILENAME} )" ]; then
Expand All @@ -107,13 +119,6 @@ jobs:
echo "BUILD_NEW_IMAGE=true" >> $GITHUB_ENV
fi
- name: Create docker file
if: env.BUILD_NEW_IMAGE == 'true'
run: |
mkdir -p docker_build_wheel
bash .github/docker/gen_dockerfile.sh ${{ matrix.system }} ${{ matrix.type }} ${{ matrix.arch }} "${{ matrix.py_minors }}" \
> docker_build_wheel/Dockerfile-${{ matrix.system }}${{ matrix.type }}_${{ matrix.arch }}
- name: Login to GitHub Container Registry
if: env.BUILD_NEW_IMAGE == 'true'
uses: docker/login-action@v3
Expand Down

0 comments on commit d290c62

Please sign in to comment.