atlantis: undiverged not working correctly as a plan requirement
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
When running atlantis plan on an out of date branch, it results in inconsistent behavior as seen below. I suspect the undiverged check is not running early enough. It should probably execute before any plans are run at all? My guess is that parallel planning is throwing it off.
Reproduction Steps
Set up a repo that plans multiple paths in parallel. Make an out of date PR Run atlantis plan
Environment details
- Atlantis version: 0.27.0
- Deployment method: ecs
Atlantis server-side config file:
- id: /.*/
apply_requirements: [approved, mergeable, undiverged]
import_requirements: [approved, mergeable, undiverged]
plan_requirements: [undiverged]
Repo atlantis.yaml file:
parallel_plan: true
parallel_apply: true
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 6
- Comments: 18 (11 by maintainers)
True, however
undivergedis already documented to only work if checkout strategy ismerge.From https://www.runatlantis.io/docs/command-requirements.html#undiverged
I’m not sure we have the ability to detect divergence in a
branchsituation.So maybe we remove support for
undivergedas aplanrequirement (i.e., have startup fail if it’s set, update docs). As noted it doesn’t work currently so we’re not losing much, and I don’t think in general it’s desirable.Interested to hear from other commenters here @albertorm95 @xakraz @kpocius ?
EDIT: Additionally we maybe should have startup fail if
undivergedis set as an apply/import requirement but checkout strategy is not set tocheckout, since it’s not going to work 🤔undivergedonly applies to themergecheckout strategy, so unless I’m misunderstanding something there’s no regression here.The scenario you describe should be consistent with having an apply requirement for
undivergedright?Again, when using the
mergecheckout strategy, before actually running a plan, the content from the branch is “merged” with then fetched origin/main, so there’s already no way to plan without new updates to main. A plan requirement that prevented that from happening would defeat the purpose of themergecheckout strategy entirely, at which point you might as well usebranch.I’m still leaning towards just an update to documentation/config validation to clarify this is an apply-only requirement.
cc @GenPage @jamengual
My understanding of https://www.runatlantis.io/docs/checkout-strategy.html#merge, and I was able to confirm this at least in a toy example, is that when you go to run that plan, it checks out
mainat origin then does the merge. So the actual plan that’s created is not behind. Is this not what you’re seeing?Tested this on 0.27.1 with both parallel plan and apply turned off – it still goes ahead an happily plans the changes.