Skip to content

Test/push the debug-partner image #843

Test/push the debug-partner image

Test/push the debug-partner image #843

name: 'Test/push the `debug-partner` 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
# patches provided in the UBI.
# Disclaimer: There is no guarantee that scheduled workflows will
# run at the predefined time, if at all. The delay is usually
# around 10-30 minutes.
schedule:
- cron: '0 5 * * *'
release:
types: [published]
workflow_dispatch:
defaults:
run:
shell: bash
working-directory: test-partner
env:
REGISTRY: quay.io
IMAGE_NAME: testnetworkfunction/debug-partner
IMAGE_TAG: latest
IMAGE_CONTAINER_FILE_PATH: test-partner/Dockerfile.debug-partner
jobs:
test-debug-partner-image:
name: 'Build and test the `debug-partner` image'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
continue-on-error: true
- name: 'Build the `debug-partner` image'
run: docker build --no-cache -f Dockerfile.debug-partner -t $IMAGE_NAME:$IMAGE_TAG .
- name: 'Test: Check if lscpu is installed'
run: docker run $IMAGE_NAME:$IMAGE_TAG which lscpu
- name: 'Test: Check if lsblk is installed'
run: docker run $IMAGE_NAME:$IMAGE_TAG which lsblk
- name: 'Test: Check if lspci is installed'
run: docker run $IMAGE_NAME:$IMAGE_TAG which lspci
- 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: 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 }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
- name: Add metadata
uses: docker/metadata-action@v5
id: meta
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
labels: |
maintainer=Red Hat, Inc.
org.opencontainers.image.title=Debug Partner
org.opencontainers.image.description=CNF Certification Test uses it.
org.opencontainers.image.vendor=Red Hat, Inc.
tags: |
type=raw,value=latest
type=schedule,pattern=nightly
type=semver,pattern={{version}}
- name: 'Build and push the new `debug-partner` image'
uses: docker/build-push-action@v5
with:
push: true
file: ${{ env.IMAGE_CONTAINER_FILE_PATH }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: If failed to create the image, send alert msg to dev team.
if: ${{ failure() }}
env:
COMMIT_SHA: ${{ github.sha }}
JOB_RUN_ID: ${{ github.run_id }}
JOB_RUN_ATTEMPT: ${{ github.run_attempt }}
GITHUB_REPO: 'https://github.com/${{ github.repository }}'
run: |
curl -X POST --data "{
\"text\": \"🚨⚠️ Failed to create debug parter image version \`$IMAGE_TAG\` from commit \<$GITHUB_REPO/commit/$COMMIT_SHA|$COMMIT_SHA\>, job ID \<$GITHUB_REPO/actions/runs/$JOB_RUN_ID/attempts/$JOB_RUN_ATTEMPT|$JOB_RUN_ID\> \"
}" -H 'Content-type: application/json; charset=UTF-8' '${{ secrets.GCHAT_WEBHOOK_URL }}'