Merge pull request #2828 from crazy-max/ci-buildx-edge #4230
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: e2e | |
# Default to 'contents: read', which grants actions to read commits. | |
# | |
# If any permission is set, any permission not included in the list is | |
# implicitly set to "none". | |
# | |
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions | |
permissions: | |
contents: read | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'master' | |
- 'v[0-9]*' | |
pull_request: | |
paths-ignore: | |
- '.github/releases.json' | |
- 'README.md' | |
- 'docs/**' | |
env: | |
SETUP_BUILDX_VERSION: "edge" | |
SETUP_BUILDKIT_IMAGE: "moby/buildkit:latest" | |
DESTDIR: "./bin" | |
K3S_VERSION: "v1.21.2-k3s1" | |
jobs: | |
build: | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
version: ${{ env.SETUP_BUILDX_VERSION }} | |
driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }} | |
buildkitd-flags: --debug | |
- | |
name: Build | |
uses: docker/bake-action@v5 | |
with: | |
targets: binaries | |
set: | | |
*.cache-from=type=gha,scope=release | |
*.cache-from=type=gha,scope=binaries | |
*.cache-to=type=gha,scope=binaries | |
- | |
name: Rename binary | |
run: | | |
mv ${{ env.DESTDIR }}/build/buildx ${{ env.DESTDIR }}/build/docker-buildx | |
- | |
name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binary | |
path: ${{ env.DESTDIR }}/build | |
if-no-files-found: error | |
retention-days: 7 | |
driver: | |
runs-on: ubuntu-20.04 | |
needs: | |
- build | |
strategy: | |
fail-fast: false | |
matrix: | |
driver: | |
- docker | |
- docker-container | |
- kubernetes | |
- remote | |
buildkit: | |
- moby/buildkit:buildx-stable-1 | |
- moby/buildkit:master | |
buildkit-cfg: | |
- bkcfg-false | |
- bkcfg-true | |
multi-node: | |
- mnode-false | |
- mnode-true | |
platforms: | |
- linux/amd64 | |
- linux/amd64,linux/arm64 | |
include: | |
- driver: kubernetes | |
driver-opt: qemu.install=true | |
- driver: remote | |
endpoint: tcp://localhost:1234 | |
- driver: docker-container | |
metadata-provenance: max | |
- driver: docker-container | |
metadata-warnings: true | |
exclude: | |
- driver: docker | |
multi-node: mnode-true | |
- driver: docker | |
buildkit-cfg: bkcfg-true | |
- driver: docker-container | |
multi-node: mnode-true | |
- driver: remote | |
multi-node: mnode-true | |
- driver: remote | |
buildkit-cfg: bkcfg-true | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
if: matrix.driver == 'docker' || matrix.driver == 'docker-container' | |
- | |
name: Install buildx | |
uses: actions/download-artifact@v4 | |
with: | |
name: binary | |
path: /home/runner/.docker/cli-plugins | |
- | |
name: Fix perms and check | |
run: | | |
chmod +x /home/runner/.docker/cli-plugins/docker-buildx | |
docker buildx version | |
- | |
name: Init env vars | |
run: | | |
# BuildKit cfg | |
if [ "${{ matrix.buildkit-cfg }}" = "bkcfg-true" ]; then | |
cat > "/tmp/buildkitd.toml" <<EOL | |
[worker.oci] | |
max-parallelism = 2 | |
EOL | |
echo "BUILDKIT_CFG=/tmp/buildkitd.toml" >> $GITHUB_ENV | |
fi | |
# Multi node | |
if [ "${{ matrix.multi-node }}" = "mnode-true" ]; then | |
echo "MULTI_NODE=1" >> $GITHUB_ENV | |
else | |
echo "MULTI_NODE=0" >> $GITHUB_ENV | |
fi | |
if [ -n "${{ matrix.metadata-provenance }}" ]; then | |
echo "BUILDX_METADATA_PROVENANCE=${{ matrix.metadata-provenance }}" >> $GITHUB_ENV | |
fi | |
if [ -n "${{ matrix.metadata-warnings }}" ]; then | |
echo "BUILDX_METADATA_WARNINGS=${{ matrix.metadata-warnings }}" >> $GITHUB_ENV | |
fi | |
- | |
name: Install k3s | |
if: matrix.driver == 'kubernetes' | |
uses: crazy-max/.github/.github/actions/install-k3s@fa6141aedf23596fb8bdcceab9cce8dadaa31bd9 | |
with: | |
version: ${{ env.K3S_VERSION }} | |
- | |
name: Launch remote buildkitd | |
if: matrix.driver == 'remote' | |
run: | | |
docker run -d \ | |
--privileged \ | |
--name=remote-buildkit \ | |
-p 1234:1234 \ | |
${{ matrix.buildkit }} \ | |
--addr unix:///run/buildkit/buildkitd.sock \ | |
--addr tcp://0.0.0.0:1234 | |
- | |
name: Test | |
run: | | |
make test-driver | |
env: | |
BUILDKIT_IMAGE: ${{ matrix.buildkit }} | |
DRIVER: ${{ matrix.driver }} | |
DRIVER_OPT: ${{ matrix.driver-opt }} | |
ENDPOINT: ${{ matrix.endpoint }} | |
PLATFORMS: ${{ matrix.platforms }} |