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

Add polling to wait for post plan tasks to complete in remote backend #36655

Merged
merged 2 commits into from
Mar 12, 2025

Conversation

Maed223
Copy link
Contributor

@Maed223 Maed223 commented Mar 7, 2025

Description

Original Problem

It was seen that in some instances (Jira here) that using the remote backend with certain post plan tasks configured would cause the CLI to unceremoniously exit before confirmation could be given to apply runs in certain cases. This would occur due to these post plan tasks being in a running state when the backend checks if the run is confirmable.

To reproduce this behavior, set up a workspace (backed by a remote backend) with an OPA policy configured. When you perform an apply run, you'll see that the CLI exits before confirmation can be given (whether explicitly by the user or using auto-apply). Interestingly enough, I saw that enabling cost estimation avoided this erroneous behavior– since the processing of the cost estimate gave enough time for the OPA policy to complete before the confirmability of the run was checked.

Solution

Make the plan operation in the remote backend aware of post plan tasks, and have it wait for their completion before proceeding. The additions here are mostly copied from the analogous cloud backend methods, though I purposely omitted many of the features that you find in the cloud backend. The only text streamed to the console here would be notifications in the event of a task failing, or needing manual override– but the ability to do the override is not present here as it is in the cloud backend.

In total, when a post plan task errors, or otherwise doesn't pass, an error is shown:

Screenshot 2025-03-10 at 12 54 40 PM

Target Release

1.12.x

CHANGELOG entry

The remote backend now notifies the user if post plan tasks have failed and/or need manual override.

  • This change is user-facing and I added a changelog entry.
  • This change is not user-facing.

@crw crw added the bug label Mar 7, 2025
@Maed223 Maed223 force-pushed the IPL-7753/wait-for-post-plan-tasks-remote-backend branch from 7c91cb2 to 02fd2a5 Compare March 10, 2025 15:22
@Maed223 Maed223 force-pushed the IPL-7753/wait-for-post-plan-tasks-remote-backend branch from f1439cf to 746b083 Compare March 10, 2025 16:35
@Maed223 Maed223 marked this pull request as ready for review March 10, 2025 17:02
@Maed223 Maed223 requested a review from a team as a code owner March 10, 2025 17:02
brandonc
brandonc previously approved these changes Mar 10, 2025
@Maed223 Maed223 force-pushed the IPL-7753/wait-for-post-plan-tasks-remote-backend branch from 5eba132 to 4ec7284 Compare March 11, 2025 15:24
@Maed223 Maed223 merged commit a1b5ed3 into main Mar 12, 2025
8 checks passed
@Maed223 Maed223 deleted the IPL-7753/wait-for-post-plan-tasks-remote-backend branch March 12, 2025 14:10
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.

4 participants