Skip to content

Commit

Permalink
OPCT-257: fixes/ci pipeline to publish multi-arch manifests
Browse files Browse the repository at this point in the history
Fix multi-arch issues on CI pipeline when publishing manifests
on main and tags (github releases)

fixes in CI build scripts

isolating tool image build

testing docker GHA to cross build
  • Loading branch information
mtulio committed Jul 15, 2024
1 parent 35807a7 commit 4e89038
Show file tree
Hide file tree
Showing 12 changed files with 286 additions and 405 deletions.
177 changes: 162 additions & 15 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
---
name: release-tag
name: test-build-release
on:
pull_request:
push:
tags:
- 'v*.*.*'
branches: [main]
tags: ['v*.*.*']

jobs:
linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Shellcheck - hack
uses: azohra/shell-linter@latest
Expand All @@ -27,30 +27,177 @@ jobs:
with:
path: './openshift-tests-provider-cert/hack/*.sh'


build-container-amd64:
runs-on: ubuntu-latest
needs: [linters]
env:
VERSION: "v0.0.0-devel-pr.${{ github.event.pull_request.number }}"
PLATFORMS: linux/amd64
EXPIRATION: 1d
PUSH: false
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_PASS }}

- name: Build and push - plugin
uses: docker/build-push-action@v6
with:
platforms: ${{ env.PLATFORMS }}
push: ${{ env.PUSH }}
labels: |
quay.expires-after=${{ env.EXPIRATION }}
build-args: |
QUAY_EXPIRATION=${{ env.EXPIRATION }}
tags: quay.io/opct/plugin-openshift-tests:${{ env.VERSION }}
context: ./openshift-tests-provider-cert
file: ./openshift-tests-provider-cert/Containerfile

- name: Build and push - must-gather-monitoring
uses: docker/build-push-action@v6
with:
platforms: ${{ env.PLATFORMS }}
push: ${{ env.PUSH }}
labels: |
quay.expires-after=${{ env.EXPIRATION }}
build-args: |
QUAY_EXPIRATION=${{ env.EXPIRATION }}
tags: quay.io/opct/must-gather-monitoring:${{ env.VERSION }}
context: ./must-gather-monitoring
file: ./must-gather-monitoring/Containerfile

#
# Releasing: triggered when push to main
#
release-latest:
if: startsWith(github.ref, 'refs/head/main')
runs-on: ubuntu-latest
needs: [build-container-amd64]
env:
VERSION: "latest"
PLATFORMS: linux/amd64,linux/arm64
EXPIRATION: never
PUSH: true
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_PASS }}

- name: Build and push - plugin
uses: docker/build-push-action@v6
with:
platforms: ${{ env.PLATFORMS }}
push: ${{ env.PUSH }}
labels: |
quay.expires-after=${{ env.EXPIRATION }}
build-args: |
QUAY_EXPIRATION=${{ env.EXPIRATION }}
tags: quay.io/opct/plugin-openshift-tests:${{ env.VERSION }}
context: ./openshift-tests-provider-cert
file: ./openshift-tests-provider-cert/Containerfile

- name: Build and push - must-gather-monitoring
uses: docker/build-push-action@v6
with:
platforms: ${{ env.PLATFORMS }}
push: ${{ env.PUSH }}
labels: |
quay.expires-after=${{ env.EXPIRATION }}
build-args: |
QUAY_EXPIRATION=${{ env.EXPIRATION }}
tags: quay.io/opct/must-gather-monitoring:${{ env.VERSION }}
context: ./must-gather-monitoring
file: ./must-gather-monitoring/Containerfile


#
# Releasing: triggered when a tag is created
#
release:
release-tag:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: [linters]
needs: [build-container-amd64]
env:
PLATFORMS: linux/amd64,linux/arm64
EXPIRATION: 1d
PUSH: false
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set vars
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}

- name: Push Container image
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_PASS }}

- name: Build and push - plugin
uses: docker/build-push-action@v6
env:
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
QUAY_USER: ${{ secrets.QUAY_USER }}
QUAY_PASS: ${{ secrets.QUAY_PASS }}
run: |
podman login -u="${QUAY_USER}" -p="${QUAY_PASS}" quay.io
cd openshift-tests-provider-cert/;
make release VERSION=$RELEASE_VERSION
VERSION: ${{ steps.vars.outputs.tag }}
with:
platforms: ${{ env.PLATFORMS }}
push: ${{ env.PUSH }}
labels: |
quay.expires-after=${{ env.EXPIRATION }}
build-args: |
QUAY_EXPIRATION=${{ env.EXPIRATION }}
tags: quay.io/opct/plugin-openshift-tests:${{ env.VERSION }}
context: ./openshift-tests-provider-cert
file: ./openshift-tests-provider-cert/Containerfile

- name: Build and push - must-gather-monitoring
uses: docker/build-push-action@v6
env:
VERSION: ${{ steps.vars.outputs.tag }}
with:
platforms: ${{ env.PLATFORMS }}
push: ${{ env.PUSH }}
labels: |
quay.expires-after=${{ env.EXPIRATION }}
build-args: |
QUAY_EXPIRATION=${{ env.EXPIRATION }}
tags: quay.io/opct/must-gather-monitoring:${{ env.VERSION }}
context: ./must-gather-monitoring
file: ./must-gather-monitoring/Containerfile

# https://github.com/mikepenz/release-changelog-builder-action#configuration
- name: Build Changelog
Expand Down
132 changes: 0 additions & 132 deletions .github/workflows/release-devel.yaml

This file was deleted.

3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Result files
*.tar.gz
tools/VERSION
openshift-tests-provider-cert/VERSION
must-gather-monitoring/VERSION
must-gather-monitoring/VERSION
Loading

0 comments on commit 4e89038

Please sign in to comment.