Skip to content

chore(deps): update module github.com/prometheus/client_golang to v1.23.2 #552

chore(deps): update module github.com/prometheus/client_golang to v1.23.2

chore(deps): update module github.com/prometheus/client_golang to v1.23.2 #552

name: Build and Push Component Docker Images
on:
push:
branches: [main]
pull_request:
branches: [main]
merge_group:
branches: [main]
workflow_dispatch:
inputs:
components:
description: 'Components to build (comma-separated: ambient-runner,ambient-api-server,ambient-control-plane,ambient-mcp,ambient-ui,credential-github,credential-jira,credential-k8s,credential-google) - leave empty for all'
required: false
type: string
default: ''
concurrency:
group: components-build-deploy-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build-matrix:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
build-matrix: ${{ steps.matrix.outputs.build-matrix }}
merge-matrix: ${{ steps.matrix.outputs.merge-matrix }}
built-images: ${{ steps.matrix.outputs.built-images }}
has-builds: ${{ steps.matrix.outputs.has-builds }}
steps:
- name: Checkout code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Detect changed components
if: github.event_name == 'pull_request' || github.event_name == 'merge_group'
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: changes
with:
filters: |
ambient-runner:
- 'components/runners/ambient-runner/**'
ambient-api-server:
- 'components/ambient-api-server/**'
ambient-control-plane:
- 'components/ambient-control-plane/**'
- 'components/ambient-api-server/**'
- 'components/ambient-sdk/go-sdk/**'
ambient-mcp:
- 'components/ambient-mcp/**'
ambient-ui:
- 'components/ambient-ui/**'
- 'components/ambient-sdk/ts-sdk/**'
credential-github:
- 'components/credential-sidecars/github/**'
- 'components/credential-sidecars/entrypoint/**'
- 'components/ambient-mcp/**'
credential-jira:
- 'components/credential-sidecars/jira/**'
- 'components/credential-sidecars/entrypoint/**'
- 'components/ambient-mcp/**'
credential-k8s:
- 'components/credential-sidecars/k8s/**'
- 'components/credential-sidecars/entrypoint/**'
- 'components/ambient-mcp/**'
credential-google:
- 'components/credential-sidecars/google/**'
- 'components/credential-sidecars/entrypoint/**'
- 'components/ambient-mcp/**'
- name: Build component matrices
id: matrix
env:
CHANGES_JSON: ${{ toJSON(steps.changes.outputs) }}
run: |
ALL_COMPONENTS='[
{"name":"ambient-runner","context":"./components/runners/ambient-runner","image":"quay.io/ambient_code/acp_claude_runner","dockerfile":"./components/runners/ambient-runner/Dockerfile"},
{"name":"ambient-api-server","context":"./components/ambient-api-server","image":"quay.io/ambient_code/acp_api_server","dockerfile":"./components/ambient-api-server/Dockerfile"},
{"name":"ambient-control-plane","context":"./components","image":"quay.io/ambient_code/acp_control_plane","dockerfile":"./components/ambient-control-plane/Dockerfile"},
{"name":"ambient-mcp","context":"./components/ambient-mcp","image":"quay.io/ambient_code/acp_mcp","dockerfile":"./components/ambient-mcp/Dockerfile"},
{"name":"ambient-ui","context":"./components","image":"quay.io/ambient_code/acp_ambient_ui","dockerfile":"./components/ambient-ui/Dockerfile"},
{"name":"credential-github","context":".","image":"quay.io/ambient_code/acp_credential_github","dockerfile":"./components/credential-sidecars/github/Dockerfile"},
{"name":"credential-jira","context":".","image":"quay.io/ambient_code/acp_credential_jira","dockerfile":"./components/credential-sidecars/jira/Dockerfile"},
{"name":"credential-k8s","context":".","image":"quay.io/ambient_code/acp_credential_k8s","dockerfile":"./components/credential-sidecars/k8s/Dockerfile"},
{"name":"credential-google","context":".","image":"quay.io/ambient_code/acp_credential_google","dockerfile":"./components/credential-sidecars/google/Dockerfile"}
]'
SELECTED="${{ github.event.inputs.components }}"
if [ -n "$SELECTED" ]; then
# Manual dispatch: build only selected components
FILTERED=$(echo "$ALL_COMPONENTS" | jq -c --arg sel "$SELECTED" '[.[] | select(.name as $n | $sel | split(",") | map(gsub("^\\s+|\\s+$";"")) | index($n))]')
elif [ "${{ github.event_name }}" = "pull_request" ] || [ "${{ github.event_name }}" = "merge_group" ]; then
# PR or merge queue: build only changed components
FILTERED=$(echo "$ALL_COMPONENTS" | jq -c --argjson changes "$CHANGES_JSON" '[.[] | select(.name as $n | $changes[$n] == "true")]')
if [ "$FILTERED" = "[]" ]; then
echo "No component changes detected, skipping builds"
FILTERED="[]"
fi
else
# Push to main: build all
FILTERED="$ALL_COMPONENTS"
fi
echo "build-matrix=$(echo "$FILTERED" | jq -c '.')" >> $GITHUB_OUTPUT
echo "merge-matrix=$(echo "$FILTERED" | jq -c '[.[] | {name, image}]')" >> $GITHUB_OUTPUT
echo "built-images=$(echo "$FILTERED" | jq -c '[.[].image]')" >> $GITHUB_OUTPUT
echo "has-builds=$([ "$FILTERED" != "[]" ] && echo true || echo false)" >> $GITHUB_OUTPUT
echo "Components to build:"
echo "$FILTERED" | jq -r '.[].name'
build-amd64:
needs: build-matrix
if: needs.build-matrix.outputs.has-builds == 'true'
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
strategy:
fail-fast: false
matrix:
component: ${{ fromJSON(needs.build-matrix.outputs.build-matrix) }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Log in to Quay.io
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Build and push ${{ matrix.component.name }} (amd64)
if: github.event_name != 'pull_request'
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
with:
context: ${{ matrix.component.context }}
file: ${{ matrix.component.dockerfile }}
platforms: linux/amd64
push: true
tags: ${{ matrix.component.image }}:${{ github.sha }}-amd64
build-args: |
AMBIENT_VERSION=${{ github.sha }}
GIT_COMMIT=${{ github.sha }}
cache-from: type=gha,scope=${{ matrix.component.name }}-amd64
cache-to: type=gha,mode=max,ignore-error=true,scope=${{ matrix.component.name }}-amd64
- name: Build and push ${{ matrix.component.name }} (amd64) for pull request
if: github.event_name == 'pull_request'
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
with:
context: ${{ matrix.component.context }}
file: ${{ matrix.component.dockerfile }}
platforms: linux/amd64
push: true
tags: ${{ matrix.component.image }}:pr-${{ github.event.pull_request.number }}-amd64
build-args: |
AMBIENT_VERSION=${{ github.sha }}
GIT_COMMIT=${{ github.sha }}
IMAGE_EXPIRY=48h
cache-from: type=gha,scope=${{ matrix.component.name }}-amd64
cache-to: type=gha,mode=max,ignore-error=true,scope=${{ matrix.component.name }}-amd64
build-arm64:
needs: build-matrix
if: needs.build-matrix.outputs.has-builds == 'true'
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
strategy:
fail-fast: false
matrix:
component: ${{ fromJSON(needs.build-matrix.outputs.build-matrix) }}
runs-on: ubuntu-24.04-arm
steps:
- name: Checkout code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Log in to Quay.io
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Build and push ${{ matrix.component.name }} (arm64)
if: github.event_name != 'pull_request'
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
with:
context: ${{ matrix.component.context }}
file: ${{ matrix.component.dockerfile }}
platforms: linux/arm64
push: true
tags: ${{ matrix.component.image }}:${{ github.sha }}-arm64
build-args: |
AMBIENT_VERSION=${{ github.sha }}
GIT_COMMIT=${{ github.sha }}
cache-from: type=gha,scope=${{ matrix.component.name }}-arm64
cache-to: type=gha,mode=max,ignore-error=true,scope=${{ matrix.component.name }}-arm64
- name: Build and push ${{ matrix.component.name }} (arm64) for pull request
if: github.event_name == 'pull_request'
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
with:
context: ${{ matrix.component.context }}
file: ${{ matrix.component.dockerfile }}
platforms: linux/arm64
push: true
tags: ${{ matrix.component.image }}:pr-${{ github.event.pull_request.number }}-arm64
build-args: |
AMBIENT_VERSION=${{ github.sha }}
GIT_COMMIT=${{ github.sha }}
IMAGE_EXPIRY=48h
cache-from: type=gha,scope=${{ matrix.component.name }}-arm64
cache-to: type=gha,mode=max,ignore-error=true,scope=${{ matrix.component.name }}-arm64
merge-manifests:
needs: [build-matrix, build-amd64, build-arm64]
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
strategy:
fail-fast: false
matrix:
component: ${{ fromJSON(needs.build-matrix.outputs.merge-matrix) }}
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Log in to Quay.io
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Create multi-arch manifest for ${{ matrix.component.name }} (main)
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
# Suffixes (-amd64, -arm64) must match the arch matrix in the build job above.
# Arch-suffixed tags remain in the registry after merging. Clean these up
# via Quay tag expiration policies or a periodic job.
run: |
docker buildx imagetools create \
-t ${{ matrix.component.image }}:latest \
-t ${{ matrix.component.image }}:${{ github.sha }} \
${{ matrix.component.image }}:${{ github.sha }}-amd64 \
${{ matrix.component.image }}:${{ github.sha }}-arm64
test-local-dev:
needs: [build-matrix, build-amd64]
if: github.event_name == 'pull_request'
uses: ./.github/workflows/test-local-dev.yml
with:
image-tag: pr-${{ github.event.pull_request.number }}
built-images: ${{ needs.build-matrix.outputs.built-images }}
build-ci-gate:
name: Build CI Gate
runs-on: ubuntu-latest
needs: [build-matrix, build-amd64, build-arm64, merge-manifests, test-local-dev]
if: always()
permissions:
contents: write
pull-requests: write
checks: read
timeout-minutes: 1
steps:
- name: Check build and test status
run: |
failed=false
for result in \
"${{ needs.build-amd64.result }}" \
"${{ needs.build-arm64.result }}" \
"${{ needs.merge-manifests.result }}" \
"${{ needs.test-local-dev.result }}"; do
if [ "$result" == "failure" ] || [ "$result" == "cancelled" ]; then
failed=true
fi
done
if [ "$failed" == "true" ]; then
echo "Build/test failed"
echo " build-amd64: ${{ needs.build-amd64.result }}"
echo " build-arm64: ${{ needs.build-arm64.result }}"
echo " merge-manifests: ${{ needs.merge-manifests.result }}"
echo " test-local-dev: ${{ needs.test-local-dev.result }}"
exit 1
fi
echo "All builds and tests passed (or skipped)!"
- name: Checkout code
if: github.event_name == 'pull_request'
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Try enqueue
if: github.event_name == 'pull_request'
env:
GH_TOKEN: ${{ secrets.AUTO_MERGE_PAT }}
run: bash .github/scripts/try-enqueue.sh "${{ github.event.pull_request.number }}" "Build CI Gate"