ci: fix registry-cache job

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2023-01-11 14:32:33 +01:00
parent fdafae777b
commit 223ed1ebd4
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7

View File

@ -740,7 +740,6 @@ jobs:
uses: docker/setup-qemu-action@v2 uses: docker/setup-qemu-action@v2
- -
name: Set up Docker Buildx name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with: with:
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
@ -748,7 +747,7 @@ jobs:
network=host network=host
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }} image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
- -
name: Build and push (1) name: Build and push
id: docker_build id: docker_build
uses: ./ uses: ./
with: with:
@ -763,54 +762,16 @@ jobs:
cache-from: type=registry,ref=localhost:5000/name/app cache-from: type=registry,ref=localhost:5000/name/app
cache-to: type=inline cache-to: type=inline
- -
name: Inspect (1) name: Inspect
run: | run: |
docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .}}' docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .}}'
- -
name: Check digest (1) name: Check digest
run: | run: |
if [ -z "${{ steps.docker_build.outputs.digest }}" ]; then if [ -z "${{ steps.docker_build.outputs.digest }}" ]; then
echo "::error::Digest should not be empty" echo "::error::Digest should not be empty"
exit 1 exit 1
fi fi
-
name: Prune
run: |
docker buildx prune -a -f --verbose
-
name: Build and push (2)
id: docker_build2
uses: ./
with:
context: ./test
file: ./test/multi.Dockerfile
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64
push: true
tags: |
localhost:5000/name/app:latest
localhost:5000/name/app:1.0.0
cache-from: type=registry,ref=localhost:5000/name/app
cache-to: type=inline
-
name: Inspect (2)
run: |
docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .}}'
-
name: Check digest (2)
run: |
if [ -z "${{ steps.docker_build2.outputs.digest }}" ]; then
echo "::error::Digest should not be empty"
exit 1
fi
-
name: Compare digests
run: |
echo Compare "${{ steps.docker_build.outputs.digest }}" with "${{ steps.docker_build2.outputs.digest }}"
if [ "${{ steps.docker_build.outputs.digest }}" != "${{ steps.docker_build2.outputs.digest }}" ]; then
echo "::error::Digests should be identical"
exit 1
fi
github-cache: github-cache:
runs-on: ubuntu-latest runs-on: ubuntu-latest