-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preventing merging without running atlantis apply
on Gitlab
#4372
Comments
This is an ancient, foolish decision to adopt this MR, resulting in us living on v0.19.2. |
@shurkus What exactly makes you live on v0.19.2? PR that you referenced added an optional, disabled by default, feature for GitHub only. |
wrong here is this one #2053, corrected |
So this is completely broken for us on latest. The atlantis/apply top level job only ever shows up after we have applied one of the projects in a repo. But it doesn't prevent merging before anything has been applied. To be clear I am not sure it has ever worked on gitlab or if it did I didn't notice when it broke and it's been burning us the last while |
Any updates? Our developers sometimes merge MRs before applying the terraform content because the pipeline succeeds even if there are changes ti be applied. We would love to have back the way to block this behavior! |
Maybe remove the right to merge to all developers ? (only Atlantisbot and Maintainer allowed to merge) |
we have it already limited, nevertheless this is something that should be blocked by a pending status pipeline in case some changes are detected |
Any news? |
Can be fixed by adding to // At this point we are sure Atlantis has work to do, so set commit status to pending
if err := p.commitStatusUpdater.UpdateCombined(ctx.Log, ctx.Pull.BaseRepo, ctx.Pull, models.PendingCommitStatus, command.Plan); err != nil {
ctx.Log.Warn("unable to update plan commit status: %s", err)
}
if err := p.commitStatusUpdater.UpdateCombinedCount(ctx.Log, ctx.Pull.BaseRepo, ctx.Pull, models.PendingCommitStatus, command.Apply, 0, len(projectCmds)); err != nil {
ctx.Log.Warn("unable to update apply commit status: %s", err)
} but looks like it can break Github 😿 |
I think this thread can be considered closed after the last version: |
Yep, tested and work fine |
Actually we are now able to merge again if the MR presents atlantis changes. |
Community Note
Overview of the Issue
Currently, I am able to merge a merge request in Gitlab before
atlantis apply
is ran. I want the ability to prevent merge requests from being able to be merged withoutatlantis apply
completing successfully.There has been previous attempts for example #2053 introduced this behavior but was rolled back because of workflows that are dependent on all CI jobs being completed.
#3378 (unintentionally?) introduced this behavior again, then was reverted in #3747.
#2436 (comment) describes the behavior I expect using Github.
Using 0.27.2, when I open a merge request that creates new resources. (I’m using
resource "terraform_data" "example" {}
)Atlantis autoplans, creating an external stage with the following jobs.
I expect there to be a pending
atlantis/apply
job to prevent the merge request from being merged as my repo require CI to be passing. If I revert https://github.com/runatlantis/atlantis/pull/3747/files#diff-6583ec7260b28e573c74e18e783ee24ba8dce7d0a2e6929c105cc7e74d3d9c6fL318-R319 from #3747, I get the behavior I expect.Then after a successful
atlantis apply
, theatlantis/apply
job andatlantis/apply: <project>
succeed and I can merge the merge request.Are there other Gitlab users who have similar requirements? Am I missing something(e.g a flag?) that makes this possible?
I'm open to other methods of preventing merging without successful
atlantis apply
's. Happy to contribute any patches that support this workflow.Reproduction Steps
Logs
Environment details
Atlantis server-side config file:
Repo
atlantis.yaml
file: N/AAdditional Context
The text was updated successfully, but these errors were encountered: