Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ jobs:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: |
set -euo pipefail
if git diff --name-only "${BASE_SHA}...HEAD" | grep -qE '^(buf\.gen\.yaml$|go\.(mod|sum)$|mise\.toml$|proto/|openshell/|e2e/|hack/automation/(start|stop)-gateway\.sh$|\.github/workflows/e2e\.yml$)'; then
changed_paths=$(git diff --name-only "${BASE_SHA}...HEAD")
if grep -qE '^(buf\.gen\.yaml$|go\.(mod|sum)$|mise\.toml$|proto/|openshell/|e2e/|hack/automation/(start|stop)-gateway\.sh$|\.github/workflows/e2e\.yml$)' <<<"$changed_paths"; then
echo "e2e=true" >>"$GITHUB_OUTPUT"
else
echo "e2e=false" >>"$GITHUB_OUTPUT"
Expand All @@ -93,3 +94,22 @@ jobs:
needs: changes
if: needs.changes.outputs.e2e == 'true'
uses: ./.github/workflows/e2e.yml

e2e-gate:
name: e2e-gate
needs: [changes, e2e]
if: ${{ always() && github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check E2E result
env:
CHANGES_RESULT: ${{ needs.changes.result }}
E2E_REQUIRED: ${{ needs.changes.outputs.e2e }}
E2E_RESULT: ${{ needs.e2e.result }}
run: |
case "$CHANGES_RESULT:$E2E_REQUIRED:$E2E_RESULT" in
success:true:success | success:false:skipped) exit 0 ;;
esac
echo "E2E gate failed (changes=$CHANGES_RESULT, required=$E2E_REQUIRED, e2e=$E2E_RESULT)." >&2
exit 1
58 changes: 56 additions & 2 deletions .github/workflows/core-watch.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# Opens one update proposal per new core release tag, then reconciles the RPC
# coverage issues against the newest core tag (hack/automation/).
# Opens one update proposal per new core release tag and reconciles the RPC
# coverage issues against the newest core tag; when auto-merge is on, a
# separate job merges stable proposals that change no proto
# (hack/automation/).
name: core-watch

on:
Expand Down Expand Up @@ -43,6 +45,7 @@ jobs:
permission-contents: write
permission-pull-requests: write
permission-issues: write
permission-checks: ${{ vars.CORE_AUTO_MERGE == 'on' && 'write' || '' }}

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand Down Expand Up @@ -71,6 +74,7 @@ jobs:
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
INPUT_TAG: ${{ inputs.tag }}
CORE_AUTO_MERGE: ${{ vars.CORE_AUTO_MERGE }}
run: |
set -euo pipefail
if [ -n "$INPUT_TAG" ]; then
Expand Down Expand Up @@ -103,3 +107,53 @@ jobs:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: hack/automation/report-failure.sh core-watch "$RUN_URL"

# Merges stable proposals that change no proto and whose checks went green
# (hack/automation/merge-bump-pr.sh). Only when the CORE_AUTO_MERGE
# repository variable is on. A separate job with a separate App: only the
# merge App is a bypass actor on main-integrity, the bump App that pushes
# core/* branches is not, and this job runs no generator or other code
# from core.
merge:
name: merge
needs: watch
if: ${{ !cancelled() && vars.CORE_AUTO_MERGE == 'on' }}
environment: sdk-bot
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- id: app-token
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
with:
client-id: ${{ secrets.SDK_MERGE_CLIENT_ID }}
private-key: ${{ secrets.SDK_MERGE_PRIVATE_KEY }}
permission-contents: write
permission-pull-requests: write
permission-checks: read
permission-statuses: read
permission-issues: write

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false

- uses: jdx/mise-action@236a21c3b91f5db6d4e174b348674a0f0caac06d # v5.2.9
with:
install: false

- name: Install tools
run: mise install --locked yq

- name: Merge proposals that change no proto
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
CORE_AUTO_MERGE: ${{ vars.CORE_AUTO_MERGE }}
run: hack/automation/merge-bump-pr.sh

- name: Report failure
if: failure()
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: hack/automation/report-failure.sh core-watch-merge "$RUN_URL"
32 changes: 31 additions & 1 deletion hack/automation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Workflows run them with a token of the `ai-openshell-sdk-go` GitHub App (`ai-ope
| `open-bump-pr.sh <tag> [--dry-run]` | `core:bump` | Open the update proposal for one core tag: branch `core/<tag>`, pin change, regenerated bindings, proto diff in the body, labels `core-bump` plus `stable` or `prerelease`. Closes older pre-release proposals. |
| `bump-pr-body.md` | | PR body template for `open-bump-pr.sh`. |
| `core-registry.sh` | | Sourced by `start-gateway.sh` and `open-bump-pr.sh`: `core_registry <version>` prints the registry that holds a core release's images, `quay.io/ai-openshell` for releases since the move and `ghcr.io/nvidia/openshell` for older ones. |
| `merge-bump-pr.sh [--dry-run] [--auto-merge on\|off]` | `core:merge` | Merge stable proposals that change no proto: one commit with a provenance check from the bump App, exactly the pin bump, green checks, no `hold` label. Off unless `CORE_AUTO_MERGE` is `on`. |
| `pin-bump.sh` | | Sourced by `open-bump-pr.sh` and `merge-bump-pr.sh`: `pin_bump_edit <tag> <kind>` makes the pin and README edits of a bump, `pin_bump_tree <base> <tag> <kind>` prints the tree a bump commit with only those edits has, `older <a> <b>` compares release tags. |
| `merge-bump-pr-test.sh` | | Offline tests for `pin-bump.sh` and `merge-bump-pr.sh` in scratch Git repositories, with the gh stub in `testdata/merge-bump/bin/`; part of `workflows:check`. |
| `tag-release.sh [--dry-run]` | `release:tag` | After a stable pin lands on `main`: create the lockstep tag `vX.Y.Z` and the GitHub release, then ask the Go module proxy for the version. |
| `drift-check.sh --out <file>` | `core:drift` | Compare core `main` against the pin: `buf breaking`, regenerate and build, uncovered RPCs. Writes the markdown report. |
| `update-drift-issue.sh <report.md>` | | Create, update, or close the single `Core main drift` issue from a report; uncovered RPCs link to their open RPC coverage issues. |
Expand All @@ -28,7 +31,7 @@ Workflows run them with a token of the `ai-openshell-sdk-go` GitHub App (`ai-ope

| Workflow | Script |
|----------|--------|
| `core-watch.yml` (hourly) | `core-tags.sh`, then `open-bump-pr.sh` per tag, then `rpc-issues.sh` |
| `core-watch.yml` (hourly) | job `watch`: `core-tags.sh`, then `open-bump-pr.sh` per tag, then `rpc-issues.sh`; job `merge` (only when `CORE_AUTO_MERGE` is `on`): `merge-bump-pr.sh` |
| `release-tag.yml` (push to `main`) | `tag-release.sh` |
| `core-drift.yml` (nightly) | `drift-check.sh`, then `update-drift-issue.sh` |
| `e2e.yml` (reusable) | `start-gateway.sh`, `mise run e2e`, `stop-gateway.sh` |
Expand All @@ -52,3 +55,30 @@ Workflows run them with a token of the `ai-openshell-sdk-go` GitHub App (`ai-ope
If they are expected, run core-watch by hand with the input `max_new_issues`, or locally `mise run core:rpc-issues -- --max-new <n>`.
- **Preview**: `mise run core:rpc-issues -- --dry-run` prints every planned action with its body and changes nothing (it reads GitHub, so `gh` must be logged in).
Without `--dry-run`, the script applies the plan only with an explicit `BOT_LOGIN` and the bot's token (core-watch passes both); under a person's `gh` login it stops before any write, because later runs would not manage the issues it opened.

## Auto-merge for stable pins

`merge-bump-pr.sh` is off until the repository variable `CORE_AUTO_MERGE` is `on`.
It merges a stable proposal only when the release changes no proto: the regenerated bindings under `proto/` are identical, so the SDK needs no work and can be tagged right away.
A release that changes the protos always waits for review; the SDK release may lag until the new features are wrapped and usable (see the RPC coverage issues).

The proposal must be exactly a pin bump.
`pin_bump_tree` rebuilds the expected tree from the merge base with the same edits `open-bump-pr.sh` makes (the pin in `buf.gen.yaml` and the README line), and the bump commit's tree has to match it.
Any other change sends the proposal to review, including one inside `buf.gen.yaml` such as a plugin entry, a changed conformance fixture, or a second commit.
When auto-merge is on, the bump App records a `core-bump/provenance` check on the stable commit it generated. The merge script verifies the App ID and the exact PR head SHA. A new head without that check goes through review, including proposals opened before auto-merge was enabled.
The proposal also goes back to review when a check fails or someone adds the `hold` label.
It waits for review, too, when its tag is not newer than the pin on `main`, or when `main` moved the pin since the proposal was cut (after an earlier proposal merged, a second one from the same base would only conflict).
If GitHub refuses a merge, the script leaves that proposal for review, goes on with the others, and fails the run so the failure is reported; the comment explaining an unreviewed merge is posted only after the merge succeeds.
Merges happen on the hourly run after the checks turn green, so a stable SDK release follows the core release within about two hours.

The merge runs in its own core-watch job, `merge`, with the token of a second GitHub App that only merges (secrets `SDK_MERGE_CLIENT_ID` and `SDK_MERGE_PRIVATE_KEY` in `sdk-bot`).
That job runs no generator or other code from core.
The script checks the proposal; who may write a `core/*` branch and who may skip review are set by repository rules.
Before an admin sets `CORE_AUTO_MERGE` to `on`:

1. A ruleset on `core/*` lets only the `ai-openshell-sdk-go` App and maintainers create, update, or delete those branches.
2. A ruleset on `main` requires the GitHub Actions `ci` and `e2e-gate` checks with no bypass actors, and the separate DCO rule stays in force. Auto-merge also requires an actual `e2e / e2e` pass on the proposal.
3. The bump App installation has checks write so `core-watch` can record provenance when auto-merge is enabled.
4. The merge App is installed on this repository with contents and pull requests write, checks and statuses read, and issues write (for failure reports), and its secrets are in `sdk-bot`.
5. The merge App is a PR-only bypass actor for `main-integrity` on this repository, so its merge can skip the code owner review.
6. `mise run core:merge -- --dry-run --auto-merge on` with the merge App's token lists the open stable proposals it would merge, and each skip reason matches what you expect.
1 change: 1 addition & 0 deletions hack/automation/bump-pr-body.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ Move the core pin from `{{OLD}}` to `{{NEW}}` ({{KIND}}).

- CI and E2E must pass. If the SDK needs changes for this core version, push them to this branch.
- Merging a stable pin tags the SDK release `{{NEW}}`. Pre-release pins are not tagged; a newer pre-release proposal replaces this one.
- When auto-merge is on (repository variable `CORE_AUTO_MERGE`), core-watch merges a stable proposal without review if the bump App recorded provenance for its single commit, it changes nothing but the pin and the README line, and its checks are green. Add the `hold` label to keep it for review.
Loading