Repository navigation
ci: add the shared security gate to the release workflow in report mode (backport #505 to stable/10) - #537
Merged
Conversation
…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>
Contributor
There was a problem hiding this comment.
🟢 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-automationApp has noworkflowspermission, 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)
security-gatejob (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, nowneeds: [security-gate, generate].notify-release-failureneeds it too.scripts/check-gated-commits.sh: afterreleasechecks out the branch tip, every commit inGATED_SHA..HEADmust be one ofALLOWED_SHAS, the regeneration commit this run recorded. It warns in report mode and fails in enforce mode.semantic-release-with-retry.shre-runs it after each retry's reset.releaseloadsscripts/fromGATED_SHA(git archiveinto$RUNNER_TEMP) and runs the checker and the retry driver from there.Adapted for stable/10
scripts/push-with-rebase-retry.shon this branch.generateuses an inlinegit 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 writesregen-sha.releasealready had anenv:block (UV_PYTHON: "3.12"), soGATED_SHA/ALLOWED_SHAS/SECURITY_GATE_MODEwere merged into it rather than added as a second block.notify-release-failurekeeps this branch'sbuild-sdkdependency and addssecurity-gate.push-with-rebase-retry.shtests from ci: add the shared security gate to the release workflow in report mode #505 are replaced by tests that pull thegeneratejob'sCommit generated changesstep (id: regen) out ofpublish.ymland 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. Thecheck-gated-commits.shand 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.actionlintonpublish.yml: no new findings (same 22 pre-existing shellcheck info/style findings asstable/10).shellcheck scripts/check-gated-commits.sh scripts/semantic-release-with-retry.sh: clean.