Skip to content

GitOps CD Workflow: Image Signing and Smoke Testing

Interactive Diagram

새 탭 ↗

Integrated pipeline: Image Signing and Smoke Test

Section titled “Integrated pipeline: Image Signing and Smoke Test”

Here’s an example of the full integrated CI/CD pipeline built for this project’s application. Roughly, it does the following:

  1. CI Job: Checkout Source Code → Build and Push to Container Registry (with SBOM)
  2. Image Signing Job: pull in the self-signed certificate → sign the image using the Notation CLI
  3. CD Job: Checkout GitOps Manifests → Update Manifests and Push to Repository → Sync Argo CD Application
  4. Smoke Test Job: Checkout Source Code → Set up test tooling and run the test script

This example shows that the CD job runs after the signing job succeeds. Signing uses the digest reference exported by CI (target_artifact_reference), but the CD action receives an image_tag. Digest identity and signature verification must be checked separately: look at the image reference the CD action writes to the manifest to see whether it matches the signed digest, then check whether the deployment policy verifies the signature.

Example workflow run result:

Workflow run result

When using the Build and Push Action, a summary is provided showing cache hit rate and the result of the commands executed.

Workflow run summary

Example of managing Container build metadata and Smoke Test results via GitHub Artifacts:

Artifacts management example

Full pipeline manifest:

name: Build and Deploy
on:
push:
branches:
- develop
# pull_request:
# branches:
# - develop
# types:
# - closed
workflow_dispatch:
permissions:
id-token: write
contents: write
jobs:
ci:
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
name: Build and push container image
runs-on: ubuntu-latest
# runs-on: arc-runner-platform
outputs:
branch: ${{ steps.extract_branch.outputs.branch }}
image_tag: ${{ steps.set_tag.outputs.image_tag }}
repo_tag: ${{ steps.set_tag.outputs.repo_tag }}
digest: ${{ steps.push.outputs.digest }}
target_artifact_reference: ${{ steps.extract_digest.outputs.target_artifact_reference }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
# Tagging rule
# [yy].[m].[d].[H][M].v[actions build number]
- name: Set Tag for Build and Artifacts
run: |
echo "IMAGE_TAG=$(TZ=UTC-9 date +'%y%m%d.%H%M').$(printf 'v%03d' ${{github.run_number}})" >> $GITHUB_ENV
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: ACR login
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.ACR_LOGIN_SERVER }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.6.1
- name: Build and push Container image
id: push
uses: docker/build-push-action@v6.5.0
env:
IMAGE_TAG: ${{ env.IMAGE_TAG }}
with:
context: .
file: ./Dockerfile
push: true
cache-from: type=registry,ref=${{ secrets.ACR_LOGIN_SERVER }}/${{ github.event.repository.name }}-cache
cache-to: type=registry,ref=${{ secrets.ACR_LOGIN_SERVER }}/${{ github.event.repository.name }}-cache,mode=max
tags: |
${{ secrets.ACR_LOGIN_SERVER }}/${{ github.event.repository.name }}-${{ steps.extract_branch.outputs.branch }}:${{ env.IMAGE_TAG }}
${{ secrets.ACR_LOGIN_SERVER }}/${{ github.event.repository.name }}-${{ steps.extract_branch.outputs.branch }}:latest
sbom: true
provenance: mode=max
- name: Add Git tag to source repository and setup output
env:
IMAGE_TAG: ${{ env.IMAGE_TAG }}
REPO_TAG: ${{ steps.extract_branch.outputs.branch }}.${{ github.event.repository.name }}.${{ env.IMAGE_TAG }}
run: |
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global user.name "${{ github.actor }}"
git tag -a "${{ env.REPO_TAG }}" -m "Push tag ${{ env.REPO_TAG }}"
git push origin "${{ env.REPO_TAG }}"
echo "image_tag=$(echo ${{ env.IMAGE_TAG }})" >> $GITHUB_OUTPUT
echo "repo_tag=$(echo ${{ env.REPO_TAG }})" >> $GITHUB_OUTPUT
id: set_tag
- name: Retrieve digest
shell: bash
run: |
echo "target_artifact_reference=${{ secrets.ACR_LOGIN_SERVER }}/${{ github.event.repository.name }}-${{ steps.extract_branch.outputs.branch }}@${{ steps.push.outputs.digest }}" >> $GITHUB_OUTPUT
id: extract_digest
sign:
name: Sign the image
needs: ci
# runs-on: ubuntu-latest
runs-on: arc-runner-platform
steps:
- name: Azure login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: ACR login
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.ACR_LOGIN_SERVER }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Retrieve digest
shell: bash
run: |
echo "target_artifact_reference=${{ secrets.ACR_LOGIN_SERVER }}/${{ github.event.repository.name }}-${{ needs.ci.outputs.branch }}@${{ needs.ci.outputs.digest }}" >> $GITHUB_OUTPUT
id: extract_digest
- name: setup notation
uses: notaryproject/notation-action/setup@v1
# Sign your OCI artifact using private key stored in AKV
- name: sign OCI artifact using key pair from AKV
uses: notaryproject/notation-action/sign@v1
with:
plugin_name: azure-kv
plugin_url: https://github.com/Azure/notation-azure-kv/releases/download/v1.1.0/notation-azure-kv_1.1.0_linux_amd64.tar.gz
plugin_checksum: 2fc959bf850275246b044203609202329d015005574fabbf3e6393345e49b884
key_id: ${{ secrets.KV_CERT_ID_IMG_SIGN }}
target_artifact_reference: ${{ steps.extract_digest.outputs.target_artifact_reference }}
signature_format: cose
plugin_config: |-
self_signed=true
cd:
name: Update manifests and sync argocd app
needs: [ci, sign]
# runs-on: ubuntu-latest
runs-on: arc-runner-platform
steps:
- name: Run CD actions
uses: example-org/platform-argocd-apps/.github/actions/cd@develop
with:
gitops_repo_name: ${{ vars.GITOPS_REPO_NAME }}
gitops_token: ${{ secrets.GITOPS_TOKEN }}
branch: ${{ needs.ci.outputs.branch }}
argocd_server: ${{ vars.ARGOCD_SERVER }}
argocd_admin_user: ${{ secrets.ARGOCD_ADMIN_USER }}
argocd_admin_pass: ${{ secrets.ARGOCD_ADMIN_PASS }}
argocd_app_name: ${{ github.event.repository.name }}
acr_login_server: ${{ secrets.ACR_LOGIN_SERVER }}
image_tag: ${{ needs.ci.outputs.image_tag }}
repo_tag: ${{ needs.ci.outputs.repo_tag }}
test:
name: Test after Deploy
needs: cd
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20.14
- name: Install Node.js dependencies
run: npm install
- name: Run Health Check
run: npm run test:smoke

needs sets the execution order for the signing, CD, and smoke test jobs. Check the CD action to see whether it waits for rollout readiness. The test:smoke script defines what counts as a pass.

Continue with CI/CD Test Automation: Environment-specific Testing and k6 Monitoring.