Skip to content

fix(ci): forward smoke traffic through dataplane service #7

fix(ci): forward smoke traffic through dataplane service

fix(ci): forward smoke traffic through dataplane service #7

Workflow file for this run

name: Release
"on":
push:
tags:
- "v*"
workflow_dispatch:
inputs:
release_tag:
description: "Release tag to publish, for example v0.1.0"
required: true
type: string
permissions:
contents: write
packages: write
attestations: write
artifact-metadata: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.inputs.release_tag || github.ref_name || github.run_id }}
cancel-in-progress: false
jobs:
metadata:
name: Metadata
runs-on: ubuntu-latest
outputs:
release_tag: ${{ steps.vars.outputs.release_tag }}
control_image: ${{ steps.vars.outputs.control_image }}
control_image_name: ${{ steps.vars.outputs.control_image_name }}
steps:
- name: Compute release metadata
id: vars
run: |
if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then
release_tag="${{ github.event.inputs.release_tag }}"
else
release_tag="${GITHUB_REF_NAME}"
fi
if [[ -z "${release_tag}" ]]; then
echo "release tag is required" >&2
exit 1
fi
owner_lc="${GITHUB_REPOSITORY_OWNER,,}"
control_image_name="ghcr.io/${owner_lc}/nantian-controlplane"
control_image="${control_image_name}:${release_tag}"
{
echo "release_tag=${release_tag}"
echo "control_image=${control_image}"
echo "control_image_name=${control_image_name}"
} >>"${GITHUB_OUTPUT}"
security-scans:
name: Security Scans
permissions:
contents: read
security-events: read
uses: ./.github/workflows/security-scans.yml
controlplane:
name: Controlplane Tests
runs-on: ubuntu-latest
needs: metadata
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- name: Run Go unit tests
working-directory: controlplane
run: go test ./...
kind-smoke:
name: Kind Validation
runs-on: ubuntu-latest
needs:
- metadata
- controlplane
timeout-minutes: 90
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- name: Install release validation dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends protobuf-compiler libprotobuf-dev jq socat
go install sigs.k8s.io/kind@v0.27.0
sudo curl -fsSL "https://dl.k8s.io/release/v1.32.2/bin/linux/amd64/kubectl" -o /usr/local/bin/kubectl
sudo chmod +x /usr/local/bin/kubectl
echo "$(go env GOPATH)/bin" >>"${GITHUB_PATH}"
- name: Run Kind smoke test with release tag
env:
IMAGE_TAG: ${{ needs.metadata.outputs.release_tag }}
run: ./tests/e2e/run-kind.sh
- name: Run full Gateway API conformance
id: conformance
env:
RELEASE_TAG: ${{ needs.metadata.outputs.release_tag }}
REPORT_PATH: ${{ github.workspace }}/dist/conformance/report.yaml
LOG_PATH: ${{ github.workspace }}/dist/conformance/run.log
run: |
mkdir -p dist/conformance
set +e
ALL_FEATURES=true \
IMPLEMENTATION_VERSION="${RELEASE_TAG}" \
REPORT_OUTPUT="${REPORT_PATH}" \
./tests/conformance/run.sh 2>&1 | tee "${LOG_PATH}"
status=${PIPESTATUS[0]}
echo "exit_code=${status}" >>"${GITHUB_OUTPUT}"
exit "${status}"
- name: Archive conformance report into repository layout
if: always()
env:
RELEASE_TAG: ${{ needs.metadata.outputs.release_tag }}
SOURCE_COMMAND: ALL_FEATURES=true IMPLEMENTATION_VERSION=${{ needs.metadata.outputs.release_tag }} REPORT_OUTPUT=${{ github.workspace }}/dist/conformance/report.yaml ./tests/conformance/run.sh
SOURCE_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
if [[ ! -f dist/conformance/report.yaml ]]; then
echo "no report produced; skipping archival"
exit 0
fi
if [[ "${{ steps.conformance.outputs.exit_code }}" == "0" ]]; then
export RESULT_STATUS=passed
else
export RESULT_STATUS=failed
fi
export REPORT_SCOPE=releases
scripts/archive-conformance-report.sh \
"${RELEASE_TAG}" \
"${GITHUB_WORKSPACE}/dist/conformance/report.yaml" \
"${GITHUB_WORKSPACE}/dist/conformance/run.log"
cp "reports/conformance/releases/${RELEASE_TAG}/metadata.yaml" "dist/conformance/metadata.yaml"
- name: Upload conformance artifact
if: always()
uses: actions/upload-artifact@v7
with:
name: conformance-${{ needs.metadata.outputs.release_tag }}
path: dist/conformance/
if-no-files-found: warn
- name: Publish conformance reports branch
if: always()
env:
COMMIT_MESSAGE: "conformance: archive ${{ needs.metadata.outputs.release_tag }}"
run: |
if [[ ! -f reports/conformance/latest/report.yaml ]]; then
echo "no archived report available; skipping branch publish"
exit 0
fi
scripts/publish-conformance-reports.sh conformance-reports
publish:
name: Publish Release Images
runs-on: ubuntu-latest
needs:
- metadata
- controlplane
- kind-smoke
timeout-minutes: 45
outputs:
control_digest: ${{ steps.build-controlplane.outputs.digest }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push controlplane image
id: build-controlplane
uses: docker/build-push-action@v7
with:
context: .
file: Dockerfile
push: true
tags: ${{ needs.metadata.outputs.control_image }}
- name: Prepare image metadata directory
run: mkdir -p dist/image-metadata
- name: Generate image provenance
env:
RELEASE_TAG: ${{ needs.metadata.outputs.release_tag }}
CONTROL_DIGEST: ${{ steps.build-controlplane.outputs.digest }}
CONTROL_IMAGE: ${{ needs.metadata.outputs.control_image }}
TIMESTAMP: ${{ github.event.repository.updated_at }}
run: |
cat > dist/image-metadata/provenance.json <<HEREDOC
{
"release": "${RELEASE_TAG}",
"ci_run": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"controlplane": {
"image": "${CONTROL_IMAGE}",
"digest": "${CONTROL_DIGEST}"
},
"timestamp": "${TIMESTAMP}"
}
HEREDOC
- name: Upload image metadata artifact
if: always()
uses: actions/upload-artifact@v7
with:
name: image-metadata-${{ needs.metadata.outputs.release_tag }}
path: dist/image-metadata/
if-no-files-found: warn