-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PERFSCALE-2470]: Updates to the GHA (#106)
This PR updates the GHA workflow for build & publishing multi-architecture container images Signed-off-by: Krishna Harsha Voora <[email protected]>
- Loading branch information
Showing
3 changed files
with
46 additions
and
51 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,50 @@ | ||
name: Release k8s-netperf container image | ||
|
||
on: | ||
pull_request: | ||
push: | ||
paths: | ||
- 'containers/Dockerfile' # Trigger only when Dockerfile changes in a pull request | ||
- "containers/**" # Trigger only when Dockerfile changes in a pull request | ||
|
||
env: | ||
CONTAINER_REGISTRY: ${{ github.repository_owner == 'cloud-bulldozer' && 'quay.io' }} | ||
RHEL_VERSION: ubi9 | ||
CONTAINER_REGISTRY: ${{ 'quay.io' }} | ||
GO_VER: 1.19 | ||
RHEL_VERSION: ubi9 | ||
|
||
jobs: | ||
|
||
build-and-push-container-images: | ||
name: Build and Push Container Images | ||
name: Build and Publish Multi Architecture Container Images | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Setup QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Setup docker-buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
buildkitd-flags: --debug | ||
config-inline: | | ||
[worker.oci] | ||
max-parallelism = 1 | ||
- name: Checkout | ||
- name: Setup QEMU & Install Dependecies | ||
run: | | ||
sudo apt-get update -y | ||
sudo apt-get install qemu-user-static fuse-overlayfs -y | ||
sudo apt-get install podman -y | ||
if: runner.os == 'Linux' | ||
|
||
- name: Clone Repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Login to the ${{ env.CONTAINER_REGISTRY }} Container Registry | ||
uses: docker/login-action@v2 | ||
- name: Setup Golang | ||
uses: actions/setup-go@v3 | ||
with: | ||
registry: ${{ env.CONTAINER_REGISTRY }} | ||
username: ${{ env.CONTAINER_REGISTRY == 'quay.io' && secrets.QUAY_USER || github.actor }} | ||
password: ${{ env.CONTAINER_REGISTRY == 'quay.io' && secrets.QUAY_TOKEN || secrets.GITHUB_TOKEN } | ||
go-version: ${{ env.GO_VER }} | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
- name: Login to the ${{ env.CONTAINER_REGISTRY }} Container Registry | ||
run: podman login quay.io -u ${QUAY_USER} -p ${QUAY_TOKEN} | ||
with: | ||
images: ${{ env.CONTAINER_REGISTRY }}/${{ github.repository_owner }}/netperf | ||
tags: | | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}}.{{minor}}.{{patch}} | ||
QUAY_USER: ${{ secrets.QUAY_USER }} | ||
QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }} | ||
|
||
- name: Build and push multi-arch Image | ||
- name: Build and Push multi-arch Image | ||
id: push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
file: containers/Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
tags: ${{ steps.meta.outputs.tags }} | ||
push: ${{ github.event_name != 'pull_request' }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
build-args: | | ||
RHEL_VERSION=${{ env.RHEL_VERSION }} | ||
GO_VER=${{ env.GO_VER }} | ||
GO_TAGS= | ||
run: | | ||
make gha-build | ||
make gha-push | ||
env: | ||
GO_VER: ${{ env.GO_VER }} |
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
File renamed without changes.