Skip to content

feat: enabling pending apply status when any of the projects has changes to…#5926

Merged
GenPage merged 18 commits intorunatlantis:mainfrom
rjmsilveira:enable-pending-apply-status-jobs
Dec 1, 2025
Merged

feat: enabling pending apply status when any of the projects has changes to…#5926
GenPage merged 18 commits intorunatlantis:mainfrom
rjmsilveira:enable-pending-apply-status-jobs

Conversation

@rjmsilveira
Copy link
Contributor

@rjmsilveira rjmsilveira commented Oct 31, 2025

What

This MR restores the ability to set commit status to pending when there are planned Terraform changes that haven't been applied yet. This feature is now:

GitLab-specific (controlled by the --pending-apply-status flag)

Opt-in (defaults to false to maintain backward compatibility)
Provides better visibility into MR readiness by blocking merges until all applies are completed

Why

When enabled, this feature prevents GitLab merge requests from being merged prematurely by setting the commit status to pending when:

  • atlantis plan detects changes that need to be applied
  • Not all projects have been successfully applied

The status transitions:

  • ✅ Success: All projects applied or show no changes
  • ⏳ Pending: Planned changes exist but haven't been applied yet
  • ❌ Failed: Apply errors occurred

This addresses a common workflow requirement where teams want to ensure all infrastructure changes are actually applied before allowing the MR to merge, preventing situations where planned changes are approved but never executed.

Why GitLab-only and opt-in?

The original implementation (#2053) caused issues (#2138) with race conditions where apply status would appear before plans completed, leading to confusion and stuck PRs. The feature was reverted in #2173.

Since then, Atlantis has significantly improved its event ordering and status update handling. However, to ensure maximum safety and backward compatibility, this restoration:

Limits scope to GitLab - where the feature is most requested and tested
Requires explicit opt-in - prevents unexpected behavior changes for existing users
Preserves existing behavior - when disabled or on other VCS platforms, no status updates occur for unapplied plans
Tests
Added comprehensive test coverage in TestPlanCommandRunner_PendingApplyStatus:

✅ GitLab + flag enabled + unapplied plans → Pending status
✅ GitLab + flag disabled + unapplied plans → No status update (backward compatible)
✅ GitLab + all plans applied → Success status
✅ GitHub/Bitbucket + flag enabled → No status update (GitLab-only feature)
✅ GitLab + apply errors → Failed status
All existing tests pass, ensuring backward compatibility is maintained.

References

Original feature (2021): https://github.com/runatlantis/atlantis/pull/2053/files
Issue reports (race conditions): https://github.com/runatlantis/atlantis/issues/2138
Feature revert (2022): https://github.com/runatlantis/atlantis/pull/2173/files

Key improvements since the original implementation:

The latest Atlantis codebase now handles event ordering much more reliably. The race condition issues that caused the original revert (where apply status would appear before plans properly finished) have been resolved through improved event sequencing. This makes it safe to reintroduce the feature with proper safeguards (opt-in flag + VCS-specific implementation).

Configuration:

See updated documentation in server-configuration.md.

This approach provides the requested functionality while learning from past issues and ensuring a smooth, safe rollout for teams that need this workflow enforcement.

@dosubot dosubot bot added feature New functionality/enhancement go Pull requests that update Go code labels Oct 31, 2025
@rjmsilveira rjmsilveira force-pushed the enable-pending-apply-status-jobs branch from 7888091 to 804f27d Compare October 31, 2025 16:59
…ges to be applied

Signed-off-by: Ricardo Silveira <ricardo.silveira@olx.com>
@rjmsilveira rjmsilveira force-pushed the enable-pending-apply-status-jobs branch from 804f27d to 862f0b8 Compare October 31, 2025 17:00
@rjmsilveira rjmsilveira changed the title Enabling pending apply status when any of the projects has changes to… feat: enabling pending apply status when any of the projects has changes to… Nov 10, 2025
@github-actions github-actions bot added the docs Documentation label Nov 10, 2025
…rojects has changes to be applied

Signed-off-by: Ricardo Silveira <ricardo.silveira@olx.com>
@rjmsilveira rjmsilveira force-pushed the enable-pending-apply-status-jobs branch from cf520d4 to c96562e Compare November 11, 2025 10:21
@joelbatistaferreira
Copy link

This feature is a must-have for me.
Thank you Ricardo for re-enabling this.

@Aliantez
Copy link

Thanks for adding this, I like it.

rjmsilveira and others added 4 commits November 17, 2025 09:59
Signed-off-by: Ricardo Silveira <ricardo.silveira@olx.com>
…5966)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Signed-off-by: Ricardo Silveira <ricardo.silveira@olx.com>
@rjmsilveira rjmsilveira force-pushed the enable-pending-apply-status-jobs branch from ce9f28d to 7825027 Compare November 21, 2025 17:26
lukemassa
lukemassa previously approved these changes Nov 21, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 21, 2025
Adamovix and others added 7 commits November 27, 2025 08:45
Signed-off-by: Adam Gościcki <adamgoscicki@gmail.com>
Signed-off-by: Adamovix <adamgoscicki@gmail.com>
Signed-off-by: Ricardo Silveira <ricardo.silveira@olx.com>
…(main) (#5974)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Signed-off-by: Rui Chen <rui@chenrui.dev>
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Rui Chen <rui@chenrui.dev>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Rui Chen <rui@chenrui.dev>
Signed-off-by: Ed Laur <eduard.laur@wolt.com>
Co-authored-by: Rui Chen <rui@chenrui.dev>
Signed-off-by: Ricardo Silveira <ricardo.silveira@olx.com>
@rjmsilveira rjmsilveira force-pushed the enable-pending-apply-status-jobs branch from 53613d5 to 3cba37d Compare November 27, 2025 08:46
@github-actions github-actions bot added dependencies PRs that update a dependency file github-actions labels Nov 27, 2025
@GenPage GenPage enabled auto-merge (squash) December 1, 2025 16:48
@GenPage GenPage merged commit 6d58360 into runatlantis:main Dec 1, 2025
41 checks passed
WebOfNakedFancies pushed a commit to WebOfNakedFancies/atlantis that referenced this pull request Dec 2, 2025
…ges to… (runatlantis#5926)

Signed-off-by: Ricardo Silveira <ricardo.silveira@olx.com>
Signed-off-by: Adam Gościcki <adamgoscicki@gmail.com>
Signed-off-by: Adamovix <adamgoscicki@gmail.com>
Signed-off-by: Rui Chen <rui@chenrui.dev>
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Ed Laur <eduard.laur@wolt.com>
Co-authored-by: Ricardo Silveira <ricardo.silveira@olx.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Adam Gościcki <adamgoscicki@gmail.com>
Co-authored-by: Rui Chen <rui@chenrui.dev>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ed Laur <eduard.laur@wolt.com>
Co-authored-by: Luke Massa <lukefrederickmassa@gmail.com>
Signed-off-by: WebOfNakedFancies <akubi@gmx.com>
aidansteele pushed a commit to aidansteele/atlantis that referenced this pull request Mar 12, 2026
…ges to… (runatlantis#5926)

Signed-off-by: Ricardo Silveira <ricardo.silveira@olx.com>
Signed-off-by: Adam Gościcki <adamgoscicki@gmail.com>
Signed-off-by: Adamovix <adamgoscicki@gmail.com>
Signed-off-by: Rui Chen <rui@chenrui.dev>
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Ed Laur <eduard.laur@wolt.com>
Co-authored-by: Ricardo Silveira <ricardo.silveira@olx.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Adam Gościcki <adamgoscicki@gmail.com>
Co-authored-by: Rui Chen <rui@chenrui.dev>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ed Laur <eduard.laur@wolt.com>
Co-authored-by: Luke Massa <lukefrederickmassa@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies PRs that update a dependency file docs Documentation feature New functionality/enhancement github-actions go Pull requests that update Go code lgtm This PR has been approved by a maintainer website

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants