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

missing plan file does not trigger error on apply #3487

Closed
pseudomorph opened this issue Jun 5, 2023 · 2 comments · Fixed by #3493
Closed

missing plan file does not trigger error on apply #3487

pseudomorph opened this issue Jun 5, 2023 · 2 comments · Fixed by #3493
Labels
bug Something isn't working

Comments

@pseudomorph
Copy link
Contributor

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

There is a case where a working dir might be re-cloned after a plan, policy checks, and approval. This wipes out the planfile prior to an apply. To the end-user, all checks are passing, but when the apply command is submitted, it never runs. There are no errors or indication that the planfile has gone missing.

In the case of a PR with a single project, the user will see the following:

Ran Apply for 0 projects:

When run on a PR with multiple projects, only the projects which still have planfiles are returned as output, with the project missing its planfile completely omitted.

What's interesting too, is that if the plan is deleted, mergeability requirements seem to fail to block the apply operation.

Reproduction Steps

  • Create PR
  • Delete planfile
  • Run atlantis apply

Logs

Environment details

  • Atlantis version: v0.24.2
  • Deployment method: ecs

Additional Context

@pseudomorph
Copy link
Contributor Author

Just tried with v0.22.3, observing the same behavior.

@pseudomorph
Copy link
Contributor Author

The scenario which leads to this situation should be fixed by the linked issue.

However, the reason there is no error thrown when a planfile goes missing, is that the project context is constructed by finding extant planfiles, and only connects to project status at a later point in time in the logic.

https://github.com/runatlantis/atlantis/blob/main/server/events/apply_command_runner.go#L115
https://github.com/runatlantis/atlantis/blob/main/server/events/project_command_builder.go#L618
https://github.com/runatlantis/atlantis/blob/main/server/events/pending_plan_finder.go#L39
https://github.com/runatlantis/atlantis/blob/main/server/events/pending_plan_finder.go#L44

Shouldn't status be checked before looking for the planfile? And, if a project has a planned status, but the find command finds no planfile, shouldn't an error be thrown as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant