-
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 Failed: Pull request must be mergeable before running apply #2310
Comments
Issue persists with 0.19.5-pre |
@gtirloni Could you past the debug logs with 0.19.5-pre? |
I've tried with the [
{
"level": "debug",
"ts": "2022-06-30T16:09:33.189Z",
"caller": "vcs/github_client.go:307",
"msg": "PR mergeable state is blocked",
"json": {}
},
{
"level": "debug",
"ts": "2022-06-30T16:09:33.189Z",
"caller": "vcs/github_client.go:322",
"msg": "GET /repos/orgname/reponame/commits/%!d(string=just-a-branch-name)/status",
"json": {}
},
{
"level": "debug",
"ts": "2022-06-30T16:09:33.433Z",
"caller": "vcs/github_client.go:335",
"msg": "GET /repos/orgname/reponame/branches/%!d(string=master)/protection/required_status_checks",
"json": {}
},
{
"level": "error",
"ts": "2022-06-30T16:09:33.600Z",
"caller": "vcs/instrumented_client.go:183",
"msg": "Unable to check pull mergeable status, error: fetching PR required checks: GET https://api.github.com/repos/orgname/reponame/branches/master/protection/required_status_checks: 403 Resource not accessible by integration []",
"json": {
"repository": "orgname/reponame",
"pull-num": "16"
},
"stacktrace": "github.com/runatlantis/atlantis/server/events/vcs.(*InstrumentedClient).PullIsMergeable\n\tgithub.com/runatlantis/atlantis/server/events/vcs/instrumented_client.go:183\ngithub.com/runatlantis/atlantis/server/events/vcs.(*ClientProxy).PullIsMergeable\n\tgithub.com/runatlantis/atlantis/server/events/vcs/proxy.go:72\ngithub.com/runatlantis/atlantis/server/events/vcs.(*pullReqStatusFetcher).FetchPullStatus\n\tgithub.com/runatlantis/atlantis/server/events/vcs/pull_status_fetcher.go:28\ngithub.com/runatlantis/atlantis/server/events.(*ApplyCommandRunner).Run\n\tgithub.com/runatlantis/atlantis/server/events/apply_command_runner.go:109\ngithub.com/runatlantis/atlantis/server/events.(*DefaultCommandRunner).RunCommentCommand\n\tgithub.com/runatlantis/atlantis/server/events/command_runner.go:277"
},
{
"level": "warn",
"ts": "2022-06-30T16:09:33.600Z",
"caller": "events/apply_command_runner.go:115",
"msg": "unable to get pull request status: fetching mergeability status for repo: orgname/reponame, and pull number: 16: fetching PR required checks: GET https://api.github.com/repos/orgname/reponame/branches/master/protection/required_status_checks: 403 Resource not accessible by integration []. Continuing with mergeable and approved assumed false",
"json": {
"repo": "orgname/reponame",
"pull": "16"
},
"stacktrace": "github.com/runatlantis/atlantis/server/events.(*ApplyCommandRunner).Run\n\tgithub.com/runatlantis/atlantis/server/events/apply_command_runner.go:115\ngithub.com/runatlantis/atlantis/server/events.(*DefaultCommandRunner).RunCommentCommand\n\tgithub.com/runatlantis/atlantis/server/events/command_runner.go:277"
},
{
"level": "debug",
"ts": "2022-06-30T16:09:33.602Z",
"caller": "events/project_command_builder.go:587",
"msg": "Merging config for project at dir: \"infrastructure\" workspace: \"default\"",
"json": {
"repo": "reponame",
"pull": "16"
}
}
] I'd assume the problem is authorisation from github: |
TLDR;I've reviewed atlantis app permissions configuration in our organisation and I can see we might not have permission to check docs.github.com#get-branch-protection. Long versionIt seems like this permission falls under
(docs.github.com/permissions-required-for-github-apps#permission-on-checks). |
I can confirm our problem was related to the described missing permission. Created #2380 which hopefully does add the required permission for newly setup atlantis integrations as github application. |
hello @daconstenla, how are you? What I mean is, it would be amazing to have a |
Hello @dgteixeira, I'm not sure I follow the question. Do you mean having an extra requirement option named With the current implementation, atlantis already does check if the |
Hey @daconstenla, thanks for the reply! We are currently using atlantis with only the As we also use I'm sorry if this is a bit confusing, but this is how we are currently setting up our repositories with Atlantis :) |
Hi again @dgteixeira, if you ask me, I would suggest to ensure branch un-mergeability from github's configuration and not by atlantis. Keep in mind that:
After saying that, I'm not a maintainer, just a contributor and my opinion is mine. |
please open a new issue for the specific case @dgteixeira |
Overview
atlantis apply
fails with messagePull request must be mergeable before running apply
Reproduction Steps
Logs
Logs
PR status after apply failed:
PR checks after apply failed (everything was green before, without apply checks existing):
Environment details
--write-git-creds --repo-allowlist=github.com/org/repo --repo-config=/repos.yaml --enable-policy-checks=true --hide-prev-plan-comments
Atlantis server-side config file:
Additional Context
The text was updated successfully, but these errors were encountered: