Skip to content

fix(setup): protect a new GitLab hub's default branch while GitLab still protects it - #28

Merged
AlexeyShalaev merged 1 commit into
masterfrom
fix/setup-protect-race
Oct 9, 2026
Merged

AlexeyShalaev merged 1 commit into
masterfrom
fix/setup-protect-race

Conversation

@AlexeyShalaev

Copy link
Copy Markdown
Member

GitLab protects a new project's default branch from a background job. setup's read of the protection could answer 404, and its POST then met the protection (409 "Protected branch already exists"), failing the default-branch step. This happened on the GitLab template stand of v0.5.0.

On a 409 setup now reads the protection again and goes on as for a branch it found protected: it leaves it when it already keeps pushes to No one and merges to Maintainers, and changes it otherwise.

TestGitLabLateProtection plays the race in the fake: the first read misses the protection.

…ill protects it

GitLab protects a new project's default branch from a background job, so setup's read of the protection may answer 404 and its POST then meets the protection (409 Protected branch already exists): setup failed the default-branch step. On a 409 it now reads the protection again and goes on as for a branch it found protected. Seen on the GitLab template stand of v0.5.0.
@AlexeyShalaev
AlexeyShalaev merged commit e5739ac into master Oct 9, 2026
22 checks passed
@AlexeyShalaev
AlexeyShalaev deleted the fix/setup-protect-race branch October 9, 2026 17:05
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.

1 participant