Skip to content

feat: add manual atlantis policycheck command for draftplans - #6

Draft
crwatson wants to merge 6 commits into
update-atlantis-may2026from
draftplan-manual-policycheck
Draft

crwatson wants to merge 6 commits into
update-atlantis-may2026from
draftplan-manual-policycheck

Conversation

@crwatson

@crwatson crwatson commented Oct 1, 2026 •

Copy link
Copy Markdown

There were issues running policy checks automatically on each new draftplan, mostly related to speed and complexity.

Instead, trying this:
Add Draft Policy Check command. Instructions:

Using the Draft Policy Check feature

  1. Run a draft plan first (fast, skips remote state refresh):
    atlantis draftplan
    Targeting a specific project, if needed:
    atlantis draftplan -d dir -w workspace

  2. Run the policy check against that draft plan:
    atlantis draft_policy_check
    Targeting a specific project, if needed:
    atlantis draft_policy_check -d dir -w workspace

Requirements / behavior:

  • A draft plan must already exist for the project(s) you're checking. If none is found, draft_policy_check errors.
  • Results are visible as a PR comment and a atlantis/draft_policy_check commit status.
  • draft_policy_check must be included in the server's --allow-commands list to be usable (same as any other comment command).

Draftplan no longer needs to hold locks or run policy checks automatically
on every push. Instead, policy checks are run on demand against an existing
draftplan via a new `atlantis policycheck` comment command, scoped with the
usual -d/-w/-p flags. It errors clearly if no draftplan has been run yet for
the targeted project.

Supporting changes:
- Give draftplan its own plan/show/policy-output file naming (.draftplan
  extension, -draft suffix) so its artifacts never collide with or get
  overwritten by a real plan's.
- Add PendingPlanFinder.FindDraft to discover pending draftplans the same
  way Find does for real plans.
- Add ProjectCommandBuilder.BuildPolicyCheckCommands and
  DraftPolicyCheckCommandRunner to build and run the new command, reusing
  the existing policy check execution path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: claudia <claudia.watson@cognite.com>
@github-actions github-actions Bot added the size/m label Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant