Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/actions/setup-qemu-cached/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Setup Cached QEMU
description: Restores a cached binfmt image and installs the requested QEMU emulators

inputs:
cache-mode:
description: Use prime to populate a missing cache, or restore to only consume it
default: restore
image:
description: Binfmt image to load and install
default: docker.io/tonistiigi/binfmt:latest@sha256:400a4873b838d1b89194d982c45e5fb3cda4593fbfd7e08a02e76b03b21166f0 # renovate: datasource=docker
platforms:
description: Comma-separated emulators to install
default: arm64

runs:
using: composite
steps:
- name: Restore binfmt image
id: cache
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ${{ runner.temp }}/qemu-binfmt
key: qemu-binfmt-${{ runner.os }}-${{ runner.arch }}-${{ inputs.image }}

Comment thread
javorszky marked this conversation as resolved.
- name: Pull binfmt image
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
env:
QEMU_CACHE_DIR: ${{ runner.temp }}/qemu-binfmt
QEMU_IMAGE: ${{ inputs.image }}
run: |
mkdir -p "$QEMU_CACHE_DIR"
docker pull "$QEMU_IMAGE"
docker save --output "$QEMU_CACHE_DIR/binfmt.tar" "$QEMU_IMAGE"

- name: Save binfmt image
if: steps.cache.outputs.cache-hit != 'true' && inputs.cache-mode == 'prime'
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ${{ runner.temp }}/qemu-binfmt
key: qemu-binfmt-${{ runner.os }}-${{ runner.arch }}-${{ inputs.image }}

- name: Load binfmt image
shell: bash
run: docker load --input "${{ runner.temp }}/qemu-binfmt/binfmt.tar"

- name: Install QEMU emulators
shell: bash
env:
QEMU_IMAGE: ${{ inputs.image }}
QEMU_PLATFORMS: ${{ inputs.platforms }}
run: docker run --rm --privileged "$QEMU_IMAGE" --install "$QEMU_PLATFORMS"
4 changes: 1 addition & 3 deletions .github/workflows/build-oss.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,7 @@ jobs:
if: ${{ inputs.authenticated && ! inputs.full-build }}

- name: Setup QEMU
uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0
with:
platforms: arm64
uses: ./.github/actions/setup-qemu-cached
if: ${{ steps.images_exist.outputs.base_exists != 'true' || steps.images_exist.outputs.target_exists != 'true' }}

- name: Docker Buildx
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/build-plus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,7 @@ jobs:
if: ${{ inputs.authenticated && ! inputs.full-build }}

- name: Setup QEMU
uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0
with:
platforms: arm64
uses: ./.github/actions/setup-qemu-cached
if: ${{ steps.images_exist.outputs.base_exists != 'true' || steps.images_exist.outputs.target_exists != 'true' }}

- name: Docker Buildx
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/cache-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ jobs:
echo "image_matrix_nap=$(cat .github/data/matrix-images-nap.json | jq -c)" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT

- name: Setup QEMU
uses: ./.github/actions/setup-qemu-cached
with:
cache-mode: prime

build-docker:
name: Build Docker OSS
needs: [checks]
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ jobs:
fi
echo "run_tests=${run_tests}" >> $GITHUB_OUTPUT

- name: Setup QEMU
uses: ./.github/actions/setup-qemu-cached
with:
cache-mode: prime
if: ${{ steps.docker_build.outputs.docker_build == 'true' || steps.run_tests.outputs.run_tests == 'true' }}

- name: Output variables
run: |
echo docs_only: ${{ github.event.pull_request && steps.docs.outputs.docs_only == 'true' }}
Expand Down Expand Up @@ -455,9 +461,7 @@ jobs:
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3

- name: Setup QEMU
uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0
with:
platforms: arm64
uses: ./.github/actions/setup-qemu-cached
if: ${{ needs.checks.outputs.forked_workflow == 'false' || needs.checks.outputs.docs_only == 'false' }}

- name: Azure login
Expand Down
12 changes: 12 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,18 @@
"\\s+.+?: (?<currentValue>.+?) # renovate: datasource=(?<datasource>[a-z-]+?) depName=(?<depName>.+?)(?: (?:packageName|lookupName)=(?<packageName>.+?))?(?: versioning=(?<versioning>[a-z-]+?))?\\s"
]
},
{
"customType": "regex",
"datasourceTemplate": "docker",
"description": "Update pinned Docker images in composite actions",
"managerFilePatterns": [
"/^\\.github\\/actions\\/.+\\.ya?ml$/"
],
"matchStrings": [
"default: docker\\.io\\/(?<depName>[^:@\\s]+):(?<currentValue>[^@\\s]+)@(?<currentDigest>sha256:[a-f0-9]+) # renovate: datasource=docker"
],
"versioningTemplate": "docker"
},
{
"customType": "regex",
"description": "Update Operator SDK version in bundle Dockerfile",
Expand Down
Loading