[WIP] Detect active deployments before provisioning#7288
Draft
Copilot wants to merge 12 commits intofix/deployment-active-conflictfrom
Draft
[WIP] Detect active deployments before provisioning#7288Copilot wants to merge 12 commits intofix/deployment-active-conflictfrom
Copilot wants to merge 12 commits intofix/deployment-active-conflictfrom
Conversation
Before starting a Bicep deployment, check the target scope for in-progress ARM deployments and wait for them to complete. This avoids the DeploymentActive error that ARM returns after ~5 minutes when a concurrent deployment is already running on the same resource group. Changes: - Add IsActiveDeploymentState() helper in azapi to classify provisioning states as active or terminal. - Add ListActiveDeployments() to the infra.Scope interface and both ResourceGroupScope / SubscriptionScope implementations. - Add waitForActiveDeployments() in the Bicep provider, called after preflight validation and before deployment submission. It polls until active deployments clear or a 30-minute timeout is reached. - Add a DeploymentActive error suggestion rule to error_suggestions.yaml. - Add unit tests for state classification, polling, timeout, error handling, and context cancellation. Fixes #7248 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…per, refresh timeout names - Fix 'range 200' compile error (not valid in all Go versions) - Make DeploymentActive YAML rule scope-agnostic - Extract filterActiveDeployments helper to deduplicate scope logic - Refresh deployment names from latest poll on timeout message Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move ListActiveDeployments to a standalone function instead of adding it to the exported Scope interface. Adding methods to exported interfaces is a breaking change for any external implementation (including test mocks in CI). The standalone infra.ListActiveDeployments(ctx, scope) function calls scope.ListDeployments and filters for active states, achieving the same result without widening the interface contract. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The agent rewrote the entire YAML file causing a 925-line diff that broke CI tests. Reset to main and add only the DeploymentActive rule (11 lines) as intended. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The deployment object returned by generateDeploymentObject embeds a Scope that can be nil in test environments (e.g. mockedScope returns an empty SubscriptionDeployment). Using scopeForTemplate resolves the scope from the provider's configuration, avoiding nil panics in existing tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
f1f8bfc to
74a9edb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks for the feedback on #7251. I've created this new PR, which merges into #7251, to address your comment. I will work on the changes and keep this PR's description up to date as I make progress.
Original PR: #7251
Triggering comment (#7251 (comment)):
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.