Skip to content

Spec/semconv release flow: integration branches finalize their own release PRs#10738

Merged
chalin merged 14 commits into
open-telemetry:mainfrom
chalin:chalin-m24-spec-release-flow-2026-0708
Jul 9, 2026
Merged

Spec/semconv release flow: integration branches finalize their own release PRs#10738
chalin merged 14 commits into
open-telemetry:mainfrom
chalin:chalin-m24-spec-release-flow-2026-0708

Conversation

@chalin

@chalin chalin commented Jul 9, 2026

Copy link
Copy Markdown
Contributor
  • Fixes Spec/semconv release flow: integration-branch work is discarded at release time #10732
  • Integration workflows (spec and semconv):
    • Adds a release mode: when the latest upstream release is ahead of the submodule pin, the integration branch updates to the released tag and its draft PR is finalized — readied, retitled, and its body synced to the release form. The automation only rewrites PR text it itself wrote: a maintainer-edited title or body is left alone.
    • Extracts the PR create/finalize logic from workflow YAML into a tested, directly executable command, scripts/gh/specs/create-or-finalize-pr.mjs (run with --help for usage).
    • Validates the upstream release tag before it reaches $GITHUB_ENV, and quotes $VERSION/$BRANCH in the workflow shell steps.
  • Drops the spec and semconv entries from auto-update-versions: release PRs for these two repos now come from their integration branches.
  • Updates the maintainer docs (CI workflows page) to cover the release lifecycle.
  • Preview: CI workflows » Spec integration branches

@otelbot-docs otelbot-docs Bot added the missing:docs-approval Co-owning SIG has provided approval, PR needs approval from docs maintainer label Jul 9, 2026
@github-actions github-actions Bot added the CI/infra Repo CI & infrastructure label Jul 9, 2026
@otelbot-docs otelbot-docs Bot added the missing:sig-approval Co-owning SIG didn't provide an approval label Jul 9, 2026
@otelbot-docs
otelbot-docs Bot requested a review from a team July 9, 2026 13:25
@chalin
chalin force-pushed the chalin-m24-spec-release-flow-2026-0708 branch from 61a8300 to b7f9cce Compare July 9, 2026 14:19
chalin added 13 commits July 9, 2026 10:57
- Adds a release mode to pick-branch: when the latest upstream release is newer than the version pinned on main, VERSION is the released tag and the existing integration branch is finalized instead of abandoned.
  - Reads the submodule pin from .gitmodules and parses it defensively (git-describe-style pins).
  - Emits MODE=dev|release to $GITHUB_ENV alongside VERSION/BRANCH.
- Extracts the workflows' PR logic into a tested helper, scripts/gh/specs/ensure-pr, and replaces the PR-creation step of both workflows with a single step that calls it.
  - Dev mode: opens the draft integration PR when needed (bootstrapping the branch with an empty commit), as before.
  - Release mode: creates the non-draft release PR, promotes the existing draft (ready + title + body, written exactly once), or re-syncs the title only so maintainer notes in the body survive daily reruns.
  - The CLI validates MODE/VERSION/BRANCH from the environment and fails loudly on misconfiguration.
- Drops the opentelemetry-specification and semantic-conventions entries from all-versions.sh: releases of these repos are now handled by the integration workflows, which finalize the accumulated integration branch into the release PR instead of opening a fresh one.
- Leaves version-in-file.sh unchanged (still used by the remaining repos and for manual runs).
- The "ensure" idiom obscured what the helper actually does (create the draft or release PR, finalize the draft, re-sync the title); the new name is transparent and matches the workflow step name "Create or finalize pull request".
- Renames the script directory and identifiers (`ensurePullRequest()` -> `createOrFinalizePullRequest()`, etc.); no behavior change.
- Replaces the 10-value `{ action }` result with a plain `created | updated | unchanged` outcome string: the `would-*` variants only echoed the caller's own dry-run input, and the bootstrap distinction is an implementation detail that tests assert via the recorded `git` calls instead.
- Collapses each dry-run/write branch pair into a single code path: one tense-neutral log line (`[dry-run]`-prefixed as needed) with only the writes guarded.
- Moves cli.mjs up to `scripts/gh/specs/create-or-finalize-pr.mjs` (shebang + exec bit) so workflows and maintainers invoke it directly — `scripts/gh/specs/create-or-finalize-pr.mjs --spec=otel` — matching how the repo's shell commands are run; the same-named directory keeps the pure library and its tests.
- Updates both integration workflows, the usage text, and doc comments accordingly.
- Shrinks the command-file header to purpose + "run with --help": the help text now owns the flag and environment reference (DRY).
- Moves cliUsage() from the lib into the command file — it is CLI surface, not library logic; folds the header's GH_TOKEN and branch-checkout notes into a new Environment section.
- Prefers the space form for flag values: usage shows `--spec <otel|semconv>` and the workflows invoke `--spec otel|semconv` (`--spec=<value>` remains supported).
- Updates the spec-integration-branches section for the full release lifecycle:
  - Intro now covers dev-cycle draft PR → finalized release PR, and notes that auto-update-versions.yml excludes the spec repositories (also cross-referenced from the workflow table).
  - Documents pick-branch's MODE selection and the create-or-finalize-pr final step; run-modes section and examples now cover both helpers.
- Adds a refcache entry for the new command's URL, which resolves once this PR lands (same approach as open-telemetry#9682 for pick-branch).
Review feedback: during draft finalization, `gh pr ready` ran before `gh
pr edit`. If `edit` failed after `ready` succeeded, the next run saw a
non-draft PR and only re-synced the title -- the release body was never
written, and the run reported success. Write the title and body first:
if `ready` fails, the PR remains a draft and the next run redoes the
finalization idempotently.

Test improvements from the same review:

- Assert the edit-before-ready order, and add a regression test that a
  failed edit leaves the PR a draft (`pr ready` unreached).
- Make the bootstrap-before-`pr create` ordering assertion real: the
  fake runners can now share an ordered call log; the previous
  assertion (`git.calls.length > 1`) did not check order.
- Reword assertion messages to be positively affirmative.
Review feedback: the new create-or-finalize-pr command documents and is
invoked with `--spec <id>`, while pick-branch's usage text and workflow
invocations still showed `--spec=<id>`. Align on the space form; the
`=` form remains supported and tested.
The finalize mechanics quoted on the page (ready/edit ordering) went
stale within one review cycle -- a sign the page owned too much detail.
Keep the what/why and the step contracts (MODE meaning, env handoff,
maintainer notes preserved); the mechanics live in the helpers'
docstrings and --help.
The command wrapper pipes gh's stdout, so the URL that `gh pr create`
prints was captured and dropped -- an observability regression from the
inline workflow step, which streamed it to the log.
Release-mode finalization becomes three independent, idempotent fixups
-- title sync, body sync, draft-to-ready -- governed by one ownership
rule: the automation rewrites only text it itself wrote (the dev or
release title/body, for any version); once a maintainer edits the title
or the body, that field is theirs and is left alone.

This heals PRs that previous runs could strand (e.g. a draft manually
marked ready kept its draft body forever), re-syncs the stale body
along with the title when a newer release lands, stops reverting
deliberate maintainer retitles, and lets body notes added during the
dev cycle survive finalization.

Addresses a bugbot finding on the release-flow PR.
pick-branch wrote the tag returned by `gh release view` to $GITHUB_ENV
unvalidated in release mode, and workflow shell steps interpolate it
(e.g. `git reset --hard $VERSION`). Git ref syntax rules out word
splitting, but a hostile tag crafted as a command option (leading
`--...`) could still inject arguments. Reject anything that isn't a
plain vX.Y.Z as soon as the tag enters computeIntegrationVersion().

Addresses a security-review finding on the release-flow PR.
@chalin
chalin force-pushed the chalin-m24-spec-release-flow-2026-0708 branch from 098f0f1 to 619d328 Compare July 9, 2026 14:58
Defense-in-depth on top of the vX.Y.Z validation in pick-branch: the
quoting keeps the steps hygienic should the validation ever be loosened
(e.g. to admit pre-release tags).
@chalin
chalin marked this pull request as ready for review July 9, 2026 15:03
@chalin
chalin requested a review from a team as a code owner July 9, 2026 15:03
@chalin
chalin merged commit 7a6d508 into open-telemetry:main Jul 9, 2026
32 checks passed
@chalin
chalin deleted the chalin-m24-spec-release-flow-2026-0708 branch July 9, 2026 15:14
@otelbot-docs otelbot-docs Bot removed missing:docs-approval Co-owning SIG has provided approval, PR needs approval from docs maintainer missing:sig-approval Co-owning SIG didn't provide an approval labels Jul 9, 2026
@otelbot-docs otelbot-docs Bot added the ready-to-be-merged This PR is ready to be merged by a maintainer label Jul 9, 2026
chalin added a commit to chalin/opentelemetry.io that referenced this pull request Jul 9, 2026
Dead arms since open-telemetry#10738 removed opentelemetry-specification and semantic-conventions from all-versions.sh: automation no longer calls this script for them, and a manual invocation would recreate the duplicate release PR that the specs-integration workflow now owns.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/infra Repo CI & infrastructure ready-to-be-merged This PR is ready to be merged by a maintainer

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Spec/semconv release flow: integration-branch work is discarded at release time

2 participants