1
0
mirror of https://github.com/tomav/docker-mailserver.git synced 2024-06-28 20:21:14 +02:00
docker-mailserver/.github/workflows/generic_test.yml
Brennan Kinney 646e010cb7
ci(fix): Temporarily avoid specifying provenance (#3072)
* ci(fix): Temporarily avoid specifying `provenance`

As the test workflow does not use the `docker-container` buildx driver, it uses the Docker Engine bundled BuildKit version which until v23 release does not support attestations.

Likewise the current buildx version in CI is `0.10.0` which does not respect `--provenance false`, the presence of the option appears to trigger a BuildKit version compatibility check and fail early before it considers the value of the option.

* chore: Use buildx `docker-container` driver instead

An alternative solution to omitting `provenance: false` (_not supported by buildx 0.10.0 with default `docker` driver when Docker Engine bundles BuildKit less than 0.10.0, which is the case prior to the Docker Engine v23 release_). 

This approach provides more consistency with the build and publish workflows by using the same buildx `docker-container` driver (_and thus newer BuildKit, enabling support for  `provenance: false`_).

* chore: Revise test workflow inline docs

Buildx `docker-container` driver is not needed here, but it does seem like it improves cache-hit ratio when building from the retrieved build cache (from the earlier build workflow). Possibly due to building with the same BuildKit version.
2023-02-09 22:33:50 +13:00

60 lines
1.9 KiB
YAML

name: 'Test the DMS Container Image'
on:
workflow_call:
inputs:
cache-key:
required: true
type: string
permissions:
contents: read
jobs:
run-tests:
name: 'Test'
runs-on: ubuntu-22.04
strategy:
matrix:
part: [serial, parallel/set1, parallel/set2, parallel/set3]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# Required to retrieve bats (core + extras):
submodules: recursive
# Get the cached build layers from the build job:
# This should always be a cache-hit, thus `restore-keys` fallback is not used.
# No new cache uploads should ever happen for this job.
- name: 'Retrieve image built from build cache'
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: cache-buildx-${{ inputs.cache-key }}
# Configures buildx to use `docker-container` driver,
# Ensures consistent BuildKit version (not coupled to Docker Engine),
# and increased compatibility of the build cache vs mixing buildx drivers.
- name: 'Set up Docker Buildx'
uses: docker/setup-buildx-action@v2.4.0
# Importing from the cache should create the image within approx 30 seconds:
# NOTE: `qemu` step is not needed as we only test for AMD64.
- name: 'Build AMD64 image from cache'
uses: docker/build-push-action@v4.0.0
with:
context: .
tags: mailserver-testing:ci
# Export the built image to the Docker host for use with BATS:
load: true
# Rebuilds the AMD64 image from the cache:
platforms: linux/amd64
cache-from: type=local,src=/tmp/.buildx-cache
# Disable provenance attestation: https://docs.docker.com/build/attestations/slsa-provenance/
provenance: false
- name: 'Run tests'
run: make generate-accounts tests/${{ matrix.part }}