EPMDEDP-17252: fix: Make create-strategy provisioning idempotent and refuse destructive pushes - #308
Merged
Conversation
…refuse destructive pushes Business impact: protects the two moments users trust the platform most — first provisioning of a new codebase and its recovery after a transient failure. Testbed reproduction showed the defect is silent data loss, worse than the permanent wedge originally filed: a reconcile re-entering project provisioning regenerates squashed history and the push replaces the remote default branch, because go-git cannot verify fast-forward when the remote's current commit is absent from the fresh unrelated history, and admin credentials bypass server-side branch protection. Any commits made to the repository before such a retry were destroyed without a trace or an error. The durable record of a push is the remote branch itself, not operator state. Provisioning now: - probes the remote default branch (packless reference resolution; an empty or missing repository counts as absent) before pushing, and records a push-in-progress checkpoint in the git status only when the branch was verified absent - so the checkpoint plus a present branch can later mean only one thing: our own push landed - on re-entry with that checkpoint, adopts the landed push instead of regenerating history: skips provisioning entirely and re-runs only the idempotent default-branch setup, converging where it previously wedged or destroyed history - refuses to push when the remote default branch exists without the checkpoint, failing with an explicit message instead of overwriting content this provisioning provably did not create - clears a stale .git before init in empty-project provisioning, matching the squash path, so a surviving workdir cannot fail retries Probe transport failures propagate rather than guessing absent: guessing would regenerate history against a remote that may hold the previous push. The checkpoint survives all status rewrites, which preserve the git field. Signed-off-by: Sergiy Kulanov <[email protected]>
Collaborator
Pipeline
|
| Status | Task | Duration |
|---|---|---|
| ✅ | github-set-pending-status | 8s |
| ✅ | fetch-repository | 15s |
| ✅ | init-values | 5s |
| ✅ | get-cache | 2m3s |
| ✅ | commit-validate | 7s |
| ✅ | dockerfile-lint | 9s |
| ✅ | helm-lint | 6s |
| ✅ | helm-docs | 24s |
| ✅ | build | 51s |
| ✅ | sonar | 30s |
| ✅ | save-cache | 8s |
| ✅ | buildkit-build | 31s |
| ✅ | github-report-pipeline-status | 5s |
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.
Business impact: protects the two moments users trust the platform most — first provisioning of a new codebase and its recovery after a transient failure. Testbed reproduction showed the defect is silent data loss, worse than the permanent wedge originally filed: a reconcile re-entering project provisioning regenerates squashed history and the push replaces the remote default branch, because go-git cannot verify fast-forward when the remote's current commit is absent from the fresh unrelated history, and admin credentials bypass server-side branch protection. Any commits made to the repository before such a retry were destroyed without a trace or an error.
The durable record of a push is the remote branch itself, not operator state. Provisioning now:
Probe transport failures propagate rather than guessing absent: guessing would regenerate history against a remote that may hold the previous push. The checkpoint survives all status rewrites, which preserve the git field.