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

Delete previous plans on autoplan or atlantis plan #14

Merged
merged 1 commit into from
Jun 15, 2021

Conversation

giuli007
Copy link
Collaborator

@giuli007 giuli007 commented Jun 9, 2021

When using non-default workspaces, plans are stored in pr-and-workspace-specific directories.
If a PR is subsequently updated it might happen that some of the plans are no longer relevant with regards
to the latest changes.
This change ensures that plans are always deleted when a generic plan is triggered either by autoplan
or by a atlantis plan command.
NB Plans are not cleaned up when specific projects are planned explicitly with "atlantis plan -p/-d/-w".

The reason for this is better explained in runatlantis#1624 and PEAUTO-1803

This solves the issue and should allow us to re-enable parallel planning

I've tested this locally but will do more testing once this is built as a package

@giuli007 giuli007 force-pushed the delete_potentially_stale_previous_plans branch from b075f74 to 7684d42 Compare June 9, 2021 15:49
@giuli007
Copy link
Collaborator Author

giuli007 commented Jun 9, 2021

Updated to actually not be tiggered when atlantis plan -p/-w/-d is used, and fixed a test

@giuli007 giuli007 force-pushed the delete_potentially_stale_previous_plans branch 2 times, most recently from c6cef50 to 250eae4 Compare June 9, 2021 16:11
When using non-default workspaces, plans are stored
in pr-and-workspace-specific directories.
If a PR is subsequently updated it might happen that
some of the plans are no longer relevant with regards
to the latest changes.
This change ensures that plans are always deleted
when a generic plan is triggered either by autoplan
or by a "atlantis plan" command.
NB Plans are not cleaned up when specific projects are
planned explicitly with "atlantis plan -p/-d/-w".
@giuli007 giuli007 force-pushed the delete_potentially_stale_previous_plans branch from 250eae4 to a8a94f9 Compare June 14, 2021 16:27
@giuli007
Copy link
Collaborator Author

One more update adding some more unit tests.

@giuli007
Copy link
Collaborator Author

giuli007 commented Jun 14, 2021

I also tried to create a more comprehensive e2e test for this fix as I thought I could reuse some of the code from https://github.com/Yelp/atlantis/blob/master/server/events_controller_e2e_test.go but it turns out those tests are setup to completely mock out how the repositories/workspaces are checked out by atlantis and therefore it is not easy to reproduce the issue that this PR is fixing using the existing test harnesses/mock/stubs.

@giuli007 giuli007 merged commit a387260 into master Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants