Skip to content

chore(QTDI-3926): Make release push atomic and fail-closed - #1351

Merged
lxia-talend merged 5 commits into
masterfrom
lxia-talend/QTDI-3926_atomic_release_push
Nov 30, 2026
Merged

lxia-talend merged 5 commits into
masterfrom
lxia-talend/QTDI-3926_atomic_release_push

Conversation

@lxia-talend

@lxia-talend lxia-talend commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

https://qlik-dev.atlassian.net/browse/QTDI-3926

Requirements

  • Any code change adding any logic MUST be tested through a unit test executed with the default build
  • Any API addition MUST be done with a documentation update if relevant

Why this PR is needed?

QTDI-3926: the release script pushed the branch and tag with --follow-tags, which is not atomic. A moved or unreachable remote branch could leave the tag pushed without the branch (or vice versa) during a release.

What does this PR adds (design/code thoughts)?

  • New sourced helper .jenkins/scripts/release/release-git-common.sh: pushes branch + tag in a single git push --atomic, and aborts before any push if the remote branch cannot be fetched or has moved during the release (fail-closed).
  • release-4-docker-image-creation.sh uses the helper. DRY_RUN still pushes only the branch, with --dry-run.
  • release-git-push-test.sh: offline bare-repository simulation of the release push (manual test, not wired into CI). Covers fetch failure, moved remote, DRY_RUN and remote refusal (both refs rejected).
  • release-5/release-6 unchanged (single-ref pushes).
  • Note: the push lives in the Docker stage, which is skipped under NO_DOCKER (pre-existing).

Verification: bash -n clean; simulation script passes locally. No Java changes, so mvn verify is not affected.

AI contribution metrics

  • Code Generation % (this PR): 100% (174/174 changed lines)
  • Code Generation % (ticket-wide cumulative): 100%
  • Technical Design % (ticket-wide cumulative): unavailable — no plan revision files found

AI generated code

https://internal.qlik.dev/general/ways-of-working/code-reviews/#guidelines-for-ai-generated-code

  • this PR has been written with the help of GitHub Copilot or another generative AI tool

🤖 Generated with Claude Code

@lxia-talend

Copy link
Copy Markdown
Contributor Author

Critic Round 1 — Findings

No Blocker or Major findings. Files: release-git-common.sh (new), release-4-docker-image-creation.sh (mod), release-git-push-test.sh (new).

# Severity File Description Suggested Fix
1 MINOR release-git-common.sh Check-then-push is a TOCTOU window; mitigated because a non-fast-forward branch push is rejected by the remote and --atomic then drops the tag too. None needed.
2 MINOR release-git-push-test.sh git init -b needs git >= 2.28. None needed.
3 MINOR release-4 Fetch fails if the branch does not exist on origin (fail-closed by design; release branches always exist). None needed.

Verified: fetch failure and moved remote abort before any push; DRY_RUN pushes only the branch with --dry-run and updates no ref; remote-refusal case shows both refs rejected by the atomic push (pre-receive hook output seen in log).

Approval gate: APPROVED — no Blocker or Major findings. 3 Minor noted (non-blocking).

Signed: Claude Sonnet 5.5

@lxia-talend

Copy link
Copy Markdown
Contributor Author

🔍 Code Review — QTDI-3926

Reviewed 3 files (shell scripts only; java-/tck- rules not applicable).

File Severity Finding
release-git-common.sh ℹ️ Info New sourced helper; Apache license header present; errors go to stderr.
release-4-docker-image-creation.sh ℹ️ Info Sourcing via BASH_SOURCE works with bash <relative path> as used by ci/Jenkinsfile-release.
release-git-push-test.sh ℹ️ Info Manual test, not wired into CI (approved). shellcheck not available locally; bash -n clean.

Severity counts: Critical fixed: 0, Warnings: 0, Info: 3.
Scope: release-5/release-6 intentionally unchanged (single-ref pushes). Pre-existing note: the push lives in the Docker stage, which is skipped under NO_DOCKER.

Signed: Claude Sonnet 5.5

Push the branch and the tag in one atomic operation instead of
relying on --follow-tags, and abort before any push when the remote
branch cannot be fetched or moved during the release. DRY_RUN keeps
pushing the branch only, with --dry-run.

Add an offline bare-repository simulation of the release push.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@lxia-talend
lxia-talend force-pushed the lxia-talend/QTDI-3926_atomic_release_push branch from 9c38471 to 2eb3b40 Compare November 27, 2026 06:51
@lxia-talend lxia-talend changed the title fix(QTDI-3926): Make release push atomic and fail-closed chore(QTDI-3926): Make release push atomic and fail-closed Nov 27, 2026
@lxia-talend
lxia-talend requested a lite review from Copilot November 27, 2026 07:03

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.

🟡 Changes recommended

A critical race remains because the fetched branch tip is not protected by a force-with-lease during the push, and the added scenario is not covered by the default build.

2 open issues
What changed in this PR

This PR hardens the Docker-stage release push by atomically publishing the release branch and tag, while validating the remote branch before pushing and adding an offline simulation of release scenarios.

Changes:

  • Adds shared fail-closed remote-branch validation.
  • Replaces the Docker-stage --follow-tags push with an atomic branch/tag push while preserving dry-run behavior.
  • Adds manual coverage for successful, refused, moved-branch, dry-run, and fetch-failure scenarios.
  • The simulation is not integrated into the default build.
File Description
.jenkins/​scripts/​release/​release-git-push-test.sh Adds a manual offline bare-repository simulation covering successful and failed release-push scenarios.
.jenkins/​scripts/​release/​release-git-common.sh Adds shared remote-branch fetch and validation logic for release pushes.
.jenkins/​scripts/​release/​release-4-docker-image-creation.sh Uses the shared validation helper and performs atomic branch/tag publication while preserving branch-only dry-run behavior.

Review effort: Lite

lxia-talend and others added 3 commits November 29, 2026 09:53
The 'Docker image creation' message printed the release version as the
branch and the branch as the version.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ase push

The fail-closed check and the push are separate steps: the remote branch
could be deleted or rewound in between and the push would still publish the
tag. Push with --force-with-lease on the commit that was just fetched, and
add simulations of an advance, a rewind and a deletion of the branch between
the check and the push.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@sonar-rnd

sonar-rnd Bot commented Nov 30, 2026

Copy link
Copy Markdown

@lxia-talend
lxia-talend merged commit 1b46e91 into master Nov 30, 2026
7 checks passed
@lxia-talend
lxia-talend deleted the lxia-talend/QTDI-3926_atomic_release_push branch November 30, 2026 10:16
lxia-talend added a commit that referenced this pull request Dec 1, 2026
…1351) (#1356)

Backport of #1351 to maintenance/1.2610.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
lxia-talend added a commit that referenced this pull request Dec 1, 2026
…1351) (#1357)

Backport of #1351 to maintenance/1.2611.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
lxia-talend added a commit that referenced this pull request Dec 1, 2026
…1351) (#1358)

Backport of #1351 to maintenance/1.2612.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
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.

4 participants