Skip to content

ci: add the shared security gate to the release workflow in report mode (backport #505 to stable/10) - #537

Merged
emilyoram merged 1 commit into
stable/10from
backport-505-to-stable/10-manual
Nov 30, 2026
Merged

emilyoram merged 1 commit into
stable/10from
backport-505-to-stable/10-manual

Conversation

@emilyoram

Copy link
Copy Markdown
Collaborator

Backport of #505 to stable/10. Stable releases currently publish without the security gate; this makes the stable/10 release job wait for it as well.

Why this is a manual backport

The automated backport (label) failed: the camunda-sdk-automation App has no workflows permission, so it cannot push a change to .github/workflows/. This branch was cherry-picked (-x) from 465bce7 and pushed by a maintainer.

What it does (same as #505)

  • A security-gate job (camunda/sdk-infra/.github/workflows/sdk-security-gate.yml@v1, mode: report) runs alongside the tests. release, the only job that tags, creates the GitHub release or uploads to PyPI, now needs: [security-gate, generate]. notify-release-failure needs it too.
  • scripts/check-gated-commits.sh: after release checks out the branch tip, every commit in GATED_SHA..HEAD must be one of ALLOWED_SHAS, the regeneration commit this run recorded. It warns in report mode and fails in enforce mode. semantic-release-with-retry.sh re-runs it after each retry's reset.
  • release loads scripts/ from GATED_SHA (git archive into $RUNNER_TEMP) and runs the checker and the retry driver from there.

Adapted for stable/10

  • No scripts/push-with-rebase-retry.sh on this branch. generate uses an inline git pull --rebase + git push. The equivalent change is made inline in that step: if the rebase dropped the regeneration commit (HEAD == @{upstream}), it pushes nothing and records nothing. Otherwise it pushes and writes regen-sha.
  • release already had an env: block (UV_PYTHON: "3.12"), so GATED_SHA / ALLOWED_SHAS / SECURITY_GATE_MODE were merged into it rather than added as a second block.
  • notify-release-failure keeps this branch's build-sdk dependency and adds security-gate.
  • Tests: the two push-with-rebase-retry.sh tests from ci: add the shared security gate to the release workflow in report mode #505 are replaced by tests that pull the generate job's Commit generated changes step (id: regen) out of publish.yml and run it against real git clones. One covers a pushed commit, which gets recorded. The other covers a commit the rebase drops, which records nothing. The check-gated-commits.sh and retry re-check tests are unchanged.

Expected warning on this branch

The gate will warn "no code scanning analyses" here: CodeQL default setup doesn't scan ruleset-protected stable branches. Because the gate is in report mode, this doesn't block the release. Tracked in camunda/sdk-infra#128.

Validation

  • uv run pytest -q tests/acceptance/test_api_compat.py: 131 passed. The dropped-commit test fails if the step records unconditionally.
  • actionlint on publish.yml: no new findings (same 22 pre-existing shellcheck info/style findings as stable/10).
  • shellcheck scripts/check-gated-commits.sh scripts/semantic-release-with-retry.sh: clean.
  • Pre-push hook (ruff, ty, escape-hatch guard) passed.

…de (backport #505 to stable/10)

Run camunda/sdk-infra's sdk-security-gate.yml in parallel with the tests
and make the release job (version, tag, PyPI upload) wait for it. Report
mode only warns during rollout.

The release job checks out the branch tip to pick up the generate job's
regenerated commit, and semantic-release-with-retry.sh resets to it again
after a push race. Either can adopt a commit merged after the security
gate checked github.sha, which would then be published unchecked.
scripts/check-gated-commits.sh runs after the checkout and after each
retry's reset: every commit on top of GATED_SHA must be one this run
recorded in ALLOWED_SHAS. Author and subject are caller-controlled git
metadata, so automation commits are identified by SHA only. It warns in
report mode and fails once the gate enforces.

The generate job records the SHA of its regeneration commit only if that
commit survived the rebase and was pushed. The release job loads
scripts/ from the gated commit and runs the checker and the retry driver
from there, so a commit merged since cannot change the code that checks
it.

Backport notes: stable/10 has no scripts/push-with-rebase-retry.sh; its
generate job uses an inline git pull --rebase and git push. The
equivalent change is made inline: push and record the SHA only when the
rebase kept the commit. The release job's existing env block (UV_PYTHON)
now also carries the gate variables, and notify-release-failure keeps
build-sdk. The push-helper tests instead run the generate job's commit
step from publish.yml against real git clones.

Refs camunda/sdk-infra#125

(cherry picked from commit 465bce7)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@emilyoram
emilyoram requested a review from a team as a code owner November 30, 2026 20:24
Copilot AI balanced review requested due to automatic review settings November 30, 2026 20:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain in the report-mode security-gate backport.

No open issues 🎉

What changed in this PR

Backports the shared release security gate to stable/10 in report mode, adding security checks without blocking releases on reported findings or gate errors.

Changes:

  • Makes publishing wait for the security gate and includes gate failures in release notifications.
  • Checks branch-tip commits against the gated commit and recorded regeneration SHA, including after release retries.
  • Loads release scripts from the gated commit and adds regression tests for commit checks and regeneration recording.
File Description
tests/​acceptance/​test_api_compat.py Tests report/enforce behavior, retry checks, and regeneration SHA recording.
scripts/​semantic-release-with-retry.sh Rechecks commit coverage after resetting to a newer branch tip.
scripts/​check-gated-commits.sh Detects commits beyond the gated SHA that this run did not record.
.github/​workflows/​publish.yml Wires the report-mode gate, records regeneration SHAs, and loads gated release scripts.

Review effort: Balanced

@emilyoram
emilyoram merged commit ee6ebf9 into stable/10 Nov 30, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants