atlantis icon indicating copy to clipboard operation
atlantis copied to clipboard

Bitbucket Cloud | Plan Failed: Pull request must be mergeable before running plan.

Open pavankumar-go opened this issue 1 year ago • 6 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Overview of the Issue

Doc says for mergeable https://www.runatlantis.io/docs/command-requirements.html#mergeable

we just check if there is a conflict that is preventing a merge

But atlantis plan fails for bitbucket.org (Cloud) when there is no conflict upon creating Pull Request

Screenshot 2023-06-05 at 4 04 22 PM

Above screen shot where there is no mentioning of conflict and its fully in-sync with main branch

Reproduction Steps

  1. fork a new branch from up-to-date remote main branch
  2. make changes on the forked branch
  3. create a pull request to remote main branch Atlantis comments on PR saying Plan Error: Pull request is not mergeable

Logs

{"level":"info","ts":"2023-06-05T10:20:37.910Z","caller":"events/events_controller.go:366","msg":"identified event as type \"opened\"","json":{}}
{"level":"info","ts":"2023-06-05T10:20:38.858Z","caller":"events/working_dir.go:223","msg":"creating dir \"/atlantis-data/repos//aws-infra-data/19/default\"","json":{"repo":"/aws-infra-data","pull":"19"}}
{"level":"info","ts":"2023-06-05T10:20:41.648Z","caller":"events/project_command_builder.go:351","msg":"successfully parsed atlantis.yaml file","json":{"repo":"/aws-infra-data","pull":"19"}}
{"level":"info","ts":"2023-06-05T10:20:41.648Z","caller":"events/project_command_builder.go:390","msg":"No projects are defined in atlantis.yaml. Will resume automatic detection","json":{"repo":"/aws-infra-data","pull":"19"}}
{"level":"info","ts":"2023-06-05T10:20:41.648Z","caller":"events/project_finder.go:147","msg":"filtered modified files to 1 .tf or terragrunt.hcl files: [non-prod-data/dev/s3/buckets.tf]","json":{"repo":"/aws-infra-data","pull":"19"}}
{"level":"info","ts":"2023-06-05T10:20:41.648Z","caller":"events/project_finder.go:172","msg":"there are 1 modified project(s) at path(s): non-prod-data/dev/s3","json":{"repo":"/aws-infra-data","pull":"19"}}
{"level":"info","ts":"2023-06-05T10:20:41.648Z","caller":"events/project_command_builder.go:396","msg":"automatically determined that there were 1 projects modified in this pull request: [repofullname=/aws-infra-data path=non-prod-data/dev/s3]","json":{"repo":"/aws-infra-data","pull":"19"}}
{"level":"info","ts":"2023-06-05T10:20:41.648Z","caller":"events/project_finder.go:79","msg":"looking for Terraform Cloud workspace from configuration in \"/atlantis-data/repos/aws-infra-data/19/default\"","json":{"repo":"/aws-infra-data","pull":"19"}}
{"level":"info","ts":"2023-06-05T10:20:41.692Z","caller":"terraform/terraform_client.go:361","msg":"Detected module requires version: 1.2.2","json":{"repo":"/aws-infra-data","pull":"19"}}
{"level":"info","ts":"2023-06-05T10:20:42.099Z","caller":"events/plan_command_runner.go:132","msg":"Running plans in parallel","json":{"repo":"/aws-infra-data","pull":"19"}}
{"level":"info","ts":"2023-06-05T10:20:42.543Z","caller":"events/project_locker.go:86","msg":"acquired lock with id \"/aws-infra-data/non-prod-data/dev/s3/default\"","json":{"repo":"/aws-infra-data","pull":"19"}}
{"level":"error","ts":"2023-06-05T10:20:42.953Z","caller":"events/instrumented_project_command_runner.go:83","msg":"Failure running plan operation: Pull request must be mergeable before running plan.","json":{"repo":"/aws-infra-data","pull":"19"},"stacktrace":"github.com/runatlantis/atlantis/server/events.RunAndEmitStats\n\tgithub.com/runatlantis/atlantis/server/events/instrumented_project_command_runner.go:83\ngithub.com/runatlantis/atlantis/server/events.(*InstrumentedProjectCommandRunner).Plan\n\tgithub.com/runatlantis/atlantis/server/events/instrumented_project_command_runner.go:38\ngithub.com/runatlantis/atlantis/server/events.runProjectCmdsParallel.func1\n\tgithub.com/runatlantis/atlantis/server/events/project_command_pool_executor.go:29"}

Environment details

  • Atlantis version: atlantis:v0.23.5
  • Deployment method: helm
  • If not running the latest Atlantis version have you tried to reproduce this issue on the latest version:
  • Atlantis flags: server

Atlantis server-side config file:

apiVersion: v1
data:
  repos.yaml: |
    repos:
    - id: bitbucket.org/XYZ/aws-infra-data
      plan_requirements: [mergeable]
      ...
      ...

But manually adding atlantis plan right after the error message, it proceeds to plan

Screenshot 2023-06-05 at 4 18 52 PM

pavankumar-go avatar Jun 05 '23 10:06 pavankumar-go

Is this a recent bug? Have you tried an older version to see if this may be a regression?

nitrocode avatar Jun 05 '23 13:06 nitrocode

this was my initial deployment, haven't tried any older version yet.

pavankumar-go avatar Jun 05 '23 16:06 pavankumar-go

I faced the same issue with Bitbucket server. Temporarily disable plan requirement.

duclm2609 avatar Nov 23 '23 12:11 duclm2609

Same issue here with 'github' and atlantis v0.26.0.

velvetzhero avatar Dec 06 '23 10:12 velvetzhero

Good Evening. I just ran into the same issue with BitBucket Cloud using Atlantis v0.27.1.

On a New PR Created webhook (no merge conflicts in PR), Atlantis returns the following:

image

When I subsequently typed atlantis plan in a comment in the same PR, atlantis ran the plan successfully.

brettpalmberg avatar Jan 25 '24 00:01 brettpalmberg

@brettpalmberg are you able to use apply_requirement: [mergeable] with bitbucket cloud? I've been struggling with this for some time and could not find any help either here or in the Atlantis community yet. For me it just ignores the mergeable state of the PR and run the apply even without any kind of approval. If you could maybe shed any light on this or share your config files, I would really appreciate it.

oliver-vini avatar Feb 09 '24 19:02 oliver-vini

@oliver-vini - I had a similar experience, did not get this working. I removed the [mergable] requirement in the configuration file in the interim until the bug is resolved.

brettpalmberg avatar Mar 16 '24 01:03 brettpalmberg