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

Branch not deleting Automatically after apply is success and PR is merged. #415

Open
ankitmahajan-appfire opened this issue Aug 26, 2024 · 10 comments
Labels
waiting-on-response Waiting for a response from the user

Comments

@ankitmahajan-appfire
Copy link

Hi team,

I have deployed the atlantis to test tf automation. Below is my config.

Server Side Repo config:
repoConfig: |

repos:

  • id: /.*/
    delete_source_branch_on_merge: true
    apply_requirements: []
    workflow: default
    allowed_overrides: [apply_requirements, delete_source_branch_on_merge]
    allow_custom_workflows: false

Repo Level atlantis.yaml Config
version: 3
autodiscover:
mode: auto
delete_source_branch_on_merge: true
automerge: true
parallel_plan: true
parallel_apply: true
projects:

  • dir: .
    terraform_version: v1.6.6
    autoplan:
    when_modified: [".tf"]
    enabled: true

In both the config, i have given delete_source_branch_on_merge: true to delete the branch after everything is executed. However, same is not happening. Screenshot below.

image

I have also enabled the debug logs, and below are the same for above event.

{"level":"debug","ts":"2024-08-26T13:57:03.777Z","caller":"vcs/github_client.go:180","msg":"Creating comment on GitHub pull request 5","json":{"gh-request-id":"X-Github-Delivery=125b3dc0-9925-d1e5816912c7"}}
{"level":"debug","ts":"2024-08-26T13:57:03.935Z","caller":"server/middleware.go:45","msg":"POST /events – from 10.0.4.38:47060","json":{}}
{"level":"debug","ts":"2024-08-26T13:57:03.935Z","caller":"events/events_controller.go:119","msg":"handling GitHub post","json":{}}
{"level":"debug","ts":"2024-08-26T13:57:03.935Z","caller":"events/events_controller.go:185","msg":"request valid","json":{"gh-request-id":"X-Github-Delivery=12aa3b28-9b85-497723f9c70a"}}
{"level":"debug","ts":"2024-08-26T13:57:03.936Z","caller":"server/middleware.go:72","msg":"POST /events – respond HTTP 200","json":{}}

{"level":"debug","ts":"2024-08-26T13:57:04.250Z","caller":"vcs/github_client.go:198","msg":"POST /repos/atlantis-poc/issues/5/comments returned: 201","json":{"gh-request-id":"X-Github-Delivery=125b3dc0-9925-d1e5816912c7"}}
{"level":"debug","ts":"2024-08-26T13:57:04.250Z","caller":"metrics/debug.go:52","msg":"timer","json":{"name":"atlantis.github.create_comment.execution_time","value":0.472759649,"tags":{"base_repo":"atlantis-poc","pr_number":"5"},"type":"timer"}}
{"level":"debug","ts":"2024-08-26T13:57:04.250Z","caller":"metrics/debug.go:52","msg":"timer","json":{"name":"atlantis.pullclosed_cleanup.execution_time","value":0.47882662,"tags":{},"type":"timer"}}
{"level":"info","ts":"2024-08-26T13:57:04.250Z","caller":"events/events_controller.go:579","msg":"deleted locks and workspace for repo atlantis-poc, pull 5","json":{"gh-request-id":"X-Github-Delivery=125b3dc0-9925-d1e5816912c7"}}
{"level":"debug","ts":"2024-08-26T13:57:04.250Z","caller":"server/middleware.go:72","msg":"POST /events – respond HTTP 200","json":{}}

{"level":"debug","ts":"2024-08-26T13:57:04.487Z","caller":"metrics/debug.go:42","msg":"counter","json":{"name":"atlantis.pullclosed_cleanup.execution_success","value":1,"tags":{},"type":"counter"}}
{"level":"debug","ts":"2024-08-26T13:57:04.487Z","caller":"metrics/debug.go:42","msg":"counter","json":{"name":"atlantis.github_event.pr_closed.success_200","value":1,"tags":{"base_repo":"atlantis-poc","pr_number":"5"},"type":"counter"}}
{"level":"debug","ts":"2024-08-26T13:57:04.487Z","caller":"metrics/debug.go:42","msg":"counter","json":{"name":"atlantis.github_event.success_200","value":1,"tags":{},"type":"counter"}}
{"level":"debug","ts":"2024-08-26T13:57:04.487Z","caller":"metrics/debug.go:42","msg":"counter","json":{"name":"atlantis.github.create_comment.execution_success","value":1,"tags":{"base_repo":"atlantis-poc","pr_number":"5"},"type":"counter"}}

{"level":"debug","ts":"2024-08-26T13:57:05.714Z","caller":"server/middleware.go:45","msg":"POST /events – from 10.0.4.38:47060","json":{}}
{"level":"debug","ts":"2024-08-26T13:57:05.715Z","caller":"events/events_controller.go:119","msg":"handling GitHub post","json":{}}
{"level":"debug","ts":"2024-08-26T13:57:05.718Z","caller":"events/events_controller.go:185","msg":"request valid","json":{"gh-request-id":"X-Github-Delivery=13884c10-9614-b9178d616468"}}
{"level":"debug","ts":"2024-08-26T13:57:05.719Z","caller":"server/middleware.go:72","msg":"POST /events – respond HTTP 200","json":{}}
{"level":"debug","ts":"2024-08-26T13:57:06.487Z","caller":"metrics/debug.go:42","msg":"counter","json":{"name":"atlantis.github_event.comment_created.success_200","value":1,"tags":{"base_repo":"atlantis-poc","pr_number":"5"},"type":"counter"}}

Deployed with helm chart version as

appVersion: v0.28.5
version: 5.4.5

Could you please check and help here in fixing this issue?

@GMartinez-Sisti GMartinez-Sisti added the waiting-on-response Waiting for a response from the user label Aug 26, 2024
@ankitmahajan-appfire
Copy link
Author

Hi,

That we already know. I am specificly asking for this config "delete_source_branch_on_merge: true". If we need to handle that by git config, then what is the use of this in server and repo config?

@GMartinez-Sisti
Copy link
Member

This configuration exists for all VCS type: Github, Azure, Gitlab, etc. Looks like it's just being ignored in your configuration.

Are you using a GitHub user or a GitHub app (docs)?

@ankitmahajan-appfire
Copy link
Author

I am using GitHub user. Created a PAT token for access and provided that in secrets.

@GMartinez-Sisti
Copy link
Member

My best guess is that Atlantis is not getting the webhook for the merge event. Can you confirm the events you have configured (docs)?

@ankitmahajan-appfire
Copy link
Author

In the configured the webhook as per the documentation and select 4 checkboxes as mentioned.

image

Below are the webhooks that are getting triggerred
image

I don't see any event for merge

@GMartinez-Sisti
Copy link
Member

The most strange part is that Atlantis log doesn't show any event or failure for that event. We might have a bug or something is missing.

@jamengual can you move this issue into https://github.com/runatlantis/atlantis pls?

@ankitmahajan-appfire
Copy link
Author

Thanks @GMartinez-Sisti for considering. @jamengual pls take this up and release the fix

@GMartinez-Sisti
Copy link
Member

pls take this up and release the fix

@ankitmahajan-appfire not quite like this 😅 first we need to see if it's actually a bug or if someone is able to use it correctly. Then since this an open source project someone will need to volunteer to pick it up. But at least it's a start 😃

@ankitmahajan-appfire
Copy link
Author

Sure @GMartinez-Sisti . Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-on-response Waiting for a response from the user
Projects
None yet
Development

No branches or pull requests

3 participants
@GMartinez-Sisti @ankitmahajan-appfire and others