-
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
v0.22.2+: atlantis/post_workflow_hook
errors after apply
when using --automerge
flag due to deleted directory
#3031
Comments
Could you include your yaml configuration such as your post workflow hook? Looks like this is the main error
|
it looks like you have an additional / in the path on that command
…On Mon, Jan 23, 2023, 6:27 a.m. nitrocode ***@***.***> wrote:
Could you include your yaml configuration such as your post workflow hook?
Looks like this is the main error
Error running post-workflow hooks chdir /atlantis-data/repos///7/default: no such file or directory: running "rm -rf /tmp/$BASE_REPO_OWNER-$BASE_REPO_NAME-$PULL_NUM"
—
Reply to this email directly, view it on GitHub
<#3031 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQ3ERG3EO4DB4IPMWUUHQTWT2IMBANCNFSM6AAAAAAUD2FUUA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
no, I just tried to hide the repo and organisation name and it resulted in that 🤦. I'll update the issue with a different log, using a simple post workflow hook |
@jamengual and @nitrocode I updated the issue with another simpler example (different and simpler post workflow), and the log from the apply time. |
@Yasmine92 can you ssh to the pod and try to access the directory it's complaining about? Can you
|
Well from my understanding, the directory for the PR is cleaned up after the automerge at this step:
so it's normal that the directory is already gone after merge:
|
but the thing is that |
@Fabianoshz for your thoughts here. @Yasmine92 please feel free to test a change locally and propose it. What's odd is that I'm using the latest version, most of the above flags, and not experiencing this. I wonder what condition would make the cleanup happen prior to the post workflow run? |
@nitrocode are you using both |
@Yasmine92 can you check if you can access the PR directory?
Taking from memory I believe the project directory is deleted right after the apply, while the PR directory lives until we receive a |
Thanks @Fabianoshz , the PR directory |
atlantis/post_workflow_hook
errors when using --automerge
flag
atlantis/post_workflow_hook
errors when using --automerge
flagatlantis/post_workflow_hook
errors after apply
when using --automerge
flag
Seeing this race condition also. Thanks the notes, so dir is deleted on receipt of merge event, if this is receveid before post-workflow is run, then the directory from which the post workflow command would be run no longer exists. Is this correct summary? |
correct
…On Thu, Jan 26, 2023, 2:18 a.m. Bob Rohan ***@***.***> wrote:
Seeing this race condition also. Thanks the notes, so dir is deleted on
receipt of merge event, if this is receveid before post-workflow is run,
then the directory from which the post workflow command would be run no
longer exists. Is this correct summary?
—
Reply to this email directly, view it on GitHub
<#3031 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQ3ERDUZ4UQ6G524IGFG2TWUJFNTANCNFSM6AAAAAAUD2FUUA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I'm seeing this too on 0.22.3. I haven't checked previous versions yet. Has anyone gone back to see if this is a recent version that introduced this? Has anyone tested with 0.22.2, 0.22.1, 0.22.0? Id go as far back as 0.21.0 to see if it's a regression and go up from there. this issue may be related to |
@nitrocode I made the jump from |
Ah thank you so this is definitely a regression. If anyone gets a chance, please test in earlier versions to see if we can pinpoint the pr that introduced this breaking change. Cc @Fabianoshz in case you or others can spot the issue without checking individual versions |
atlantis/post_workflow_hook
errors after apply
when using --automerge
flagatlantis/post_workflow_hook
errors after apply
when using --automerge
flag
atlantis/post_workflow_hook
errors after apply
when using --automerge
flagatlantis/post_workflow_hook
errors after apply
when using --automerge
flag due to deleted directory
@Fabianoshz is it possible that the post workflow run never used to run from the pr directory until a recent pr? If so, then we'd just have to run the delete after the post workflow run completes. This deletes the dir
This is the function call that deletes the dir
atlantis/server/events/command_runner.go Lines 172 to 176 in a1f389a
|
I'm not sure if this is what's causing issues for others here, but for some reason a perfectly well functioning pre-workflow-hook started to fail for me yesterday. Turns out the issue was that my 🪄 magical diff script 🪄 left things into an unwanted state and got cleaned up by the logic maybe here? https://github.dev/runatlantis/atlantis/blob/ba7b67a42cf8105fbbbe4a1d003e06cca58fc2a0/server/events/working_dir.go#L97-L98 After I set the pre-workflow-hook to do |
Still an issue in v |
Community Note
Overview of the Issue
When using the flag --automerge, the Postworkflow hooks are executed after the PR is merged (the PR directory is deleted, and the branch is deleted). which results in errors in logs about not being able to read the current directory, or fetching from origin.
Reproduction Steps
--automerge
atlantis apply
Logs
Logs
Environment details
--enable-diff-markdown-format --automerge --checkout-strategy=merge --hide-prev-plan-comments --enable-policy-checks --gh-allow-mergeable-bypass-apply --quiet-policy-checks
post-worklflow hook configuration from the server config:
Repo
atlantis.yaml
file:Additional Context
The text was updated successfully, but these errors were encountered: