atlantis icon indicating copy to clipboard operation
atlantis copied to clipboard

Ability to "Discard Plan & unlock" on all plans for a PR, in the Atlantis GUI

Open zraider7 opened this issue 2 years ago • 4 comments

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.

Describe the user story

There are situations that come up where during an Atlantis operation a user will close the PR, delete the branch and the branch sometimes will be unrecoverable (can't restore) and Atlantis doesn't discard the plans/locks. This means that we have to go through the UI and discard/unlock all of the plans one by one, by hand.

Describe the solution you'd like

It would be fantastic if we could unlock & discard plans for all plans relating to a PR from a particular repo, with just a few clicks. One solution could be that you add another button on each plan that says Discard all Plans & locks for this PR. So similar treatment as running atlantis unlock on a particular PR.

Describe the drawbacks of your solution

A user could accidentally unlock all the locks on a PR instead of just one, unintentionally. The design is simple, but not that elegant (having a particular plan having a function that affects all other plans in a PR).

Describe alternatives you've considered The only way to unlock plans in atlantis is via the gui (one by one) or unlock them all on the PR, but if the branch is deleted, this isn't an option. Other solutions will get hacky if we try to also start managing plans/locks outside of atlantis.

zraider7 avatar Feb 23 '23 01:02 zraider7

why not unlock the jobs? basically, each job is tight to a PR so it could discard the lock and plan for that particular PR instead of all the PR?

jamengual avatar Feb 23 '23 05:02 jamengual

That's what we have to do today. But for some PRs, there are 300+ jobs being working on. So if the issue happens where the PR gets closed, the branch gets deleted and is unrecoverable we have to go into the Atlantis Gui and discard every job by hand.

zraider7 avatar Feb 27 '23 15:02 zraider7

I've come across another use case for this. We use a stateless deployment for Atlantis which means any time I re-deploy our pod to, for example, update Atlantis we lose the plans for all outstanding PRs. This is something we've decided is acceptable for our use case but when Atlantis restarts with outstanding plans and locks, there is no indication given back to the PRs that a new plan must be generated. It would be nice if there were a way to discard all outstanding plans prior to a scheduled redeployment to allow Atlantis the opportunity to communicate to the end user that there plan has been discarded. Today, we do this by manually discarding each plan individually before updating the pods but having a bulk button would be nice. Even better would be a discard API (with bulk discard option) to allow us to make discarding the plans part of our deployment pipeline.

tedwardd avatar May 09 '24 19:05 tedwardd

api call sounds useful and the use case is not so uncommon.

if you guys are willing to create a PR, we will happy to review it.

jamengual avatar May 09 '24 23:05 jamengual