Skip to content
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

Approval gitlab not working #1879

Closed
songhanpoo opened this issue Nov 3, 2021 · 10 comments
Closed

Approval gitlab not working #1879

songhanpoo opened this issue Nov 3, 2021 · 10 comments
Labels
bug Something isn't working provider/gitlab waiting-on-response Waiting for a response from the user

Comments

@songhanpoo
Copy link

songhanpoo commented Nov 3, 2021

Hi Team,

i have configured working with scenario approval gitlab but not working

atlantis.yaml

version: 3
projects:
- name: project-1
  dir: ./project
  workspace: default
  apply_requirements: [approved, mergeable]
  autoplan:
    # when_modified: ["*.tf","*.tfvars", "../modules/**.tf"]
    enabled: true
  terraform_version: v0.15.3
  workflow: custom
workflows:
  custom:
    plan:
      steps:
      - init
      - plan:
          extra_args: ["-var-file", "terraform.tfvars"]
    apply:
      steps:
      - apply

repo.yaml

repos:

- id: /.*/

  branch: /.*/

  apply_requirements: [approved, mergeable]

  allowed_overrides: [apply_requirements,workflow]

  allow_custom_workflows: true

cli start atlantis server

atlantis server \
   --atlantis-url="https://0f63-171-233-xxxx.ngrok.io" \
   --gitlab-user="atlantis-bot" \
   --gitlab-token="Xxxx" \
   --gitlab-webhook-secret="bd8e13a8ac47eexxxxxxxxx" \
   --repo-allowlist="*" \
   --data-dir="/home/atlantis" \
   --repo-config="/home/atlantis/repo.yaml" \
   --log-level="debug"

let me know if i mistaken anything.

Live running, when input atlantis apply is successful that's not work like scenario approval.
Screen Shot 2021-11-03 at 16 52 24
.

@songhanpoo songhanpoo added the bug Something isn't working label Nov 3, 2021
@thiagofanfoni
Copy link

thiagofanfoni commented Nov 3, 2021

I'm having the same issue with an on-premises GitLab CE, but IDK if this functionality only works with Gitlab EE since approvals are only optional in GitLab CE.

@songhanpoo
Copy link
Author

songhanpoo commented Nov 3, 2021

I'm having the same issue with an on-premises GitLab CE, but IDK if this functionality only works with Gitlab EE since approvals are only optional in GitLab CE.

I'm using gitlab.com. This feature not work. Do you have try with bitbucket ?

@thiagofanfoni
Copy link

I'm having the same issue with an on-premises GitLab CE, but IDK if this functionality only works with Gitlab EE since approvals are only optional in GitLab CE.

I'm using gitlab.com. This feature not work. Do you have try with bitbucket ?

No, I only have onprem GitLab CE to test with this ( even if it works with BitBucket I would not be able to use it =/ )
I strongly suspect that it does not work with GitLab CE, but I don't have a way to test this at this moment.

@songhanpoo
Copy link
Author

I'm having the same issue with an on-premises GitLab CE, but IDK if this functionality only works with Gitlab EE since approvals are only optional in GitLab CE.

I'm using gitlab.com. This feature not work. Do you have try with bitbucket ?

No, I only have onprem GitLab CE to test with this ( even if it works with BitBucket I would not be able to use it =/ )

I strongly suspect that it does not work with GitLab CE, but I don't have a way to test this at this moment.

Before i have test with Gitlab CE but with simple scenario. Now i have try with gitlab then conftest policy is work.

@m00lecule
Copy link

I am facing the same issue with gitlab on-premise

@kasimon
Copy link

kasimon commented Feb 22, 2022

I looked at the code briefly, as we are facing the same problem with GitLab CE. It looks like atlantis (

approvals, _, err := g.Client.MergeRequests.GetMergeRequestApprovals(repo.FullName, pull.Num)
) uses the gitlab client library function (https://github.com/xanzy/go-gitlab/blob/v0.55.1/merge_requests.go#L360) to check for approval, which uses the approval api (https://docs.gitlab.com/ee/api/merge_request_approvals.html#merge-request-level-mr-approvals), which I would assume for non-premium installs always returns "true".

@jghal
Copy link

jghal commented Apr 21, 2022

This is probably the same as #1174, which lists an open issue on GitLab.com for their API returning incorrect mergeable status.

@jamengual
Copy link
Contributor

is this still happening with v0.19.8?

@jamengual jamengual added the waiting-on-response Waiting for a response from the user label Aug 26, 2022
@jghal
Copy link

jghal commented Aug 26, 2022

I think between GitLab releasing 15.x and updates to xanzy-gitlab library this has been resolved.

@eballetbaz
Copy link

Hello everyone,
this is still not working with Gitlab free edition.
Since validation is an optional feature, the Gitlab API always returns ApprovalsLeft = 0
So the current code is never reached

	if approvals.ApprovalsLeft > 0 {
		return approvalStatus, nil
	}

Related feature request: #3501

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working provider/gitlab waiting-on-response Waiting for a response from the user
Projects
None yet
Development

No branches or pull requests

8 participants