[P1] ci-cd: retry path misses ACA state adoption after first failed provision attempt

Open
#112 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
azure, github-actions, terraform

Research direction

Read .github/workflows/azd-deploy.yml, focusing on the reconcile and Provision infrastructure steps, then reproduce with workflow_dispatch and azure_env_name_override=178dev. Done means each provision retry checks for existing ACA apps, polls for state adoption, avoids already-exists failures, and reports imported or skipped apps in the step summary.

Written by the indexing model from the issue text.

Description

backend component:ci-cd component:terraform priority:P1 tracking type:bug type:regression

Problem

azd-deploy fails in a brand-new environment because retry attempt 2 tries to create ACA apps that already exist in Azure but are not present in Terraform state at that moment.

Type

  • bug
  • regression

Evidence

  • Workflow run: https://github.com/Azure-Samples/tutor/actions/runs/23124471384
  • Job: provision (67164738583), step Provision infrastructure failed.
  • Same run shows:
    • attempt 1 transient ACA errors (Operation expired), then retry
    • attempt 2 errors: already exists - to be managed via Terraform this resource needs to be imported into the State for multiple apps (avatar/chat/configuration/essays/evaluation/lms-gateway/questions/upskilling).
  • Earlier in same job, reconcile step logged several not found in Azure. Skipping state import. for those apps before attempt 1.

Reproduction

  1. Trigger .github/workflows/azd-deploy.yml with workflow_dispatch and azure_env_name_override=178dev (or any fresh dev env).
  2. Allow first Provision infrastructure attempt to hit transient ACA revision failures.
  3. Observe retry attempt where Terraform reports already exists on ACA apps.

Acceptance Criteria

  • Before each provision retry, the workflow deterministically imports any ACA app that exists in Azure and is missing from state.
  • State-adoption check includes bounded polling to handle ARM eventual consistency after failed attempt 1.
  • Retry attempt 2 no longer fails with already exists for ACA backend apps in fresh env scenarios.
  • Add a step summary block that reports imported/skipped apps per retry for diagnostics.

Suggested Owner

platform-quality

Dominant language
Python
Stars
17
Forks
8
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Azure-Samples/tutor

All issues in Azure-Samples/tutor

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.