ci: allow arbitrary buildx/buildkit version on workflow dispatch event

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2022-08-12 16:45:35 +02:00
parent c84f382811
commit 15b9e74b95
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
3 changed files with 83 additions and 32 deletions

View File

@ -2,6 +2,15 @@ name: ci
on: on:
workflow_dispatch: workflow_dispatch:
inputs:
buildx-version:
description: 'Buildx version or Git context'
default: 'latest'
required: false
buildkit-image:
description: 'BuildKit image'
default: 'moby/buildkit:buildx-stable-1'
required: false
push: push:
branches: branches:
- 'master' - 'master'
@ -21,6 +30,10 @@ jobs:
- -
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with:
version: ${{ matrix.buildx-version }}
driver-opts: |
${{ matrix.buildkit-image }}
- -
name: Build name: Build
uses: ./action uses: ./action
@ -48,8 +61,10 @@ jobs:
id: buildx id: buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with: with:
version: latest version: ${{ matrix.buildx-version }}
driver-opts: network=host driver-opts: |
network=host
${{ matrix.buildkit-image }}
- -
name: Build and push name: Build and push
id: docker_build id: docker_build
@ -95,7 +110,10 @@ jobs:
id: buildx id: buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with: with:
driver-opts: network=host version: ${{ matrix.buildx-version }}
driver-opts: |
network=host
${{ matrix.buildkit-image }}
- -
name: Build and push name: Build and push
id: docker_build id: docker_build
@ -132,12 +150,6 @@ jobs:
path-context: path-context:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
buildx-version:
- ""
- latest
services: services:
registry: registry:
image: registry:2 image: registry:2
@ -156,7 +168,9 @@ jobs:
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with: with:
version: ${{ matrix.buildx-version }} version: ${{ matrix.buildx-version }}
driver-opts: network=host driver-opts: |
network=host
${{ matrix.buildkit-image }}
- -
name: Build and push name: Build and push
id: docker_build id: docker_build
@ -220,6 +234,10 @@ jobs:
- -
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with:
version: ${{ matrix.buildx-version }}
driver-opts: |
${{ matrix.buildkit-image }}
- -
name: Build name: Build
id: docker_build id: docker_build
@ -289,6 +307,10 @@ jobs:
- -
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with:
version: ${{ matrix.buildx-version }}
driver-opts: |
${{ matrix.buildkit-image }}
- -
name: List networks name: List networks
run: docker network ls run: docker network ls
@ -310,8 +332,9 @@ jobs:
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with: with:
version: ${{ matrix.buildx-version }}
driver-opts: | driver-opts: |
image=moby/buildkit:master ${{ matrix.buildkit-image }}
- -
name: Build name: Build
uses: ./ uses: ./
@ -331,8 +354,10 @@ jobs:
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with: with:
version: ${{ matrix.buildx-version }}
driver-opts: | driver-opts: |
image=moby/buildkit:master network=host
${{ matrix.buildkit-image }}
- -
name: Build name: Build
uses: ./ uses: ./
@ -354,8 +379,10 @@ jobs:
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with: with:
version: ${{ matrix.buildx-version }}
driver-opts: | driver-opts: |
image=moby/buildkit:master network=host
${{ matrix.buildkit-image }}
- -
name: Build name: Build
uses: ./ uses: ./
@ -374,6 +401,11 @@ jobs:
- -
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with:
version: ${{ matrix.buildx-version }}
driver-opts: |
network=host
${{ matrix.buildkit-image }}
- -
name: Build name: Build
uses: ./ uses: ./
@ -394,6 +426,10 @@ jobs:
- -
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with:
version: ${{ matrix.buildx-version }}
driver-opts: |
${{ matrix.buildkit-image }}
- -
name: Build name: Build
uses: ./ uses: ./
@ -413,6 +449,10 @@ jobs:
- -
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with:
version: ${{ matrix.buildx-version }}
driver-opts: |
${{ matrix.buildkit-image }}
- -
name: Build name: Build
uses: ./ uses: ./
@ -429,9 +469,6 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
buildx-version:
- ""
- latest
dockerfile: dockerfile:
- multi - multi
- multi-sudo - multi-sudo
@ -453,7 +490,9 @@ jobs:
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with: with:
version: ${{ matrix.buildx-version }} version: ${{ matrix.buildx-version }}
driver-opts: network=host driver-opts: |
network=host
${{ matrix.buildkit-image }}
- -
name: Build and push name: Build and push
id: docker_build id: docker_build
@ -521,6 +560,7 @@ jobs:
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with: with:
version: ${{ matrix.buildx-version }}
driver: ${{ matrix.driver }} driver: ${{ matrix.driver }}
driver-opts: | driver-opts: |
network=host network=host
@ -585,8 +625,10 @@ jobs:
id: buildx id: buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with: with:
version: ${{ matrix.buildx-version }}
driver-opts: | driver-opts: |
network=host network=host
${{ matrix.buildkit-image }}
- -
name: Build and push (1) name: Build and push (1)
id: docker_build id: docker_build
@ -673,8 +715,10 @@ jobs:
id: buildx id: buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with: with:
version: ${{ matrix.buildx-version }}
driver-opts: | driver-opts: |
network=host network=host
${{ matrix.buildkit-image }}
- -
name: Cache Docker layers name: Cache Docker layers
uses: actions/cache@v3 uses: actions/cache@v3
@ -734,8 +778,10 @@ jobs:
id: buildx id: buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with: with:
version: ${{ matrix.buildx-version }}
driver-opts: | driver-opts: |
network=host network=host
${{ matrix.buildkit-image }}
- -
name: Cache Docker layers name: Cache Docker layers
uses: actions/cache@v3 uses: actions/cache@v3
@ -785,12 +831,6 @@ jobs:
github-cache: github-cache:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
buildx_version:
- ""
- latest
services: services:
registry: registry:
image: registry:2 image: registry:2
@ -807,9 +847,10 @@ jobs:
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with: with:
version: ${{ matrix.buildx_version }} version: ${{ matrix.buildx-version }}
driver-opts: | driver-opts: |
network=host network=host
${{ matrix.buildkit-image }}
buildkitd-flags: --debug buildkitd-flags: --debug
- -
name: Build and push name: Build and push
@ -842,6 +883,11 @@ jobs:
- -
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with:
version: ${{ matrix.buildx-version }}
driver-opts: |
network=host
${{ matrix.buildkit-image }}
- -
name: Build name: Build
uses: ./ uses: ./

View File

@ -2,6 +2,15 @@ name: e2e
on: on:
workflow_dispatch: workflow_dispatch:
inputs:
buildx-version:
description: 'Buildx version or Git context'
default: 'latest'
required: false
buildkit-image:
description: 'BuildKit image'
default: 'moby/buildkit:buildx-stable-1'
required: false
schedule: schedule:
- cron: '0 10 * * *' - cron: '0 10 * * *'
push: push:
@ -73,6 +82,10 @@ jobs:
- -
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with:
version: ${{ matrix.buildx-version }}
driver-opts: |
${{ matrix.buildkit-image }}
- -
name: Login to Registry name: Login to Registry
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
@ -104,7 +117,3 @@ jobs:
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
run: | run: |
docker buildx imagetools inspect ${{ matrix.slug }}:${{ steps.meta.outputs.version }} docker buildx imagetools inspect ${{ matrix.slug }}:${{ steps.meta.outputs.version }}
-
name: Dump context
if: always()
uses: crazy-max/ghaction-dump-context@v1

View File

@ -72,7 +72,3 @@ jobs:
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
run: | run: |
docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta.outputs.version }} docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta.outputs.version }}
-
name: Dump context
if: always()
uses: crazy-max/ghaction-dump-context@v1