v1.12 backports 2023-04-26 #28412
Workflow file for this run
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: Image CI Build | |
# Any change in triggers needs to be reflected in the concurrency group. | |
on: | |
pull_request_target: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
push: | |
branches: | |
- v1.12 | |
- ft/v1.12/** | |
permissions: read-all | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.after }} | |
cancel-in-progress: true | |
jobs: | |
build-and-push-prs: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
include: | |
- name: cilium | |
dockerfile: ./images/cilium/Dockerfile | |
- name: operator-aws | |
dockerfile: ./images/operator/Dockerfile | |
- name: operator-azure | |
dockerfile: ./images/operator/Dockerfile | |
- name: operator-alibabacloud | |
dockerfile: ./images/operator/Dockerfile | |
- name: operator-generic | |
dockerfile: ./images/operator/Dockerfile | |
- name: hubble-relay | |
dockerfile: ./images/hubble-relay/Dockerfile | |
- name: clustermesh-apiserver | |
dockerfile: ./images/clustermesh-apiserver/Dockerfile | |
- name: docker-plugin | |
dockerfile: ./images/cilium-docker-plugin/Dockerfile | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@f03ac48505955848960e80bbb68046aa35c7b9e7 # v2.4.1 | |
- name: Login to quay.io for CI | |
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_USERNAME_CI }} | |
password: ${{ secrets.QUAY_PASSWORD_CI }} | |
- name: Getting image tag | |
id: tag | |
run: | | |
if [ ${{ github.event.pull_request.head.sha }} != "" ]; then | |
echo tag=${{ github.event.pull_request.head.sha }} >> $GITHUB_OUTPUT | |
else | |
echo tag=${{ github.sha }} >> $GITHUB_OUTPUT | |
fi | |
- name: Checkout Source Code | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
with: | |
persist-credentials: false | |
ref: ${{ steps.tag.outputs.tag }} | |
# v1.12 branch pushes | |
- name: CI Build ${{ matrix.name }} | |
if: ${{ github.event_name != 'pull_request_target' }} | |
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0 | |
id: docker_build_ci_v1_12 | |
with: | |
provenance: false | |
context: . | |
file: ${{ matrix.dockerfile }} | |
# Only push when the event name was a GitHub push, this is to avoid | |
# re-pushing the image tags when we only want to re-create the Golang | |
# docker cache after the workflow "Image CI Cache Cleaner" was terminated. | |
push: ${{ github.event_name == 'push' }} | |
platforms: linux/amd64,linux/arm64 | |
tags: | | |
quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:v1.12 | |
quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:${{ steps.tag.outputs.tag }} | |
build-args: | | |
OPERATOR_VARIANT=${{ matrix.name }} | |
- name: CI race detection Build ${{ matrix.name }} | |
if: ${{ github.event_name != 'pull_request_target' }} | |
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0 | |
id: docker_build_ci_v1_12_detect_race_condition | |
with: | |
provenance: false | |
context: . | |
file: ${{ matrix.dockerfile }} | |
# Only push when the event name was a GitHub push, this is to avoid | |
# re-pushing the image tags when we only want to re-create the Golang | |
# docker cache after the workflow "Image CI Cache Cleaner" was terminated. | |
push: ${{ github.event_name == 'push' }} | |
platforms: linux/amd64 | |
tags: | | |
quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:v1.12-race | |
quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:${{ steps.tag.outputs.tag }}-race | |
build-args: | | |
BASE_IMAGE=quay.io/cilium/cilium-runtime:07d9b863089eea0adc70f97f16cbb6c72cf3f14f@sha256:93e56c8f7e7cf1e6103fe8e8b978a5ae057e501a7ac7b78b51abb3905ed6557d | |
LOCKDEBUG=1 | |
RACE=1 | |
OPERATOR_VARIANT=${{ matrix.name }} | |
- name: CI Unstripped Binaries Build ${{ matrix.name }} | |
if: ${{ github.event_name != 'pull_request_target' }} | |
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0 | |
id: docker_build_ci_v1_12_unstripped | |
with: | |
provenance: false | |
context: . | |
file: ${{ matrix.dockerfile }} | |
# Only push when the event name was a GitHub push, this is to avoid | |
# re-pushing the image tags when we only want to re-create the Golang | |
# docker cache after the workflow "Image CI Cache Cleaner" was terminated. | |
push: ${{ github.event_name == 'push' }} | |
platforms: linux/amd64 | |
tags: | | |
quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:v1.12-unstripped | |
quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:${{ steps.tag.outputs.tag }}-unstripped | |
build-args: | | |
NOSTRIP=1 | |
OPERATOR_VARIANT=${{ matrix.name }} | |
- name: CI Image Releases digests | |
if: ${{ github.event_name != 'pull_request_target' }} | |
shell: bash | |
run: | | |
mkdir -p image-digest/ | |
echo "quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:v1.12@${{ steps.docker_build_ci_v1_12.outputs.digest }}" > image-digest/${{ matrix.name }}.txt | |
echo "quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:v1.12-race@${{ steps.docker_build_ci_v1_12_detect_race_condition.outputs.digest }}" >> image-digest/${{ matrix.name }}.txt | |
echo "quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:v1.12-unstripped@${{ steps.docker_build_ci_v1_12_unstripped.outputs.digest }}" >> image-digest/${{ matrix.name }}.txt | |
echo "quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:${{ steps.tag.outputs.tag }}@${{ steps.docker_build_ci_v1_12.outputs.digest }}" >> image-digest/${{ matrix.name }}.txt | |
echo "quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:${{ steps.tag.outputs.tag }}-race@${{ steps.docker_build_ci_v1_12_detect_race_condition.outputs.digest }}" >> image-digest/${{ matrix.name }}.txt | |
echo "quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:${{ steps.tag.outputs.tag }}-unstripped@${{ steps.docker_build_ci_v1_12_unstripped.outputs.digest }}" >> image-digest/${{ matrix.name }}.txt | |
# PR updates | |
- name: CI Build ${{ matrix.name }} | |
if: ${{ github.event_name == 'pull_request_target' }} | |
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0 | |
id: docker_build_ci_pr | |
with: | |
provenance: false | |
context: . | |
file: ${{ matrix.dockerfile }} | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: | | |
quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:${{ steps.tag.outputs.tag }} | |
build-args: | | |
OPERATOR_VARIANT=${{ matrix.name }} | |
- name: CI Image Releases digests | |
if: ${{ github.event_name == 'pull_request_target' }} | |
shell: bash | |
run: | | |
mkdir -p image-digest/ | |
echo "quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:${{ steps.tag.outputs.tag }}@${{ steps.docker_build_ci_pr.outputs.digest }}" > image-digest/${{ matrix.name }}.txt | |
- name: CI race detection Build ${{ matrix.name }} | |
if: ${{ github.event_name == 'pull_request_target' }} | |
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0 | |
id: docker_build_ci_pr_detect_race_condition | |
with: | |
provenance: false | |
context: . | |
file: ${{ matrix.dockerfile }} | |
push: true | |
platforms: linux/amd64 | |
tags: | | |
quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:${{ steps.tag.outputs.tag }}-race | |
build-args: | | |
BASE_IMAGE=quay.io/cilium/cilium-runtime:07d9b863089eea0adc70f97f16cbb6c72cf3f14f@sha256:93e56c8f7e7cf1e6103fe8e8b978a5ae057e501a7ac7b78b51abb3905ed6557d | |
LOCKDEBUG=1 | |
RACE=1 | |
OPERATOR_VARIANT=${{ matrix.name }} | |
- name: CI Unstripped Binaries Build ${{ matrix.name }} | |
if: ${{ github.event_name == 'pull_request_target' }} | |
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0 | |
id: docker_build_ci_pr_unstripped | |
with: | |
provenance: false | |
context: . | |
file: ${{ matrix.dockerfile }} | |
push: true | |
platforms: linux/amd64 | |
tags: | | |
quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:${{ steps.tag.outputs.tag }}-unstripped | |
build-args: | | |
NOSTRIP=1 | |
OPERATOR_VARIANT=${{ matrix.name }} | |
- name: CI Image Releases digests | |
if: ${{ github.event_name == 'pull_request_target' }} | |
shell: bash | |
run: | | |
mkdir -p image-digest/ | |
echo "quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:${{ steps.tag.outputs.tag }}@${{ steps.docker_build_ci_pr.outputs.digest }}" > image-digest/${{ matrix.name }}.txt | |
echo "quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:${{ steps.tag.outputs.tag }}-race@${{ steps.docker_build_ci_pr_detect_race_condition.outputs.digest }}" >> image-digest/${{ matrix.name }}.txt | |
echo "quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:${{ steps.tag.outputs.tag }}-unstripped@${{ steps.docker_build_ci_pr_unstripped.outputs.digest }}" >> image-digest/${{ matrix.name }}.txt | |
# Upload artifact digests | |
- name: Upload artifact digests | |
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
with: | |
name: image-digest ${{ matrix.name }} | |
path: image-digest | |
retention-days: 1 | |
# we need to build cilium-test separately | |
# this is caused by running apt while building the image | |
# which requires qemu setup in order to avoid x86/arm64 binaries mixups | |
# note: we only build on pushes to v1.12 branch | |
build-and-push-with-qemu: | |
if: ${{ github.event_name == 'push' }} | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
include: | |
- name: cilium-test | |
dockerfile: ./images/cilium-test/Dockerfile | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@f03ac48505955848960e80bbb68046aa35c7b9e7 # v2.4.1 | |
- name: Login to quay.io for CI | |
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_USERNAME_CI }} | |
password: ${{ secrets.QUAY_PASSWORD_CI }} | |
- name: Checkout Source Code | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
with: | |
persist-credentials: false | |
ref: ${{ github.sha }} | |
# v1.12 branch pushes | |
- name: CI Build ${{ matrix.name }} | |
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0 | |
id: docker_build_ci_v1_12 | |
with: | |
provenance: false | |
context: . | |
file: ${{ matrix.dockerfile }} | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: | | |
quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:v1.12 | |
quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:${{ github.sha }} | |
- name: CI Image Releases digests | |
shell: bash | |
run: | | |
mkdir -p image-digest/ | |
echo "quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:v1.12@${{ steps.docker_build_ci_v1_12.outputs.digest }}" > image-digest/${{ matrix.name }}.txt | |
echo "quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:${{ github.sha }}@${{ steps.docker_build_ci_v1_12.outputs.digest }}" >> image-digest/${{ matrix.name }}.txt | |
# Upload artifact digests | |
- name: Upload artifact digests | |
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
with: | |
name: image-digest ${{ matrix.name }} | |
path: image-digest | |
retention-days: 1 | |
image-digests: | |
if: ${{ always() && | |
(needs.build-and-push-with-qemu.result == 'success' || needs.build-and-push-with-qemu.result == 'skipped') }} | |
name: Display Digests | |
runs-on: ubuntu-20.04 | |
needs: [build-and-push-prs, build-and-push-with-qemu] | |
steps: | |
- name: Downloading Image Digests | |
shell: bash | |
run: | | |
mkdir -p image-digest/ | |
- name: Download digests of all images built | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
path: image-digest/ | |
- name: Image Digests Output | |
shell: bash | |
run: | | |
cd image-digest/ | |
find -type f | sort | xargs -d '\n' cat |