Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parametrize and limit build platforms #45

Merged
merged 3 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
32 changes: 12 additions & 20 deletions .github/workflows/.container.template.j2
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ jobs:
run: |
python -m pip install -r requirements.txt

- name: "Docker QEMU"
uses: docker/setup-qemu-action@v3

- name: "Docker BuildX"
id: buildx
uses: docker/setup-buildx-action@v3

- name: "Generate Matrix Data"
id: set-matrix
run: |
Expand All @@ -60,10 +67,10 @@ jobs:
mirror-image:
runs-on: ubuntu-latest
needs: matrix-generator
name: "${{ matrix.dockerinfo.name }}"
name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}"
strategy:
fail-fast: false
max-parallel: 4
max-parallel: 10
matrix:
dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }}

Expand Down Expand Up @@ -103,11 +110,11 @@ jobs:
cat ./${{matrix.dockerinfo.file}}

- name: "Docker QEMU"
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: "Docker BuildX"
id: buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Inspect builder
run: |
Expand All @@ -117,19 +124,6 @@ jobs:
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"

<%- if multiarch %>

- name: Inspect Source Image
run: |
set -o pipefail
docker buildx imagetools inspect ${{ matrix.dockerinfo.source_container }} | tee -a source-container-inspect.txt

- name: Define Build Platforms
id: define-platforms
run: |
inv containers.platforms --exclude=<{ exclude_platforms }> source-container-inspect.txt
<%- endif %>

- name: "Log into GitHub Container Registry"
uses: docker/login-action@v2
with:
Expand All @@ -142,9 +136,7 @@ jobs:
with:
file: ${{ matrix.dockerinfo.file }}
context: ${{ env.PATH_IN_REPO }}
<%- if multiarch %>
platforms: ${{ steps.define-platforms.outputs.platforms }}
<%- endif %>
platforms: ${{ matrix.dockerinfo.platform }}
push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }}
tags: |
ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }}
27 changes: 12 additions & 15 deletions .github/workflows/almalinux-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ jobs:
run: |
python -m pip install -r requirements.txt

- name: "Docker QEMU"
uses: docker/setup-qemu-action@v3

- name: "Docker BuildX"
id: buildx
uses: docker/setup-buildx-action@v3

- name: "Generate Matrix Data"
id: set-matrix
run: |
Expand All @@ -60,10 +67,10 @@ jobs:
mirror-image:
runs-on: ubuntu-latest
needs: matrix-generator
name: "${{ matrix.dockerinfo.name }}"
name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}"
strategy:
fail-fast: false
max-parallel: 4
max-parallel: 10
matrix:
dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }}

Expand Down Expand Up @@ -103,11 +110,11 @@ jobs:
cat ./${{matrix.dockerinfo.file}}

- name: "Docker QEMU"
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: "Docker BuildX"
id: buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Inspect builder
run: |
Expand All @@ -117,16 +124,6 @@ jobs:
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"

- name: Inspect Source Image
run: |
set -o pipefail
docker buildx imagetools inspect ${{ matrix.dockerinfo.source_container }} | tee -a source-container-inspect.txt

- name: Define Build Platforms
id: define-platforms
run: |
inv containers.platforms --exclude=linux/s390x,linux/mips64le source-container-inspect.txt

- name: "Log into GitHub Container Registry"
uses: docker/login-action@v2
with:
Expand All @@ -139,7 +136,7 @@ jobs:
with:
file: ${{ matrix.dockerinfo.file }}
context: ${{ env.PATH_IN_REPO }}
platforms: ${{ steps.define-platforms.outputs.platforms }}
platforms: ${{ matrix.dockerinfo.platform }}
push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }}
tags: |
ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }}
27 changes: 12 additions & 15 deletions .github/workflows/amazonlinux-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ jobs:
run: |
python -m pip install -r requirements.txt

- name: "Docker QEMU"
uses: docker/setup-qemu-action@v3

- name: "Docker BuildX"
id: buildx
uses: docker/setup-buildx-action@v3

- name: "Generate Matrix Data"
id: set-matrix
run: |
Expand All @@ -60,10 +67,10 @@ jobs:
mirror-image:
runs-on: ubuntu-latest
needs: matrix-generator
name: "${{ matrix.dockerinfo.name }}"
name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}"
strategy:
fail-fast: false
max-parallel: 4
max-parallel: 10
matrix:
dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }}

Expand Down Expand Up @@ -103,11 +110,11 @@ jobs:
cat ./${{matrix.dockerinfo.file}}

- name: "Docker QEMU"
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: "Docker BuildX"
id: buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Inspect builder
run: |
Expand All @@ -117,16 +124,6 @@ jobs:
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"

- name: Inspect Source Image
run: |
set -o pipefail
docker buildx imagetools inspect ${{ matrix.dockerinfo.source_container }} | tee -a source-container-inspect.txt

- name: Define Build Platforms
id: define-platforms
run: |
inv containers.platforms --exclude=linux/s390x,linux/mips64le source-container-inspect.txt

- name: "Log into GitHub Container Registry"
uses: docker/login-action@v2
with:
Expand All @@ -139,7 +136,7 @@ jobs:
with:
file: ${{ matrix.dockerinfo.file }}
context: ${{ env.PATH_IN_REPO }}
platforms: ${{ steps.define-platforms.outputs.platforms }}
platforms: ${{ matrix.dockerinfo.platform }}
push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }}
tags: |
ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }}
27 changes: 12 additions & 15 deletions .github/workflows/archlinux-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ jobs:
run: |
python -m pip install -r requirements.txt

- name: "Docker QEMU"
uses: docker/setup-qemu-action@v3

- name: "Docker BuildX"
id: buildx
uses: docker/setup-buildx-action@v3

- name: "Generate Matrix Data"
id: set-matrix
run: |
Expand All @@ -60,10 +67,10 @@ jobs:
mirror-image:
runs-on: ubuntu-latest
needs: matrix-generator
name: "${{ matrix.dockerinfo.name }}"
name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}"
strategy:
fail-fast: false
max-parallel: 4
max-parallel: 10
matrix:
dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }}

Expand Down Expand Up @@ -103,11 +110,11 @@ jobs:
cat ./${{matrix.dockerinfo.file}}

- name: "Docker QEMU"
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: "Docker BuildX"
id: buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Inspect builder
run: |
Expand All @@ -117,16 +124,6 @@ jobs:
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"

- name: Inspect Source Image
run: |
set -o pipefail
docker buildx imagetools inspect ${{ matrix.dockerinfo.source_container }} | tee -a source-container-inspect.txt

- name: Define Build Platforms
id: define-platforms
run: |
inv containers.platforms --exclude=linux/s390x,linux/mips64le source-container-inspect.txt

- name: "Log into GitHub Container Registry"
uses: docker/login-action@v2
with:
Expand All @@ -139,7 +136,7 @@ jobs:
with:
file: ${{ matrix.dockerinfo.file }}
context: ${{ env.PATH_IN_REPO }}
platforms: ${{ steps.define-platforms.outputs.platforms }}
platforms: ${{ matrix.dockerinfo.platform }}
push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }}
tags: |
ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }}
27 changes: 12 additions & 15 deletions .github/workflows/busybox-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ jobs:
run: |
python -m pip install -r requirements.txt

- name: "Docker QEMU"
uses: docker/setup-qemu-action@v3

- name: "Docker BuildX"
id: buildx
uses: docker/setup-buildx-action@v3

- name: "Generate Matrix Data"
id: set-matrix
run: |
Expand All @@ -60,10 +67,10 @@ jobs:
mirror-image:
runs-on: ubuntu-latest
needs: matrix-generator
name: "${{ matrix.dockerinfo.name }}"
name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}"
strategy:
fail-fast: false
max-parallel: 4
max-parallel: 10
matrix:
dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }}

Expand Down Expand Up @@ -103,11 +110,11 @@ jobs:
cat ./${{matrix.dockerinfo.file}}

- name: "Docker QEMU"
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: "Docker BuildX"
id: buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Inspect builder
run: |
Expand All @@ -117,16 +124,6 @@ jobs:
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"

- name: Inspect Source Image
run: |
set -o pipefail
docker buildx imagetools inspect ${{ matrix.dockerinfo.source_container }} | tee -a source-container-inspect.txt

- name: Define Build Platforms
id: define-platforms
run: |
inv containers.platforms --exclude=linux/s390x,linux/mips64le source-container-inspect.txt

- name: "Log into GitHub Container Registry"
uses: docker/login-action@v2
with:
Expand All @@ -139,7 +136,7 @@ jobs:
with:
file: ${{ matrix.dockerinfo.file }}
context: ${{ env.PATH_IN_REPO }}
platforms: ${{ steps.define-platforms.outputs.platforms }}
platforms: ${{ matrix.dockerinfo.platform }}
push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }}
tags: |
ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }}
Loading
Loading