631 lines
21 KiB
YAML

name: Release
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
inputs:
version:
description: 'Version number'
skip_gh_release:
description: 'Skip creating a GitHub release'
required: false
default: false
type: boolean
extra_helm_tag:
description: 'Additional Helm chart version to push (e.g. 0.0.0-latest-dev)'
required: false
default: ''
type: string
workflow_call:
inputs:
version:
description: 'Version number (without v prefix)'
required: true
type: string
extra_tag:
description: 'Additional Docker image tag to push (e.g. latest-dev)'
required: false
default: ''
type: string
extra_helm_tag:
description: 'Additional Helm chart version to push (e.g. 0.0.0-latest-dev)'
required: false
default: ''
type: string
env:
CARGO_TERM_COLOR: always
CI: true
RUST_VERSION: "1.93.1"
GO_VERSION: "1.26.2"
REGISTRY_IMAGE: ghcr.io/${{ github.repository_owner }}/agentgateway
CONTROLLER_REGISTRY_IMAGE: ghcr.io/${{ github.repository_owner }}/controller
# Note: /charts is added to this
CHART_REGISTRY_IMAGE_BASE: ghcr.io/${{ github.repository_owner }}
jobs:
setup:
runs-on: ubuntu-24.04
outputs:
version: ${{ steps.version.outputs.version }}
steps:
# Help debug what exact was input for this since Github doesn't expose it.
- name: Output Inputs
run: echo "${{ toJSON(github.event.inputs) }}"
- name: Set canonical VERSION
id: version
run: |
# Determine version source
if [ -n "${{ inputs.version }}" ]; then
VERSION="${{ inputs.version }}"
else
VERSION="${{ github.ref_name }}"
fi
# Always strip 'v' prefix if present
VERSION="${VERSION#v}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Canonical VERSION: ${VERSION}"
build-image:
runs-on: ${{ matrix.os }}
permissions:
contents: read
packages: write
needs:
- setup
strategy:
fail-fast: false
matrix:
include:
- platform: linux/amd64
os: blacksmith-4vcpu-ubuntu-2404
- platform: linux/arm64
os: blacksmith-4vcpu-ubuntu-2404-arm
env:
VERSION: ${{ needs.setup.outputs.version }}
steps:
- name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- name: Docker meta
id: meta
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
with:
images: ${{ env.REGISTRY_IMAGE }}
- name: Login to GitHub Container Registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- name: Build and push by digest
id: build
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
with:
build-args: |
VERSION=${{ env.VERSION }}
GIT_REVISION=${{ github.sha }}
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ env.REGISTRY_IMAGE }}
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:buildcache
cache-to: type=registry,ref=${{ env.REGISTRY_IMAGE }}:buildcache,mode=max
- name: Export digest
run: |
mkdir -p ${{ runner.temp }}/digests
digest="${{ steps.build.outputs.digest }}"
touch "${{ runner.temp }}/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: ${{ runner.temp }}/digests/*
if-no-files-found: error
retention-days: 1
push-image:
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
id-token: write
needs:
- setup
- build-image
env:
VERSION: ${{ needs.setup.outputs.version }}
steps:
- name: Install cosign
uses: sigstore/cosign-installer@398d4b0eeef1380460a10c8013a76f728fb906ac # v3
- name: Download digests
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
path: ${{ runner.temp }}/digests
pattern: digests-linux-*
merge-multiple: true
- name: Login to GitHub Container Registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- name: Docker meta
id: meta
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
with:
images: ${{ env.REGISTRY_IMAGE }}
tags: |
type=raw,value=v${{ env.VERSION }}
type=raw,value=${{ inputs.extra_tag }},enable=${{ inputs.extra_tag != '' }}
- name: Create manifest list and push
working-directory: ${{ runner.temp }}/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
- name: Sign the container image
run: cosign sign --yes ${{ env.REGISTRY_IMAGE }}:v${{ env.VERSION }}
- name: Sign the extra tag
if: ${{ inputs.extra_tag != '' }}
run: cosign sign --yes ${{ env.REGISTRY_IMAGE }}:${{ inputs.extra_tag }}
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:v${{ env.VERSION }}
musl-build-image:
runs-on: ${{ matrix.os }}
permissions:
contents: read
packages: write
needs:
- setup
strategy:
fail-fast: false
matrix:
include:
- platform: linux/amd64
os: blacksmith-4vcpu-ubuntu-2404
- platform: linux/arm64
os: blacksmith-4vcpu-ubuntu-2404-arm
env:
VERSION: ${{ needs.setup.outputs.version }}
steps:
- name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- name: Docker meta
id: meta
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
with:
images: ${{ env.REGISTRY_IMAGE }}-musl
- name: Login to GitHub Container Registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- name: Build and push by digest
id: build
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
with:
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ env.REGISTRY_IMAGE }}
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:buildcache-musl
cache-to: type=registry,ref=${{ env.REGISTRY_IMAGE }}:buildcache-musl,mode=max
build-args: |
VERSION=${{ env.VERSION }}
GIT_REVISION=${{ github.sha }}
BUILDER=musl
- name: Export digest
run: |
mkdir -p ${{ runner.temp }}/digests-musl
digest="${{ steps.build.outputs.digest }}"
touch "${{ runner.temp }}/digests-musl/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: digests-musl-${{ env.PLATFORM_PAIR }}
path: ${{ runner.temp }}/digests-musl/*
if-no-files-found: error
retention-days: 1
musl-push-image:
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
id-token: write
needs:
- setup
- musl-build-image
env:
VERSION: ${{ needs.setup.outputs.version }}
steps:
- name: Install cosign
uses: sigstore/cosign-installer@398d4b0eeef1380460a10c8013a76f728fb906ac # v3
- name: Download digests
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
path: ${{ runner.temp }}/digests-musl
pattern: digests-musl*
merge-multiple: true
- name: Login to GitHub Container Registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- name: Docker meta
id: meta
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
with:
images: ${{ env.REGISTRY_IMAGE }}
tags: |
type=raw,value=v${{ env.VERSION }}
type=raw,value=${{ inputs.extra_tag }},enable=${{ inputs.extra_tag != '' }}
- name: Create manifest list and push
working-directory: ${{ runner.temp }}/digests-musl
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + . + "-musl") | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
- name: Sign the container image
run: cosign sign --yes ${{ env.REGISTRY_IMAGE }}:v${{ env.VERSION }}-musl
- name: Sign the extra tag
if: ${{ inputs.extra_tag != '' }}
run: cosign sign --yes ${{ env.REGISTRY_IMAGE }}:${{ inputs.extra_tag }}-musl
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:v${{ env.VERSION }}-musl
build-controller-image:
runs-on: ${{ matrix.os }}
permissions:
contents: read
packages: write
needs:
- setup
strategy:
fail-fast: false
matrix:
include:
- platform: linux/amd64
os: ubuntu-24.04
goarch: amd64
- platform: linux/arm64
os: blacksmith-4vcpu-ubuntu-2404-arm
goarch: arm64
defaults:
run:
working-directory: controller
env:
VERSION: ${{ needs.setup.outputs.version }}
steps:
- name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
working-directory: .
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Login to GitHub Container Registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Go
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
with:
go-version: "${{ env.GO_VERSION }}"
cache-dependency-path: |
**/*.sum
- name: Build controller binary
run: |
CGO_ENABLED=0 GOARCH=${{ matrix.goarch }} GOOS=linux go build \
-ldflags="-X github.com/agentgateway/agentgateway/controller/pkg/version.Version=${{ env.VERSION }} -s -w" \
-o _output/pkg/agentgateway/agentgateway-linux-${{ matrix.goarch }} \
./cmd/agentgateway
- name: Copy Dockerfile
run: cp cmd/agentgateway/Dockerfile.agentgateway _output/pkg/agentgateway/
- name: Docker meta
id: meta
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
with:
images: ${{ env.CONTROLLER_REGISTRY_IMAGE }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- name: Build and push by digest
id: build
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
with:
context: controller/_output/pkg/agentgateway
file: controller/_output/pkg/agentgateway/Dockerfile.agentgateway
build-args: |
GOARCH=${{ matrix.goarch }}
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ env.CONTROLLER_REGISTRY_IMAGE }}
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Export digest
run: |
mkdir -p ${{ runner.temp }}/controller-digests
digest="${{ steps.build.outputs.digest }}"
touch "${{ runner.temp }}/controller-digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: controller-digests-${{ env.PLATFORM_PAIR }}
path: ${{ runner.temp }}/controller-digests/*
if-no-files-found: error
retention-days: 1
push-controller-image:
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
id-token: write
needs:
- setup
- build-controller-image
env:
VERSION: ${{ needs.setup.outputs.version }}
steps:
- name: Install cosign
uses: sigstore/cosign-installer@398d4b0eeef1380460a10c8013a76f728fb906ac # v3
- name: Download digests
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
path: ${{ runner.temp }}/controller-digests
pattern: controller-digests-*
merge-multiple: true
- name: Display structure of downloaded digests
working-directory: ${{ runner.temp }}/controller-digests
run: |
ls -R
echo "Found digest files:"
find . -type f
- name: Login to GitHub Container Registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- name: Docker meta
id: meta
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
with:
images: ${{ env.CONTROLLER_REGISTRY_IMAGE }}
tags: |
type=raw,value=v${{ env.VERSION }}
type=raw,value=${{ inputs.extra_tag }},enable=${{ inputs.extra_tag != '' }}
- name: Create manifest list and push
working-directory: ${{ runner.temp }}/controller-digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(find . -type f -exec sh -c 'printf "${{ env.CONTROLLER_REGISTRY_IMAGE }}@sha256:%s " "$(basename "$1")"' _ {} \;)
- name: Sign the container image
run: cosign sign --yes ${{ env.CONTROLLER_REGISTRY_IMAGE }}:v${{ env.VERSION }}
- name: Sign the extra tag
if: ${{ inputs.extra_tag != '' }}
run: cosign sign --yes ${{ env.CONTROLLER_REGISTRY_IMAGE }}:${{ inputs.extra_tag }}
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.CONTROLLER_REGISTRY_IMAGE }}:v${{ env.VERSION }}
push-helm-charts:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
needs:
- setup
- push-controller-image
env:
VERSION: ${{ needs.setup.outputs.version }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Helm login to ${{ env.CHART_REGISTRY_IMAGE_BASE }}
run: echo "${{ secrets.GITHUB_TOKEN }}" | ./tools/helm registry login ghcr.io -u ${{ github.repository_owner }} --password-stdin
- name: Push helm charts
run: make -C controller release-charts
env:
IMAGE_REGISTRY: ${{ env.CHART_REGISTRY_IMAGE_BASE }}
EXTRA_HELM_TAG: ${{ inputs.extra_helm_tag }}
build:
if: ${{ github.event_name != 'workflow_call' && (github.event_name == 'push' || ! github.event.inputs.skip_gh_release) }}
needs:
- setup
runs-on: ${{ matrix.os }}
permissions:
contents: read
env:
VERSION: ${{ needs.setup.outputs.version }}
strategy:
matrix:
include:
- os: blacksmith-4vcpu-ubuntu-2404
target: x86_64-unknown-linux-musl
# Performance is horrendous on musl without jemalloc
features: jemalloc
name: linux
- os: blacksmith-4vcpu-ubuntu-2404-arm
target: aarch64-unknown-linux-musl
# TODO: arm64 build fails with jemalloc for some reason? https://github.com/tikv/jemallocator/issues/146
features: default
name: linux-arm
- os: macos-26
target: aarch64-apple-darwin
features: default
name: mac
- os: windows-2025
target: x86_64-pc-windows-msvc
features: default
name: windows
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: 24
- name: Install Rust
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # master
with:
toolchain: "${{ env.RUST_VERSION }}"
targets: ${{ matrix.target }}
# TODO: build this in a separate job and just copy it over
- name: Build UI
run: |
cd ui
npm install
npm run build
- name: Prepare Linux target
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' || matrix.target == 'aarch64-unknown-linux-musl' }}
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
rustup target add ${{ matrix.target }}
- name: Build
run: make build
env:
CARGO_BUILD_ARGS: "--target ${{ matrix.target }} -F ${{ matrix.features }}"
- name: Debug dirty build
run: |
git status
- name: Upload Artifact
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: release-binary-${{ matrix.name }}
path: |
target/${{ matrix.target }}/release/agentgateway
target/${{ matrix.target }}/release/agentgateway.exe
release:
if: ${{ github.event_name != 'workflow_call' && (github.event_name == 'push' || ! github.event.inputs.skip_gh_release) }}
needs:
- setup
- push-image
- musl-push-image
- push-controller-image
- push-helm-charts
- build
runs-on: blacksmith-4vcpu-ubuntu-2404
permissions:
contents: write
env:
VERSION: ${{ needs.setup.outputs.version }}
steps:
- name: Download Artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
pattern: release-binary-*
- name: Display structure of downloaded files
run: |
ls -R
mkdir outputs
mv release-binary-mac/agentgateway outputs/agentgateway-darwin-arm64
sha256sum outputs/agentgateway-darwin-arm64 > outputs/agentgateway-darwin-arm64.sha256
mv release-binary-linux/agentgateway outputs/agentgateway-linux-amd64
sha256sum outputs/agentgateway-linux-amd64 > outputs/agentgateway-linux-amd64.sha256
mv release-binary-linux-arm/agentgateway outputs/agentgateway-linux-arm64
sha256sum outputs/agentgateway-linux-arm64 > outputs/agentgateway-linux-arm64.sha256
mv release-binary-windows/agentgateway.exe outputs/agentgateway-windows-amd64.exe
sha256sum outputs/agentgateway-windows-amd64.exe > outputs/agentgateway-windows-amd64.exe.sha256
- name: Create GitHub Release
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2
with:
files: outputs/agentgateway-*
tag_name: ${{ github.ref_name }}
generate_release_notes: true
body: |
🎉 Welcome to the ${{ env.VERSION }} release of the agentgateway project!
## Artifacts
**Docker images** are available:
* `cr.agentgateway.dev/agentgateway:v${{ env.VERSION }}`
* `cr.agentgateway.dev/controller:v${{ env.VERSION }}`
**Helm charts** are available:
* `cr.agentgateway.dev/charts/agentgateway:v${{ env.VERSION }}`
* `cr.agentgateway.dev/charts/agentgateway-crds:v${{ env.VERSION }}`
**Binaries** are available below.
## Quick Start
Follow the [Kubernetes](https://agentgateway.dev/docs/kubernetes/latest/quickstart/) or [Standalone](https://agentgateway.dev/docs/standalone/latest/quickstart/) quick start guide to get started!
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: startsWith(github.ref, 'refs/tags/')