Open
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
I would like to have distinct repo match on branch
match and not only repoID
which it seems allowed by the documentation https://www.runatlantis.io/docs/server-side-repo-config.html#reference.
Reproduction Steps
Configure the server side configuration with the following content
repos:
- id: /.*/
branch: /.*/
plan_requirements: [approved, mergeable]
apply_requirements: [approved, mergeable]
import_requirements: [approved, mergeable]
- id: github.com/owner/repo
branch: /main/
plan_requirements: []
apply_requirements: []
import_requirements: []
And request an apply from main
branch, I used the api enpoint myself
❯ curl --request POST 'https://<atlantis_url>/api/apply' \
--header 'X-Atlantis-Token: <atlantis_token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"Repository": "github.com/owner/repo",
"Ref": "main",
"Type": "Github",
}' 2>/dev/null | jq
{
"Error": null,
"Failure": "",
"ProjectResults": [
{
"Command": 0,
"SubCommand": "",
"RepoRelDir": "github.com/owner/repo",
"Workspace": "default",
"Error": null,
"Failure": "Pull request must be approved according to the project's approval rules before running apply.",
"PlanSuccess": null,
"PolicyCheckResults": null,
"ApplySuccess": "",
"VersionSuccess": "",
"ImportSuccess": null,
"StateRmSuccess": null,
"ProjectName": "ultra-organization",
"SilencePRComments": null
}
],
"PlansDeleted": false
}
As you can see, I'm not able to apply it because the merge doesn't take the branch in account
Logs
{"level":"info","ts":"2025-01-28T12:47:44.125Z","caller":"models/shell_command_runner.go:181","msg":"successfully ran 'sh -c' '/atlantis-data/bin/terraform1.9.2 init -input=false -upgrade -reconfigure' in '/atlantis-data/repos/ultraio/devops/terraform/0/default/gitlab/ultra-organization'","json":{"duration":11.795900726}}
{"level":"info","ts":"2025-01-28T12:47:44.516Z","caller":"terraform/terraform_client.go:383","msg":"Successfully ran '/atlantis-data/bin/terraform1.9.2 workspace show' in '/atlantis-data/repos/ultraio/devops/terraform/0/default/gitlab/ultra-organization'","json":{"duration":0.390805303}}
{"level":"info","ts":"2025-01-28T12:48:06.466Z","caller":"models/shell_command_runner.go:181","msg":"successfully ran 'sh -c' '/atlantis-data/bin/terraform1.9.2 plan -input=false -refresh -out \"/atlantis-data/repos/ultraio/devops/terraform/0/default/gitlab/ultra-organization/ultra-organization-default.tfplan\" -var vault_dev_token=${DEV_VAULT_TOKEN} -var vault_staging_token=${STAGING_VAULT_TOKEN} -var vault_prod_token=${PROD_VAULT_TOKEN}' in '/atlantis-data/repos/ultraio/devops/terraform/0/default/gitlab/ultra-organization'","json":{"duration":21.948748395}}
{"level":"error","ts":"2025-01-28T12:48:08.586Z","caller":"events/instrumented_project_command_runner.go:84","msg":"Failure running apply operation: Pull request must be approved according to the project's approval rules before running apply.","json":{},"stacktrace":"github.com/runatlantis/atlantis/server/events.RunAndEmitStats\n\tgithub.com/runatlantis/atlantis/server/events/instrumented_project_command_runner.go:84\ngithub.com/runatlantis/atlantis/server/events.(*InstrumentedProjectCommandRunner).Apply\n\tgithub.com/runatlantis/atlantis/server/events/instrumented_project_command_runner.go:46\ngithub.com/runatlantis/atlantis/server/controllers.(*APIController).apiApply\n\tgithub.com/runatlantis/atlantis/server/controllers/api_controller.go:185\ngithub.com/runatlantis/atlantis/server/controllers.(*APIController).Apply\n\tgithub.com/runatlantis/atlantis/server/controllers/api_controller.go:130\nnet/http.HandlerFunc.ServeHTTP\n\tnet/http/server.go:2220\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:3210\nnet/http.(*conn).serve\n\tnet/http/server.go:2092"}
{"level":"warn","ts":"2025-01-28T12:48:08.587Z","caller":"controllers/api_controller.go:253","msg":"{\"Error\":null,\"Failure\":\"\",\"ProjectResults\":[{\"Command\":0,\"SubCommand\":\"\",\"RepoRelDir\":\"gitlab/ultra-organization\",\"Workspace\":\"default\",\"Error\":null,\"Failure\":\"Pull request must be approved according to the project's approval rules before running apply.\",\"PlanSuccess\":null,\"PolicyCheckResults\":null,\"ApplySuccess\":\"\",\"VersionSuccess\":\"\",\"ImportSuccess\":null,\"StateRmSuccess\":null,\"ProjectName\":\"ultra-organization\",\"SilencePRComments\":null}],\"PlansDeleted\":false}","json":{},"stacktrace":"github.com/runatlantis/atlantis/server/controllers.(*APIController).respond\n\tgithub.com/runatlantis/atlantis/server/controllers/api_controller.go:253\ngithub.com/runatlantis/atlantis/server/controllers.(*APIController).Apply\n\tgithub.com/runatlantis/atlantis/server/controllers/api_controller.go:144\nnet/http.HandlerFunc.ServeHTTP\n\tnet/http/server.go:2220\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:3210\nnet/http.(*conn).serve\n\tnet/http/server.go:2092"}