forked from intel/afxdp-plugins-for-kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a workflow to build the af_xdp device plugin and push to quay. Signed-off-by: Maryam Tahhan <[email protected]>
- Loading branch information
1 parent
145696b
commit 98f5e63
Showing
1 changed file
with
77 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: afxdp-dp-image-build | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
tags: | ||
- v* | ||
|
||
pull_request: | ||
paths: [.github/workflows/image-build.yaml] | ||
|
||
jobs: | ||
build-and-push-images: | ||
permissions: | ||
contents: read | ||
packages: write | ||
id-token: write # needed for signing the images with GitHub OIDC Token | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
image: | ||
- registry: quay.io | ||
build_language: go | ||
repository: afxdp-device-plugin | ||
image: afxdp-device-plugin | ||
dockerfile: ./images/amd64.dockerfile | ||
context: . | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=tag | ||
type=ref,event=pr | ||
type=sha,format=long | ||
# set latest tag for default branch | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
|
||
|
||
name: Build Image (${{ matrix.image.image }}) | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: sigstore/[email protected] | ||
|
||
- name: Login to quay.io/afxdp-plugins-for-kubernetes | ||
uses: redhat-actions/podman-login@v1 | ||
if: ${{ github.event_name == 'push' && matrix.image.repository == 'afxdp-device-plugin'}} | ||
with: | ||
registry: ${{ matrix.image.registry }} | ||
username: ${{ secrets.QUAY_USERNAME }} | ||
password: ${{ secrets.QUAY_ROBOT_TOKEN }} | ||
|
||
- name: Build image | ||
id: build-image | ||
uses: redhat-actions/buildah-build@v2 | ||
with: | ||
image: ${{ matrix.image.image }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
containerfiles: ${{ matrix.image.dockerfile }} | ||
build-args: ${{ matrix.image.build_args }} | ||
context: ${{ matrix.image.context }} | ||
|
||
- name: Push to registry | ||
id: push-image | ||
uses: redhat-actions/push-to-registry@v2 | ||
if: ${{ github.event_name == 'push' }} | ||
with: | ||
tags: ${{ steps.meta.outputs.tags }} | ||
|
||
- name: Sign the images with GitHub OIDC Token | ||
if: ${{ github.event_name == 'push' }} | ||
run: | | ||
readarray -t tags <<<"${{ steps.meta.outputs.tags }}" | ||
for tag in ${tags[@]}; do | ||
cosign sign -y "${tag}@${{ steps.push-image.outputs.digest }}" | ||
done |