Skip to content

Commit

Permalink
Change partner image to certsuite-sample-workload (#477)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebrandon1 authored Aug 9, 2024
1 parent 81176f6 commit 93f4f0b
Showing 1 changed file with 71 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Test/push the `cnf-test-partner` image'
name: 'Test/push the `certsuite-sample-workload` image'
on:
# Run the workflow every day at 5 am UTC (1 am EST, 7am CET)
# This is useful for keeping the image up-to-date with security
Expand All @@ -15,36 +15,37 @@ defaults:

env:
REGISTRY: quay.io
IMAGE_NAME: testnetworkfunction/cnf-test-partner
IMAGE_NAME: redhat-best-practices-for-k8s/certsuite-sample-workload
IMAGE_NAME_LEGACY: testnetworkfunction/cnf-test-partner
IMAGE_TAG: latest
IMAGE_CONTAINER_FILE_PATH: ./test-partner/Dockerfile
SPECIFIC_IMAGE_TAG: tag1

jobs:
test-cnf-test-partner-image:
test-cnf-test-partner-image-legacy:
name: 'Build and test the `cnf-test-partner` image'
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4

- name: 'Build the `cnf-test-partner` image'
run: docker build -t $IMAGE_NAME:$IMAGE_TAG -t $IMAGE_NAME:$SPECIFIC_IMAGE_TAG . --no-cache -f $IMAGE_CONTAINER_FILE_PATH
run: docker build -t $IMAGE_NAME_LEGACY:$IMAGE_TAG -t $IMAGE_NAME_LEGACY:$SPECIFIC_IMAGE_TAG . --no-cache -f $IMAGE_CONTAINER_FILE_PATH
working-directory: .

- name: 'Test: Check if ping is installed'
run: docker run $IMAGE_NAME:$IMAGE_TAG which ping
run: docker run $IMAGE_NAME_LEGACY:$IMAGE_TAG which ping

- name: 'Test: Check if ip is installed'
run: docker run $IMAGE_NAME:$IMAGE_TAG which ip
run: docker run $IMAGE_NAME_LEGACY:$IMAGE_TAG which ip

- name: 'Test: Check if ssh is installed'
run: docker run $IMAGE_NAME:$IMAGE_TAG which ssh
run: docker run $IMAGE_NAME_LEGACY:$IMAGE_TAG which ssh

push-cnf-test-partner-image:
push-cnf-test-partner-image-legacy:
if: ${{ github.ref == 'refs/heads/main' }}
name: 'Push the new `cnf-test-partner` image to Quay.io'
needs: test-cnf-test-partner-image
needs: test-cnf-test-partner-image-legacy
runs-on: ubuntu-22.04

steps:
Expand All @@ -68,6 +69,67 @@ jobs:
password: ${{ secrets.QUAY_ROBOT_TOKEN }}

- name: 'Build and push the new `cnf-test-partner` image(s)'
uses: docker/build-push-action@v6
with:
push: true
file: ${{ env.IMAGE_CONTAINER_FILE_PATH }}
tags: '${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LEGACY }}:${{ env.IMAGE_TAG }},${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LEGACY }}:${{ env.SPECIFIC_IMAGE_TAG }}'
platforms: linux/amd64,linux/arm64

- name: If failed to create the image, send alert msg to dev team.
if: ${{ failure() }}
uses: ./.github/actions/slack-webhook-sender
with:
message: 'Failed to create debug partner image version ${{ env.IMAGE_TAG }}'
slack_webhook: '${{ secrets.SLACK_ALERT_WEBHOOK_URL }}'

test-certsuite-sample-workload-image:
name: 'Build and test the `certsuite-sample-workload` image'
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4

- name: 'Build the `certsuite-sample-workload` image'
run: docker build -t $IMAGE_NAME:$IMAGE_TAG -t $IMAGE_NAME:$SPECIFIC_IMAGE_TAG . --no-cache -f $IMAGE_CONTAINER_FILE_PATH
working-directory: .

- name: 'Test: Check if ping is installed'
run: docker run $IMAGE_NAME:$IMAGE_TAG which ping

- name: 'Test: Check if ip is installed'
run: docker run $IMAGE_NAME:$IMAGE_TAG which ip

- name: 'Test: Check if ssh is installed'
run: docker run $IMAGE_NAME:$IMAGE_TAG which ssh

push-certsuite-sample-workload-image:
if: ${{ github.ref == 'refs/heads/main' }}
name: 'Push the new `certsuite-sample-workload` image to Quay.io'
needs: test-certsuite-sample-workload-image
runs-on: ubuntu-22.04

steps:
- name: Checkout the main branch
uses: actions/checkout@v4
with:
ref: main

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

- name: Authenticate against Quay.io
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
# Use a Robot Account to authenticate against Quay.io
# https://docs.quay.io/glossary/robot-accounts.html
username: ${{ secrets.QUAY_ROBOT_USERNAME_K8S }}
password: ${{ secrets.QUAY_ROBOT_TOKEN_K8S }}

- name: 'Build and push the new `certsuite-sample-workload` image(s)'
uses: docker/build-push-action@v6
with:
push: true
Expand Down

0 comments on commit 93f4f0b

Please sign in to comment.