-
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
apply_requirements not being evaluated #2605
Comments
Could this limitation be caused by the version of GitLab we are running? It appears that required approvals are only available on GitLab Premium and GitLab Ultimate, while we are running Community Edition. |
Our company has Gitlab Enterprise and we've noticed a similar issue as well @theautoroboto. Atlantis applies even though there's things that need to be rebased. The (mergeable) apply_requirement is being ignored. We didn't have this issue until recently. It's important to note that we recently updated to a 15.x Gitlab version. |
Hello, |
Has this always been an issue with atlantis? Do older versions work as expected? If not, then this may not be a regression and may be related to the gitlab enterprise api change. Either way, we welcome contributions. If you folks can spot the issue, please feel free to build locally, test it out, and propose a PR. |
Hello 👋🏻 I got the same issue on Gitlab SaaS. It's important to notice that I successfully set up an approval protection with the deprecated flag My env : My config : atlantis-url: 'https://atlantis.xxxxxx.io/'
gitlab-token: 'xxxxxxxx'
gitlab-user: 'atlantis'
gitlab-webhook-secret: 'xxxxxxxx'
log-level: 'info'
repo-allowlist: 'gitlab.com/xxxx/yyyy/*,gitlab.com/xxxxx/zzzzz/aaaaa/*'
repo-config-json: '{"repos":[{"apply_requirements":["approved"],"id":"/.*/","repo_locking":true}]}'
web-basic-auth: 'true'
web-password: 'xxxxxxxxxxxx'
web-username: 'skello'
write-git-creds: 'true' service side config repos:
- id: /.*/
repo_locking: true
apply_requirements: [approved] |
I tried the deprecated @jukie , I believe you mentioned that you'd volunteer as a Gitlab maintainer, this issue is basically a complete blocker to us adopting Atlantis, do you have some idea on what could be causing this? I'm not familiar with Go or Atlantis' code base at all, but if I get a few pointers I'm willing to dig into what's causing this issue. |
@lukemassa do you have any ideas on this? I do not know if you have touched that part of the code |
(Note I deleted my earlier comment because it was slightly wrong and confusing) I did some testing and I learned this has to do with Merge Request Approval Rules (https://docs.gitlab.com/ee/user/project/merge_requests/approvals/rules.html). I'm running atlantis 0.24.4 and gitlab enterprise 16.4.1.
So my current understanding is that you need to have both By my read, this behavior is contrary to the documentation https://www.runatlantis.io/docs/command-requirements.html#approved. However I'm not sure the best thing to do here. I think the options are:
My personal vote is 1 (in fact I've already unknowingly pushed us in that direction: #3744). But I'd like to understand what other VCSs do. Thoughts @jamengual? In the meantime, @Angelin01 (or others) can you try setting up a Merge Request Approval Rule (https://docs.gitlab.com/ee/user/project/merge_requests/approvals/rules.html) on your project to see if that blocks unapproved applies? I would expect if both these are set to get an comment back from atlantis that says something like "Apply Failed: Pull request must be approved by at least one person other than the author before running apply." |
I agree with @lukemassa here, if you have apply_requirements is becaude you want to have approval rules, therefore, Atlantis should not try to interpret the desired outcome. I vote for number 1. |
@jamengual I've thought about it some more, and I actually think the right solution here is to have This would consist in:
Looking at Bitbucket and Azure, both attempt to do what github does, which is say a thing is "approved" if someone other than the author has "approved" it, and false otherwise, so I figured it's better to change gitlab to be me more in line with the others, than change the notion of "approved" across the board? |
Ahhh that is an interesting point and from the user's point of view it does make sense to think that I'm all for consistency so I agree with this change, it does make sense. @GenPage any opinion on this? |
I implemented the above in #3830 if you want to take a look. It turns out no change was needed for part 3) since |
Community Note
Overview of the Issue
Using GitLab Community Edition [15.2.3] with Atlantis deployed on kubernetes using a statefulset, the apply_requirements settings defined in the environment variable
ATLANTIS_REPO_CONFIG_JSON
are not being evaluated.Reproduction Steps
Deploy to kubernetes as a statefulset and define the environment variable. PRs are never checked for approval before allowing an apply comment to be posted and the atlantis apply process to be completed
I have verified that the environment variable is present on the running pod
Logs
If not already included, please provide the following:
The text was updated successfully, but these errors were encountered: