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

Only delete the plan that failed when automerge is enabled #3002

Open
lattwood opened this issue Jan 18, 2023 · 6 comments
Open

Only delete the plan that failed when automerge is enabled #3002

lattwood opened this issue Jan 18, 2023 · 6 comments
Labels
bug Something isn't working quick-win Is obviously something Atlantis should do and will take <4 hrs work Stale

Comments

@lattwood
Copy link

lattwood commented Jan 18, 2023

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

Having automerge enabled causes Atlantis to delete all plans in a batch if even a single plan fails.

They shouldn't be deleted, because a user can retry just the failed plans.

Currently, you have to re-plan specifically the ones that succeeded originally, and then retry the failed ones.

Additional Context

if p.autoMerger.automergeEnabled(projectCmds) && result.HasErrors() {
ctx.Log.Info("deleting plans because there were errors and automerge requires all plans succeed")
p.deletePlans(ctx)
result.PlansDeleted = true
}

@lattwood lattwood added the bug Something isn't working label Jan 18, 2023
@nitrocode nitrocode changed the title Atlantis shouldn't delete/should save plans when one or more projects fail to plan and automerge is enabled If automerge is enabled, app should only delete the failed plans instead of ALL plans Jan 18, 2023
@nitrocode nitrocode added the quick-win Is obviously something Atlantis should do and will take <4 hrs work label Jan 30, 2023
@nitrocode nitrocode changed the title If automerge is enabled, app should only delete the failed plans instead of ALL plans Only delete the plan that failed Jan 30, 2023
@nitrocode nitrocode changed the title Only delete the plan that failed Only delete the plan that failed when automerge is enabled Jan 30, 2023
@nitrocode
Copy link
Member

@lattwood what i don't fully understand is why does automerge require all plans to succeed? If a single plan fails, it will show one of the plans as failed and if a subsequent apply is performed, it ahould fail to apply because of the plans had failed...

@lattwood please try to change the logic in your fork and try your new version. See if it doesn't return any mixed results. The new fork works fairly well. If you fork and then add updates to main, an action will run to upload your own dev tag image to your ghcr container repository.

@Dawnflash
Copy link
Contributor

Dawnflash commented Mar 8, 2023

I see it referenced here.

This was requested by users
because when automerge is enabled, they want to enforce that a pull
request's changes have been fully applied. They asked that plans not be
allowed to be applied "piecemeal" and instead, all plans must be
generated successfully prior to allowing any plans to be applied.

Personally I'd say this is not a great solution. I agree that having 1/30 plans or so fail due to network gnomes and having to do it all over again isn't very pleasing.
I think Atlantis already tracks failed plans in its state (even if just for VCS status purposes) so the automerge logic could either

  • pass on successful atlantis apply
  • (if passing on atlantis apply -p/-d is also desired) use something similar that the VCS status summaries do to track failed plans and forbid automerge if their count is nonzero

@WJay-tec
Copy link

I am facing the exact same issue that @lattwood is having, wondering if its intended by design? @nitrocode

@rushi47
Copy link

rushi47 commented Feb 14, 2024

@WJay-tec

I am facing the exact same issue that @lattwood is having, wondering if its intended by design? @nitrocode

Same issue. Is it possible to maybe not discard the plan for individual projects ?

@mjagielka
Copy link

Looks like we have exactly the same problem ;-/ Especially when you have 3 modules in one PR with dependencies for example : you have to create GCP storage to be able to add permissions to GCP storage .. always 1x plan will failed in PR as storage have to be created before permissions which is obvious

@shkamensky
Copy link

Thanks @lattwood for pointing me in the right direction. I created a PR for this.

#4709

@dosubot dosubot bot added the Stale label Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working quick-win Is obviously something Atlantis should do and will take <4 hrs work Stale
Projects
None yet
Development

No branches or pull requests

7 participants