diff --git a/.claude/commands/release.md b/.claude/commands/release.md new file mode 100644 index 000000000..38ff4a60f --- /dev/null +++ b/.claude/commands/release.md @@ -0,0 +1,164 @@ +--- +allowed-tools: Read, Write, Edit, Bash(*), WebSearch, WebFetch, Agent +description: Release orchestrator — builds a digest of what changed in a release PR, opens a changelog PR, and references the bump PR. Usage: /release PR_NUMBER +--- + +# Release Orchestrator + +Your job is to orchestrate the release process for a given PR. This involves analyzing the PR's commits and changed files to build a structured digest of what changed, determining if there are any breaking changes, preparing a changelog, opening a PR to bump chart versions if needed, and updating the original PR description with the changelog and references to the new PRs. + +--- + +## Phase 1: Collect — Build the release digest + +1. Fetch PR metadata: + ``` + gh pr view $ARGUMENTS --json number,title,body,commits,files + ``` + +2. For each commit SHA in the PR, inspect the changed files: + ``` + git show --name-only --format="%H %s" + ``` + +3. Classify each commit to a component: + - Cortex shim: code touching the shim layer (internal/shim and cmd/shim) + - Cortex postgres: code touching the postgres docker image, or its helm chart + - Cortex core: core code touching anything else: the manager or external scheduler logic of cortex + - General: CI, tooling, docs, or other non-code changes + +4. Finally, read through the cortex helm charts in the helm/ folder, and check which ones have updated appVersions, indicating a new Docker image is available and that the chart should be included in the release notes. + +Produce a structured digest in this exact format — the subagents depend on it: + +``` +## Release Digest — PR #NNN "{title}" + +### Changed Charts +- cortex v1.2.3 (sha-xxxxxxxx) +- cortex-postgres v1.2.3 (sha-xxxxxxxx) +- cortex-nova v1.2.3 — includes cortex v1.2.3, cortex-postgres v1.2.3 + +### Commits by Component + +#### cortex core +- + +#### cortex postgres +- + +#### cortex shim +- + +#### General +- +``` + +**Important**: Do NOT skip or shallow this phase. Read actual file diffs. The subagents depend entirely on the quality of this digest. + +--- + +## Phase 2: Determine Breaking Changes and Prepare a Changelog + +Reason for each change by looking at the commit's diff, if it is a breaking change that requires special attention. + +**Important**: Do NOT skip or shallow this phase. Read actual file diffs. The PR reviewers depend entirely on the quality of this analysis to know what to focus on in their review. + +### When is a change "breaking"? + +A change should be classified as "breaking" if it meets any of the following criteria: + +- It changes or removes the public API of any component (e.g., CRD schemas, CLI flags, or REST API endpoints). Note: additions to the public API are not breaking. +- It requires a config format change (e.g., renaming or removing a values.yaml key, changing the expected format of a value, etc) + +Once the digest is complete, read each agent file, then dispatch all three **in parallel** using the Agent tool in a single message. Each subagent operates independently — do not wait for one before starting the others. + +### Prepare the changelog + +Generate a changelog following this template: + +```markdown +# Changelog + +## YYYY-MM-DD — [#NNN]() + +### v () + +Breaking changes: +- + +Non-breaking changes: +- + +... repeat for each changed chart ... + +### General + +Breaking changes: +- + +Non-breaking changes: +- +``` + +One `###` section per changed chart only. For bundle sections, list which library versions they include, then any bundle-specific changes (values.yaml keys, template/CRD changes). Omit `### General` if empty. No commit SHAs, one line per bullet. + +Example: +```markdown +# Changelog + +## 2026-04-24 — [#123](https://github.com/cobaltcore-dev/cortex/pull/123) + +### cortex v0.0.43 (sha-xxxxxxxx) + +Breaking changes: +- Check hypervisor resources against reservations + +Non-breaking changes: +- Commitments usage API uses postgres database instead of calling nova + +### cortex-postgres v0.5.14 (sha-xxxxxxxx) + +Non-breaking changes: +- Add commitments table migration + +### cortex-nova v0.0.56 (sha-xxxxxxxx) + +Includes updated charts cortex v0.0.43 and cortex-postgres v0.5.14. + +Non-breaking changes: +- values.yaml: added `reservations.enabled` (default: false) + +### General + +Non-breaking changes: +- Update golangci-lint to v2.1.0 +``` + +## Phase 3: Bump Chart Versions + +Prepare chart version bumps so GitHub pushes bumped charts to the registry immediately after the release PR is merged. + +For each changed library chart, patch-bump its `version` in `helm/library//Chart.yaml` (e.g. `0.0.43` → `0.1.0`), if there was no breaking change, otherwise minor-bump it. Do not touch `appVersion`. Then update the matching `dependencies[].version` entry in every `helm/bundles/*/Chart.yaml` that references it. + +Open a single PR to `main` with all the bumps, branch `release/bump-charts-`, noting in the body that it should be merged before the release PR. Use the pull-request-creator agent for this subtask, and include the chart changes in the motivation so they are included in the PR description. + +## Phase 4: Update the PR Description + +Use `gh pr edit` with `--body` to update the PR description with the changelog. It is fine for release pull request descriptions to utilize markdown formatting. Reference the opened bump PR in the description as well as a dependency. + +## Phase 5: Create a Changelog PR + +If the CHANGELOG.md does not exists, create it with a `# Changelog` header. Then create a new PR to `main` with branch `release/changelog-`, title `Update changelog for release PR #`, and a body noting it should be merged after the release PR. Use the pull-request-creator agent for this subtask. + +## Phase 6: Summarize — Report what happened + +After all subagents return, produce a short summary: + +``` +## Release #NNN Post-Open Summary + +- PR description updated with changelog and bump PR reference +- Bump PR #XXX opened to update chart versions +- Changelog PR #YYY opened to update CHANGELOG.md +``` diff --git a/.claude/commands/update-changelog.md b/.claude/commands/update-changelog.md new file mode 100644 index 000000000..79a5e1f44 --- /dev/null +++ b/.claude/commands/update-changelog.md @@ -0,0 +1,54 @@ +--- +allowed-tools: Read, Write, Edit, Bash(*), WebSearch, WebFetch +description: Create a changelog entry for a merged release PR and open a PR to main. Usage: /update-changelog PR_NUMBER +--- + +A release PR (#$ARGUMENTS) was merged into the `release` branch. Create a changelog entry for it and open a PR to `main`. + +To build the entry, use the PR's commit subjects (no diffs) and the changed Helm charts as your sources. Only include charts whose Chart.yaml actually changed in this PR. + +Format each entry as: + +## {merged_at date in UTC, formatted YYYY-MM-DD} — {PR title} ([#NNN](https://github.com/cobaltcore-dev/cortex/pull/NNN)) + +One `###` section per changed chart: `### v ()` +Under each section, bullet the commit subjects that relate to that chart. + +Attribution: for each commit, inspect its changed files with `git show --name-only ` and map to the chart whose files were touched: + +- `postgres/**` → cortex-postgres +- `cmd/shim/**` or `internal/shim/**` → cortex-shim +- `helm/bundles/cortex-/**` → that specific bundle chart +- anything else → cortex (core) + +Commits that only touch CI, docs, or tooling go into `### General`. Skip commits containing "[skip ci]" or that are pure version-bump message. + +For bundle chart sections (helm/bundles/*), add a note listing which library chart versions they now include (read the bundle's Chart.yaml dependencies). Then inspect the actual diff of the bundle's own files with `git show -- helm/bundles//` for any commit that touched that bundle, and surface specific changes: + +- **values.yaml** changes: call out new, removed, or renamed keys and changed defaults +- **templates/** or **crds/** changes: call out added, removed, or modified resources by kind and name + +Prepend the new entry below the `# Changelog` header in `CHANGELOG.md` (create the file if it doesn't exist). Then open a PR to `main` referencing this release PR. + +## Example + +```markdown +## 2026-04-24 — Release libs cortex v0.0.43 + bundles v0.0.56 ([#722](https://github.com/cobaltcore-dev/cortex/pull/722)) + +### cortex v0.0.43 (sha-xxxxxxxx) +- Commitments usage API uses postgres database instead of calling nova +- Check hypervisor resources against reservations +- Add committed resource reservations to capacity calculation + +### cortex-postgres v0.5.14 (sha-xxxxxxxx) +- Add commitments table migration + +### cortex-nova v0.0.56 (sha-xxxxxxxx) +- Update nova bundle for committed reservations support + +### cortex-manila v0.0.56 (sha-xxxxxxxx) +- Update manila bundle for committed reservations support + +### General +- Update golangci-lint to v2.1.0 +``` diff --git a/.coderabbit.yaml b/.coderabbit.yaml index d158def60..e9c45c1bc 100644 --- a/.coderabbit.yaml +++ b/.coderabbit.yaml @@ -1,2 +1,2 @@ reviews: - high_level_summary: false + high_level_summary: false \ No newline at end of file diff --git a/.github/workflows/claude-release.yaml b/.github/workflows/claude-release.yaml new file mode 100644 index 000000000..216716809 --- /dev/null +++ b/.github/workflows/claude-release.yaml @@ -0,0 +1,52 @@ +name: Claude Code Release Orchestrator + +on: + pull_request: + types: [opened, synchronize, reopened] + branches: + - release + +jobs: + release: + if: false # Temporarily disabled + runs-on: ubuntu-latest + concurrency: + group: changelog-release + cancel-in-progress: false + permissions: + contents: write + pull-requests: write + id-token: write + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version-file: 'go.mod' + + - uses: ./.github/actions/setup-claude-code-action + + - uses: ./.github/actions/start-litellm-proxy + env: + AICORE_RESOURCE_GROUP: ${{ secrets.AICORE_RESOURCE_GROUP }} + AICORE_BASE_URL: ${{ secrets.AICORE_BASE_URL }} + AICORE_AUTH_URL: ${{ secrets.AICORE_AUTH_URL }} + AICORE_CLIENT_ID: ${{ secrets.AICORE_CLIENT_ID }} + AICORE_CLIENT_SECRET: ${{ secrets.AICORE_CLIENT_SECRET }} + + - uses: ./.claude-code-action + with: + claude_args: | + --max-turns 1000 + --permission-mode auto + --allowedTools "Read,Write,Edit,Bash(*),WebSearch,WebFetch,Agent" + use_litellm: "true" + litellm_model: "sap/anthropic--claude-4.6-opus" + github_token: ${{ secrets.GITHUB_TOKEN }} + show_full_output: "true" + prompt: "/release ${{ github.event.pull_request.number }}" + + - uses: ./.github/actions/stop-litellm-proxy + if: always()