Repository navigation
Conversation
Add --non-interactive, --allow-open-prs, and --allow-breaking-changes to scripts/releaser, and a workflow_dispatch workflow that runs it with the release App token. release.yaml now accepts dispatches from the release App.
Use the "Use workflow from" ref instead of a branch input and reject anything other than release/X.Y. Point CONTRIBUTING.md at the workflow and keep scripts/release.sh for cases the workflow does not cover.
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 313c1844fa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ractive mode Treat failed open PR and PR metadata lookups as fatal when no override is set, and rename the white-box test to ui_internal_test.go.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f47ec0c2df
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… in non-interactive mode
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ee0095c262
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…-interactive mode
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
| # tag-release.yaml dispatches this workflow with the release App token, | ||
| # so the actor is the App's bot. Mint a token only to learn the App's | ||
| # slug and recognize it. | ||
| - name: Generate release App token |
There was a problem hiding this comment.
Is there a way to attribute to the human selecting the workflow? If I am understanding this right, we're still push button selecting the workflow and kicking it off vs. running a script and remotely kicking it off.
There was a problem hiding this comment.
You cannot trigger the release job as the tag trigger actor unfortunately, but we can pass the info into the tag annotations itself so we know who made it and what CI job created it. The Release job will be triggered by a bot identity still, but the original actor will be carried through and printed out in the release job itself and historically preserved in the tag.
Pass the user who started Tag release to release.yaml and record them in the tag message. release.yaml shows the name in its run title and summary only when the release App dispatched the run, and ignores the inputs on manual runs.
Keep this PR to the releaser flags and the Tag release workflow so it does not change the existing release flow.
| - name: Require a release branch | ||
| env: | ||
| REF: ${{ github.ref }} | ||
| run: | | ||
| set -euo pipefail | ||
| if [[ ! "$REF" =~ ^refs/heads/release/[0-9]+\.[0-9]+$ ]]; then | ||
| echo "::error::Select a release/X.Y branch in \"Use workflow from\", got: $REF" | ||
| exit 1 | ||
| fi |
There was a problem hiding this comment.
@f0ssel what do you think about taking the release branch as a workflow_dispatch input instead, so the workflow always runs from main? That way, we don't have to keep all branches in sync (which has bitten us before), at least when it comes to the tooling responsible for the release process.
We could use a worktree to interact with the release branch, or we could simply tag origin/release/X.Y directly after a full fetch. Thoughts?
…val (#32212) ## Summary **Unblocks releases after the `coder/coder` lockdown.** Only the `coder-release-publisher` App can now create tags and release branches (rulesets "Release tags (App only)" and "Release branch creation", managed in `coder/github-org-terraform`). Its key is only available in environments that need a **second release manager's approval** (`release-managers`, no self-review, no admin bypass). People can't push release tags anymore, so the tag is now created **inside the approved release run**. ### Releasing (`./scripts/release.sh` works as before, minus one step) 1. Run `./scripts/release.sh` on `release/X.Y` (or `main` for an RC), as today. It still picks the version, checks open PRs and breaking changes, and writes the release notes. 2. Instead of creating and pushing the tag, it checks the commit is already on `origin/<branch>` and dispatches `release.yaml` **on the branch** with `version`, `commit`, `release_channel` and `release_notes`. 3. The releaser prints the run's URL. GitHub also notifies the `release-managers` reviewers. **Another release manager approves** the run's `release` environment (Review deployments). 4. The approved job creates the annotated tag `version` at `commit` with the App, then builds, signs and publishes that commit as before. `release.yaml` can also be run by hand from the Actions UI with the same inputs. ### `release.yaml` - New `version` and `commit` inputs (required unless `dry_run`). - The `release` job checks out `commit`. Before anything else, it: - refuses a malformed version; - refuses a version that doesn't match the branch (`release/X.Y`, or `main`/`release/X.Y` for `-rc.N`); - refuses a commit that isn't already on the dispatched branch; - refuses an existing tag that points elsewhere; - otherwise creates the annotated tag with the App. A re-run reuses a tag already at that commit. `version.sh` and the rest of the job are unchanged. - **Homebrew and the `coder/packages` dispatch use the new `coder-package-publisher` App** (`release-publish` environment) instead of `CDRCI_GITHUB_TOKEN`. The dispatch moves to its own `publish-packages` job in `release-publish`, where that key lives; it's approved together with Homebrew and winget. Winget still uses the `cdrci` machine user, since an App can't open PRs on `microsoft/winget-pkgs`. - Every App token is scoped to one repository and the permissions it needs (`zizmor`'s `github-app` audit: 5 high findings to 0, one of which predates this PR). ### `create-release-branch.yaml` (new) Dispatched on `main` with `version` (e.g. `2.40`) and `commit`. After approval in the `release-refs` environment, it creates `release/X.Y` at that commit, refusing one that isn't on `main` or a branch that already exists. ### `scripts/releaser` - `ReleaseExecutor` drops `CreateTag`/`PushTag`. - `TriggerWorkflow` dispatches on the branch with `version` and `commit`. - An existing tag must already point at HEAD. - After dispatching, it looks up the run (`gh run list`, polling briefly) and prints its URL and the approval steps. ## Before merging - [ ] `RELEASE_APP_ID` and `RELEASE_APP_PRIVATE_KEY` set in the **`release-refs`** environment (currently empty), and the rotated release App key in `release`. - [x] `CODER_PACKAGE_PUBLISHER_APP_ID` / `CODER_PACKAGE_PUBLISHER_APP_PRIVATE_KEY` in `release-publish`; App installed on `homebrew-coder` and `packages`. ## After merging: backport to every branch you release from `release.yaml` runs from the dispatched branch's own copy, and `./scripts/release.sh` runs the branch's releaser. So **each `release/X.Y` needs this change before it can release**. Active lines by recent tags: `release/2.39`, `2.38`, `2.37`, `2.36`, `2.35`, `2.34`, `2.29`. ## Relation to #31321 #31321 (`Tag release`) runs the releaser non-interactively in CI. This PR is the smaller change that unblocks releases now. #31321 can build on it: its tagging job would need `environment: release-refs` (where the App key lives) plus the extra App permissions it asks for, which are a manifest change in `coder/github-org-terraform` `apps/`. ## Testing - `go build`, `go vet`, `go test ./scripts/releaser` pass. - `actionlint` and `zizmor` are clean on both workflows. - Not exercised end to end. Suggest the first use be an RC (`v2.40.0-rc.N` from `main`), watching the tag step. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…val (#32212) **Unblocks releases after the `coder/coder` lockdown.** Only the `coder-release-publisher` App can now create tags and release branches (rulesets "Release tags (App only)" and "Release branch creation", managed in `coder/github-org-terraform`). Its key is only available in environments that need a **second release manager's approval** (`release-managers`, no self-review, no admin bypass). People can't push release tags anymore, so the tag is now created **inside the approved release run**. 1. Run `./scripts/release.sh` on `release/X.Y` (or `main` for an RC), as today. It still picks the version, checks open PRs and breaking changes, and writes the release notes. 2. Instead of creating and pushing the tag, it checks the commit is already on `origin/<branch>` and dispatches `release.yaml` **on the branch** with `version`, `commit`, `release_channel` and `release_notes`. 3. The releaser prints the run's URL. GitHub also notifies the `release-managers` reviewers. **Another release manager approves** the run's `release` environment (Review deployments). 4. The approved job creates the annotated tag `version` at `commit` with the App, then builds, signs and publishes that commit as before. `release.yaml` can also be run by hand from the Actions UI with the same inputs. - New `version` and `commit` inputs (required unless `dry_run`). - The `release` job checks out `commit`. Before anything else, it: - refuses a malformed version; - refuses a version that doesn't match the branch (`release/X.Y`, or `main`/`release/X.Y` for `-rc.N`); - refuses a commit that isn't already on the dispatched branch; - refuses an existing tag that points elsewhere; - otherwise creates the annotated tag with the App. A re-run reuses a tag already at that commit. `version.sh` and the rest of the job are unchanged. - **Homebrew and the `coder/packages` dispatch use the new `coder-package-publisher` App** (`release-publish` environment) instead of `CDRCI_GITHUB_TOKEN`. The dispatch moves to its own `publish-packages` job in `release-publish`, where that key lives; it's approved together with Homebrew and winget. Winget still uses the `cdrci` machine user, since an App can't open PRs on `microsoft/winget-pkgs`. - Every App token is scoped to one repository and the permissions it needs (`zizmor`'s `github-app` audit: 5 high findings to 0, one of which predates this PR). Dispatched on `main` with `version` (e.g. `2.40`) and `commit`. After approval in the `release-refs` environment, it creates `release/X.Y` at that commit, refusing one that isn't on `main` or a branch that already exists. - `ReleaseExecutor` drops `CreateTag`/`PushTag`. - `TriggerWorkflow` dispatches on the branch with `version` and `commit`. - An existing tag must already point at HEAD. - After dispatching, it looks up the run (`gh run list`, polling briefly) and prints its URL and the approval steps. - [ ] `RELEASE_APP_ID` and `RELEASE_APP_PRIVATE_KEY` set in the **`release-refs`** environment (currently empty), and the rotated release App key in `release`. - [x] `CODER_PACKAGE_PUBLISHER_APP_ID` / `CODER_PACKAGE_PUBLISHER_APP_PRIVATE_KEY` in `release-publish`; App installed on `homebrew-coder` and `packages`. `release.yaml` runs from the dispatched branch's own copy, and `./scripts/release.sh` runs the branch's releaser. So **each `release/X.Y` needs this change before it can release**. Active lines by recent tags: `release/2.39`, `2.38`, `2.37`, `2.36`, `2.35`, `2.34`, `2.29`. PR is the smaller change that unblocks releases now. #31321 can build on it: its tagging job would need `environment: release-refs` (where the App key lives) plus the extra App permissions it asks for, which are a manifest change in `coder/github-org-terraform` `apps/`. - `go build`, `go vet`, `go test ./scripts/releaser` pass. - `actionlint` and `zizmor` are clean on both workflows. - Not exercised end to end. Suggest the first use be an RC (`v2.40.0-rc.N` from `main`), watching the tag step. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 12766ec)
Adds a
Tag releaseworkflow (.github/workflows/tag-release.yaml) that runsscripts/releaserunattended, so a release no longer needs an engineer to run./scripts/release.shlocally and press Enter through each prompt.The existing release flow is unchanged:
./scripts/release.shbehaves as before unless you pass one of the new flags, and manualrelease.yamlruns are checked as before. The release docs move to Tag release in #31459.Releaser flags
--non-interactiveanswers every prompt with its default, the same as pressing Enter, and logs each answer. Safety checks that default to no (downgrade, duplicate version, skipped patch, tag already exists, version not matching the branch) fail the run with a descriptive error. A prompt with no default fails instead of waiting for input. This mode also requiresghto be logged in, so the open-PR and breaking-change checks can't be skipped without anyone noticing. GitHub lookups that only warn interactively (open PRs, and PR metadata for the breaking-change check and release notes) fail the run instead, as does a failure to open the docs PR.--allow-open-prscontinues when open PRs target the release branch.--allow-breaking-changescontinues when a patch release contains breaking changes.--requested-byand--requested-by-run-urladdRequested-byandRequested-vialines to the tag message. The first line staysRelease vX.Y.Z.--dry-runalready existed and is passed through unchanged.Prompt handling is consolidated in a
promptertype inui.go, with unit tests for the non-interactive behavior.Workflow
Run it from the "Use workflow from" dropdown on a
release/X.Ybranch; any other ref fails the first step. Inputs:dry_run(defaults to true),allow_open_prs, andallow_breaking_changes. When a check fails, re-run with the matching override enabled. Release candidates are tagged onmain, so they still use./scripts/release.shlocally.release.yaml.go run ./scripts/releaserfrom the release branch checkout, so the workflow and flags must exist on that branch.RELEASE_APP_ID) to push the tag, triggerrelease.yaml, and open the docs PR, because that App is on the tag create protection bypass list.Change to
release.yamlTag release triggers
release.yamlwith the release App token, so the run's actor is the App's bot, which isn't a maintainer, and the existingcheck-permswould reject it.check-permsnow mints a read-only release App token to learn the App's slug, and lets the run through when the actor is exactly that App's bot. Tag release has already checked the human's maintainer/admin permission. Every other actor is checked as before. Nothing else inrelease.yamlchanges.release.yamlruns from the tag's ref, so this PR must be on the release branch (backported) before a Tag release there can publish.Before merging
actions: writeto triggerrelease.yamlandpull-requests: writeto open the docs PR. I could not verify its current permissions.Testing
go test ./scripts/releaser,golangci-lint,actionlint, andzizmorpass.--non-interactive --dry-runonmaincompleted the RC flow through the simulatedrelease.yamltrigger (before the workflow was limited to release branches).release/2.38, the run failed on 6 open PRs and suggested--allow-open-prs. With the flag, it completed through the simulated docs PR, and the simulated tag message included theRequested-bylines.--allow-breaking-changespath and the fail-on-lookup-error paths are not tested end to end.Generated by Coder Agents on behalf of @f0ssel.