-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
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
It looks like PR #5895 may not work the same way as the old logic when using the API endpoints. When I try running the API endpoint /api/plan against the main branch, the API returns the following error:
{
"error": "post-merge verification failed: HEAD^2 != main"
}
Reproduction Steps
Make a POST request to https://hostname/api/plan with the following body:
{
"Repository": "myorg/myrepo",
"Ref": "main",
"Type": "Github",
"Paths": [{
"Directory": "myterraformconfig"
}]
}
Logs
Logs
{"level":"info","ts":"2025-12-03T15:31:09.818Z","caller":"events/working_dir.go:120","msg":"repo was already cloned but branch is not at correct commit, updating to \"main\"","json":{}}
{"level":"warn","ts":"2025-12-03T15:31:25.985Z","caller":"controllers/api_controller.go:391","msg":"{\"error\":\"post-merge verification failed: HEAD^2 != main\"}","json":{},"stacktrace":"github.com/runatlantis/atlantis/server/controllers.(*APIController).respond\n\tgithub.com/runatlantis/atlantis/server/controllers/api_controller.go:391\ngithub.com/runatlantis/atlantis/server/controllers.(*APIController).apiReportError\n\tgithub.com/runatlantis/atlantis/server/controllers/api_controller.go:87\ngithub.com/runatlantis/atlantis/server/controllers.(*APIController).Plan\n\tgithub.com/runatlantis/atlantis/server/controllers/api_controller.go:101\nnet/http.HandlerFunc.ServeHTTP\n\tnet/http/server.go:2322\ngithub.com/gorilla/mux.(*Router).ServeHTTP\n\tgithub.com/gorilla/[email protected]/mux.go:212\ngithub.com/urfave/negroni/v3.(*Negroni).UseHandler.Wrap.func1\n\tgithub.com/urfave/negroni/[email protected]/negroni.go:59\ngithub.com/urfave/negroni/v3.HandlerFunc.ServeHTTP\n\tgithub.com/urfave/negroni/[email protected]/negroni.go:33\ngithub.com/urfave/negroni/v3.middleware.ServeHTTP\n\tgithub.com/urfave/negroni/[email protected]/negroni.go:51\ngithub.com/runatlantis/atlantis/server.(*RequestLogger).ServeHTTP\n\tgithub.com/runatlantis/atlantis/server/middleware.go:70\ngithub.com/urfave/negroni/v3.middleware.ServeHTTP\n\tgithub.com/urfave/negroni/[email protected]/negroni.go:51\ngithub.com/urfave/negroni/v3.(*Recovery).ServeHTTP\n\tgithub.com/urfave/negroni/[email protected]/recovery.go:210\ngithub.com/urfave/negroni/v3.middleware.ServeHTTP\n\tgithub.com/urfave/negroni/[email protected]/negroni.go:51\ngithub.com/urfave/negroni/v3.(*Negroni).ServeHTTP\n\tgithub.com/urfave/negroni/[email protected]/negroni.go:111\nnet/http.serverHandler.ServeHTTP\n\tnet/http/server.go:3340\nnet/http.(*conn).serve\n\tnet/http/server.go:2109"}
Environment details
- Atlantis version: v0.37.1
- Deployment method: helm
- If not running the latest Atlantis version have you tried to reproduce this issue on the latest version: n/a
- Atlantis flags: see helm chart values below
Atlantis helm chart values:
# config file
github:
hostname: <removed>
enableDiffMarkdownFormat: true
ingress:
enabled: false
environment:
ATLANTIS_CHECKOUT_STRATEGY: merge
ATLANTIS_DEFAULT_TF_VERSION: v1.11.1
ATLANTIS_WEB_BASIC_AUTH: "true"
AWS_ENDPOINT_URL_S3: <removed>
TF_CLI_CONFIG_FILE: /plugins/terraform.tfrc
loadEnvFromSecrets:
- <removed>
initConfig:
enabled: true
sharedDir: /plugins
atlantisUrl: <removed>
orgAllowlist: <removed>
Atlantis server-side config file:
repos:
- id: /.*/
allowed_overrides: [apply_requirements]
workflows:
default:
plan:
steps:
- run: terraform fmt -check=true -diff=true -write=false
- init
- plan
apply:
steps:
- apply
- run: inventory-update.shRepo atlantis.yaml file:
version: 3
projects:
- dir: ./myterraformconfigAdditional Context
The error message is part of the changes in PR #5895.
dosubot
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working