Skip to content

(chore): use native go instead of curl pod in non agentgateway tests #10173

(chore): use native go instead of curl pod in non agentgateway tests

(chore): use native go instead of curl pod in non agentgateway tests #10173

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
validate:
type: boolean
default: false
description: "Validate the release artifacts"
version:
type: string
required: true
description: |
Version override for the release (must start with 'v' followed by semantic version).
Examples: v1.2.3, v2.0.0-alpha.1, v1.0.0-beta.2
run_load_tests:
type: boolean
default: false
description: "Run load testing suite after release"
push:
branches:
- main
pull_request:
branches:
- main
- 'v[0-9]*.[0-9]*.x'
env:
# this uses the `github.repository_owner` to support releases from forks (useful for testing).
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
VANITY_REGISTRY: cr.kgateway.dev/kgateway-dev
AGW_VANITY_REGISTRY: cr.agentgateway.dev
MAIN_VERSION: v2.3.0-main
GORELEASER_DISABLE_RELEASE: false
permissions:
contents: write
packages: write
jobs:
setup:
name: Setup release inputs
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.set_vars.outputs.version }}
goreleaser_args: ${{ steps.set_vars.outputs.goreleaser_args }}
needs_release: ${{ steps.set_vars.outputs.needs_release }}
previous_tag: ${{ steps.set_vars.outputs.previous_tag }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Set the release related variables
id: set_vars
run: |
set -x
GIT_SHA=$(git rev-parse --short HEAD)
# Validate version input for workflow_dispatch
if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
VERSION="${{ inputs.version }}"
# Validate semver format. Modified version from the recommended semver format.
# See https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string.
if ! echo "$VERSION" | grep -E "^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-((0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$" > /dev/null; then
echo "Error: Version '$VERSION' does not match required semver format (e.g., v1.2.3, v2.0.0-alpha.1)"
exit 1
fi
# Find the previous tag for release notes generation
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD 2>/dev/null || echo "")
NEEDS_RELEASE=true
GORELEASER_ARGS="--clean --skip=validate --release-notes _output/RELEASE_NOTES.md"
elif [[ $GITHUB_REF == refs/heads/main ]]; then
VERSION="${MAIN_VERSION}"
NEEDS_RELEASE=false
GORELEASER_ARGS="--clean --skip=validate"
elif [[ $GITHUB_REF == refs/pull/* ]]; then
GIT_TAG=$(git describe --tags --abbrev=0)
PR_NUM=$(echo "${GITHUB_REF}" | sed -E 's|refs/pull/([^/]+)/?.*|\1|')
VERSION="${GIT_TAG}-pr.${PR_NUM}-${GIT_SHA}"
NEEDS_RELEASE=false
GORELEASER_ARGS="--snapshot --clean"
else
echo "Unknown event type"
exit 1
fi
# Group redirects to satisfy shellcheck SC2129
{
echo "version=${VERSION}"
echo "previous_tag=${PREVIOUS_TAG:-}"
echo "needs_release=${NEEDS_RELEASE}"
echo "goreleaser_args=${GORELEASER_ARGS}"
} >> "$GITHUB_OUTPUT"
helm:
name: Package helm charts
needs: setup
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Helm login to ${{ env.IMAGE_REGISTRY }}
if: ${{ github.event_name != 'pull_request' }}
run: echo "${{ secrets.GITHUB_TOKEN }}" | go tool helm registry login ${{ env.IMAGE_REGISTRY }} -u ${{ github.repository_owner }} --password-stdin
- name: Package kgateway and agentgateway charts
run: make package-kgateway-charts package-agentgateway-charts
env:
VERSION: ${{ needs.setup.outputs.version }}
- name: Push kgateway and agentgateway charts to registry
if: ${{ github.event_name != 'pull_request' }}
run: make release-charts
env:
VERSION: ${{ needs.setup.outputs.version }}
IMAGE_REGISTRY: ${{ env.IMAGE_REGISTRY }}
release-notes:
name: Generate release notes
needs: setup
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
if: ${{ needs.setup.outputs.needs_release == 'true' }}
with:
fetch-depth: 0
- name: Generate release notes
if: ${{ needs.setup.outputs.needs_release == 'true' }}
# Note(tim): CURRENT_TAG defaults to HEAD since the version tag doesn't exist yet.
# This is because that tag is created by goreleaser. We may want to move tag management
# outside of goreleaser in the future. The additional benefit of doing that is we can
# remove the logic where we set --skip-validate when we configure the goreleaser args.
run: make release-notes PREVIOUS_TAG="${{ needs.setup.outputs.previous_tag }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload release notes
if: ${{ needs.setup.outputs.needs_release == 'true' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: release-notes
path: _output/RELEASE_NOTES.md
retention-days: 1
goreleaser:
name: goreleaser
needs: [setup, helm, release-notes]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Prep Go Runner
uses: ./.github/actions/prep-go-runner
- name: Conditionally disable release for pushes to main
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: |
echo "GORELEASER_DISABLE_RELEASE=true" >> "$GITHUB_ENV"
- name: Log into ghcr.io
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
with:
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: "docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392" # v3.6.0
- uses: "docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2" # v3.10 .0
- name: Download release notes
if: ${{ needs.setup.outputs.needs_release == 'true' }}
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: release-notes
path: _output
- name: Run goreleaser
run: make release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ needs.setup.outputs.version }}
IMAGE_REGISTRY: ${{ env.IMAGE_REGISTRY }}
GORELEASER_ARGS: ${{ needs.setup.outputs.goreleaser_args }}
GORELEASER_CURRENT_TAG: ${{ needs.setup.outputs.version }}
GORELEASER_DISABLE_RELEASE: ${{ env.GORELEASER_DISABLE_RELEASE }}
validate:
name: Validate release artifacts
needs: [setup, helm, goreleaser]
if: ${{ inputs.validate }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Prep Go Runner
uses: ./.github/actions/prep-go-runner
- name: Login to ghcr.io
if: ${{ github.event_name != 'pull_request' }}
run: echo "${{ secrets.GITHUB_TOKEN }}" | go tool helm registry login ${{ env.IMAGE_REGISTRY }} -u ${{ github.repository_owner }} --password-stdin
- name: Download module dependencies
run: make mod-download
- name: Setup kind cluster
run: ./hack/kind/setup-kind.sh
env:
VERSION: ${{ needs.setup.outputs.version }}
SKIP_DOCKER: "true"
- name: Install the released chart
run: |
# install the crds first
go tool helm install kgateway-crds oci://${{ env.IMAGE_REGISTRY }}/charts/kgateway-crds \
--version ${{ needs.setup.outputs.version }} \
--wait --timeout 5m
# install the main chart
go tool helm install --create-namespace --namespace kgateway-system kgateway \
oci://${{ env.IMAGE_REGISTRY }}/charts/kgateway \
--set image.registry=${{ env.IMAGE_REGISTRY }} \
--version ${{ needs.setup.outputs.version }} \
--set inferenceExtension.enabled=true \
--wait --timeout 5m
- name: Wait for the kgateway deployment to be ready
run: |
kubectl wait --for=condition=available --timeout=5m deployment/kgateway -n kgateway-system
- name: Run Gateway API and Inference Extension Conformance Tests
run: make all-conformance
shell: bash
env:
VERSION: ${{ needs.setup.outputs.version }}
load_tests:
name: Load Testing
needs: [setup, helm, goreleaser]
if: ${{ inputs.run_load_tests }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Prep Go Runner
uses: ./.github/actions/prep-go-runner
- name: Login to ghcr.io
if: ${{ github.event_name != 'pull_request' }}
run: echo "${{ secrets.GITHUB_TOKEN }}" | go tool helm registry login ${{ env.IMAGE_REGISTRY }} -u ${{ github.repository_owner }} --password-stdin
- name: Download module dependencies
run: make mod-download
- name: Setup kind cluster
run: ./hack/kind/setup-kind.sh
env:
VERSION: ${{ needs.setup.outputs.version }}
SKIP_DOCKER: "true"
- name: Install the released chart
run: |
# install the crds first
go tool helm install kgateway-crds oci://${{ env.IMAGE_REGISTRY }}/charts/kgateway-crds \
--version ${{ needs.setup.outputs.version }} \
--wait --timeout 5m
# install the main chart
go tool helm install --create-namespace --namespace kgateway-system kgateway \
oci://${{ env.IMAGE_REGISTRY }}/charts/kgateway \
--set image.registry=${{ env.IMAGE_REGISTRY }} \
--version ${{ needs.setup.outputs.version }} \
--set inferenceExtension.enabled=true \
--wait --timeout 5m
- name: Wait for the kgateway deployment to be ready
run: |
kubectl wait --for=condition=available --timeout=5m deployment/kgateway -n kgateway-system
- name: Run load tests
run: make run-load-tests
env:
VERSION: ${{ needs.setup.outputs.version }}