diff --git a/.circleci/custom.yml b/.circleci/custom.yml index 16228fb4c..4952ba99d 100644 --- a/.circleci/custom.yml +++ b/.circleci/custom.yml @@ -35,6 +35,9 @@ # agent renders without skills; make verify-default-agent # simulates the step. # +# The same render on a schedule, against main and the latest releases, is the +# GitHub Actions workflow component-render-schedule (docs/ci.md). +# # The agent-platform-crds chart has been RETIRED — every component now ships # its own CRDs (app-owned CRDs), so there is no longer a CRD-bundle chart to # build/test/publish here. diff --git a/.github/workflows/component-render-schedule.yaml b/.github/workflows/component-render-schedule.yaml new file mode 100644 index 000000000..f64fc9fbb --- /dev/null +++ b/.github/workflows/component-render-schedule.yaml @@ -0,0 +1,240 @@ +# Renders every component chart with the values the meta chart forwards to it, +# against main and the latest patch of the last five minor releases, every six +# hours. A component range floats within its major, so a component release +# changes what an already published agent-platform release installs without an +# agent-platform commit; the PR and tag pipelines never see that. +# +# Each ref is judged by its own values and its own test code: main runs +# `make verify-components-charts verify-examples`, a release tag runs +# `make verify-release-floors verify-examples` (the strict run, no fallback for +# an unreleased component). The report job keeps one issue per failing ref. +# docs/ci.md says how to respond. +name: component-render-schedule + +on: + schedule: + - cron: '23 */6 * * *' + workflow_dispatch: + inputs: + refs: + description: Refs to render, space-separated (default main and the latest patch of the last five minors) + required: false + pull_request: + paths: + - '.github/workflows/component-render-schedule.yaml' + +permissions: {} + +concurrency: + group: component-render-schedule-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +env: + MINORS: 5 + +jobs: + refs: + name: Pick the refs to render + runs-on: ubuntu-26.04 + permissions: + contents: read + outputs: + refs: ${{ steps.pick.outputs.refs }} + steps: + - name: main and the latest patch of the last minors + id: pick + env: + REFS: ${{ inputs.refs }} + REPO: ${{ github.repository }} + run: | + set -euo pipefail + if [ -n "${REFS:-}" ]; then + read -r -a picked <<<"$REFS" + else + tags="$(git ls-remote --tags --refs "https://github.com/$REPO" 'v*' \ + | sed 's#.*refs/tags/##' | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V)" + mapfile -t releases < <(awk -F. '{ last[$1"."$2] = $0 } END { for (m in last) print last[m] }' <<<"$tags" | sort -V | tail -n "$MINORS") + picked=(main "${releases[@]}") + fi + json="$(jq -cn '$ARGS.positional' --args "${picked[@]}")" + echo "refs=$json" >> "$GITHUB_OUTPUT" + echo "rendering: ${picked[*]}" + + render: + name: Render ${{ matrix.ref }} + needs: refs + runs-on: ubuntu-26.04 + timeout-minutes: 30 + permissions: + contents: read + strategy: + fail-fast: false + matrix: + ref: ${{ fromJSON(needs.refs.outputs.refs) }} + env: + # The checks print `ok:` lines to stdout and their FAIL to stderr: unbuffered, + # the log keeps them in order. + PYTHONUNBUFFERED: "1" + steps: + - name: Check out ${{ matrix.ref }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ matrix.ref }} + persist-credentials: false + - name: Install helm + uses: giantswarm/install-binary-action@5bef88f65012037dd836117c8d344b21bb559854 # v4.1.0 + with: + binary: helm + # The pin of .circleci/custom.yml's test-ingress-modes. + version: "3.17.3" + download_url: "https://get.helm.sh/helm-v${version}-linux-amd64.tar.gz" + tarball_binary_path: "linux-amd64/helm" + smoke_test: "${binary} version --short" + - name: Install PyYAML + run: | + for attempt in 1 2 3; do + python3 -c 'import yaml' 2>/dev/null && break + (sudo timeout 180 apt-get update -qq && sudo timeout 180 apt-get install -y -qq python3-yaml) && break + echo "apt attempt $attempt failed or stalled; retrying" >&2; sleep 15 + done + python3 -c 'import yaml' + - name: Render every component with the forwarded values + id: render + env: + REF: ${{ matrix.ref }} + run: | + set -o pipefail + if [ "$REF" = main ]; then + targets=(verify-components-charts verify-examples) + else + targets=(verify-release-floors verify-examples) + fi + # -k: every target reports, not only the first that fails. + make -k "${targets[@]}" 2>&1 | tee "$RUNNER_TEMP/render.log" + - name: Classify the result + if: always() + env: + REF: ${{ matrix.ref }} + OUTCOME: ${{ steps.render.outcome }} + run: | + set -euo pipefail + log="$RUNNER_TEMP/render.log" + touch "$log" + mkdir -p result + # refused: a component chart refuses the forwarded values (what breaks + # installations); unreleased: main's Chart.yaml annotation is stale; + # failed: anything else (setup, the registry, the check itself). + if [ "$OUTCOME" = success ]; then + kind=success + elif grep -q -E 'rejects the values (the meta chart forwards to it|the example gives it)' "$log"; then + kind=refused + elif grep -q 'run `make sync-unreleased`' "$log"; then + kind=unreleased + else + kind=failed + fi + # The FAIL blocks, without the lines that change from run to run. + { grep -E -A6 '^FAIL' "$log" || tail -n 40 "$log"; } | head -n 80 > result/excerpt.txt + echo "$kind" > result/kind + echo "$REF" > result/ref + if [ "$kind" != success ]; then + { echo "### $REF: $kind"; echo '```'; cat result/excerpt.txt; echo '```'; } >> "$GITHUB_STEP_SUMMARY" + fi + - name: Keep the result for the report + if: always() + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: result-${{ strategy.job-index }} + path: result/ + retention-days: 7 + + report: + name: Open, update or close the issues + needs: [refs, render] + if: always() && github.event_name != 'pull_request' && needs.refs.result == 'success' + runs-on: ubuntu-26.04 + permissions: + issues: write + steps: + # An App token, unlike GITHUB_TOKEN, lets the issue's events start the + # board workflows and the team mention notify. The workflow token is the + # fallback when the App is not available or may not write issues. + - name: Generate giantswarm-release token + id: app-token + continue-on-error: true + uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 + with: + client-id: ${{ secrets.RELEASE_BOT_CLIENT_ID }} + private-key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }} + permission-issues: write + - name: Collect the results + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + pattern: result-* + path: results + - name: Report every ref + env: + GH_TOKEN: ${{ steps.app-token.outputs.token || github.token }} + GH_REPO: ${{ github.repository }} + REFS: ${{ needs.refs.outputs.refs }} + SCHEDULED: ${{ github.event_name == 'schedule' }} + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + run: | + set -euo pipefail + title_of() { + if [ "$1" = main ]; then echo "agent-platform main branch chart doesn't render" + else echo "agent-platform release $1 chart doesn't render"; fi + } + open="$(gh issue list --state open --label team/bumblebee --limit 500 --json number,title)" + number_of() { + TITLE="$1" jq -r 'map(select(.title == env.TITLE))[0].number // empty' <<<"$open" + } + + mapfile -t refs < <(jq -r '.[]' <<<"$REFS") + for ref in "${refs[@]}"; do + dir="$( (grep -l -x -F -- "$ref" results/*/ref 2>/dev/null || true) | head -n 1 | xargs -r dirname)" + if [ -n "$dir" ]; then + kind="$(cat "$dir/kind")"; excerpt="$(cat "$dir/excerpt.txt")" + else + kind=failed; excerpt="The render job reported no result: it failed before the render ran." + fi + title="$(title_of "$ref")" + number="$(number_of "$title")" + if [ "$kind" = success ]; then + [ -z "$number" ] || gh issue close "$number" --comment "Every component renders again on \`$ref\`: $RUN_URL" + continue + fi + if [ "$ref" = main ]; then where="the next release"; else where="installations that reconcile \`$ref\`"; fi + case "$kind" in + refused) what="A component chart refuses the values agent-platform \`$ref\` forwards to it: $where now fail to install or upgrade that component." ;; + unreleased) what="\`main\`'s \`agent-platform.giantswarm.io/unreleased\` annotation no longer matches the registry: run \`make sync-unreleased\` on \`main\`. Installations are not affected." ;; + *) what="The render check for \`$ref\` could not finish (setup, the registry or the check itself). This does not say that installations fail; look at the run." ;; + esac + signature="$(printf '%s\n%s' "$kind" "$excerpt" | sha256sum | cut -c1-16)" + report="$(printf '%s\n\nRun: %s\n\n```\n%s\n```\n\nHow to respond: [docs/ci.md](https://github.com/%s/blob/main/docs/ci.md#scheduled-component-render).\n\n' \ + "$what" "$RUN_URL" "$excerpt" "$GH_REPO" "$signature")" + if [ -z "$number" ]; then + gh issue create --title "$title" --label team/bumblebee --body "$(printf '@giantswarm/team-bumblebee %s' "$report")" + continue + fi + # A new comment only when the failure changed: the same refusal + # every six hours says nothing new. + last="$(gh issue view "$number" --json body,comments \ + --jq '[.body, (.comments[].body)] | map(select(contains("render-signature"))) | last // ""')" + if [[ "$last" != *"render-signature: $signature"* ]]; then + gh issue comment "$number" --body "$report" + fi + done + + # A ref the schedule no longer renders (a newer patch or minor took its + # place, or it was rendered once by hand) never turns green: close its + # issue so the open ones are the refs that are still checked. + if [ "$SCHEDULED" = true ]; then + TITLES="$(for ref in "${refs[@]}"; do title_of "$ref"; done | jq -R . | jq -sc .)" \ + jq -r '(env.TITLES | fromjson) as $t + | .[] | select(.title | test("^agent-platform (release v[0-9.]+|main branch) chart doesn.t render$")) + | select(.title as $x | $t | index($x) | not) | .number' <<<"$open" \ + | while read -r stale; do + gh issue close "$stale" --comment "The schedule no longer renders this ref (a newer patch or minor took its place): $RUN_URL. Reopen it if installations still run it." + done + fi diff --git a/README.md b/README.md index 4d97cdb11..49b954974 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,7 @@ Each component is developed in its own repository, linked above. This repository - **[`helm/agent-platform-connectivity`](helm/agent-platform-connectivity)** wires the components together: routes and gateways, network policies for Cilium and plain Kubernetes, Kyverno exceptions, the kagent model catalog, [serving presets](docs/serving-presets.md) and Grafana dashboards. - **[`skills`](skills)** holds the platform's own agent skills, pinned to each release. They follow the platform: a change to it updates them in the same pull request. - **[`tests`](tests)** holds the render assertions behind `make verify-*` and an end-to-end install on kind ([tests/ats](tests/ats/README.md)). +- **[CI](docs/ci.md)** runs those assertions on every pull request and release, and renders the component charts against `main` and the latest releases every six hours. ```bash make verify-all # the render assertions CI runs: Helm 3.17.3, no cluster needed diff --git a/docs/ci.md b/docs/ci.md new file mode 100644 index 000000000..222bbd7fb --- /dev/null +++ b/docs/ci.md @@ -0,0 +1,35 @@ +# CI + +| Pipeline | When | What it runs | +| --- | --- | --- | +| CircleCI `test-ingress-modes` | Every pull request | `make verify-all`: every render assertion, including `verify-components-charts` and `verify-examples`. | +| CircleCI `verify-release-floors` | Every release tag, before the charts are pushed | `make verify-release-floors`: the strict run of `verify-components-charts`, which refuses a range or a BOM pin that resolves to no published chart. | +| GitHub Actions `component-render-schedule` | Every six hours, and by hand | The component render below, against `main` and published releases. | + +## Scheduled component render + +Each `components.*.versionRange` floats within its major, so a component release changes what an already published agent-platform release installs, without any agent-platform commit. The pull request and tag pipelines run before that component release and cannot see it. + +[`component-render-schedule`](../.github/workflows/component-render-schedule.yaml) closes that gap. Every six hours it checks out `main` and the latest patch of the five highest minor releases, resolves every component range the way Flux does today, pulls the charts, and renders each one with the values the meta chart forwards to it. Each ref runs its own targets, with its own values: + +- `main`: `make verify-components-charts verify-examples` +- a release tag: `make verify-release-floors verify-examples` + +This catches a component that refuses the forwarded values: a closed values schema that no longer accepts a key, a `fail` guard in a template, a required value the meta chart does not set. It does not catch components that render but do not work together, or anything that only shows on a running cluster. + +To render other refs, run the workflow by hand with the `refs` input, for example `gh workflow run component-render-schedule.yaml -f refs="v4.175.1"`. + +### When an issue opens + +A failing ref opens the issue *agent-platform release `` chart doesn't render* (or *agent-platform main branch chart doesn't render*), labelled `team/bumblebee`, mentioning the team. The issue says which kind of failure it is: + +- **A component refuses the forwarded values.** Installations that reconcile that release into the new component version fail. It names the component, the version its range resolved to and the refusal. +- **The `unreleased` annotation is stale** (`main` only). A component the annotation waits for is now published: run `make sync-unreleased` on `main`. Installations are not affected. +- **The check could not finish**, for example on a setup or registry failure. It does not mean installations fail; look at the run. + +A later failing run comments only when the failure changed. The next passing run closes the issue, and so does the next scheduled run once the ref is no longer rendered (a newer patch or minor took its place, or it was rendered by hand). + +When a component refuses the values, respond in one of these ways: + +- Fix the meta chart on `main`: forward values the new component accepts, or cap the range below the breaking version. Then release a patch, and when an older minor that installations still run is affected, a patch of that minor too. +- Have the component restore what it removed in a patch release, when the refusal is a breaking change inside a major.