Skip to content

Conversation

Copy link

Copilot AI commented Aug 5, 2025

This PR refactors the CI/CD pipeline structure to separate infrastructure deployment from application deployment, addressing the issue where az-deploy.yml was handling both concerns in a single workflow.

Problem

The existing az-deploy.yml workflow was performing both infrastructure creation and application deployment in a single job, making it difficult to isolate issues and prevent proper separation of concerns between Infrastructure as Code (IaC) and application deployment.

Solution

Created two new dedicated workflows and updated the main pipeline orchestration:

New Workflows

  • infra-deploy.yml: Handles infrastructure deployment only

    • Downloads infrastructure artifacts from the build
    • Executes Bicep template deployments
    • Outputs App Service name for consumption by application deployment
  • app-deploy.yml: Handles application deployment only

    • Downloads application artifacts from the build
    • Takes App Service name as input from infrastructure deployment
    • Deploys the application to the provisioned infrastructure

Updated Pipeline Flow

The main.yml workflow now follows the desired pattern for each environment:

build → deploy_infra_dev → deploy_app_dev → 
        deploy_infra_staging → deploy_app_staging → 
        deploy_infra_prod → deploy_app_prod

Benefits

  • Clear separation of concerns: Infrastructure and application deployment are now completely isolated
  • Better error handling: Infrastructure failures won't trigger unnecessary application deployment attempts
  • Improved troubleshooting: Issues can be isolated to either infrastructure or application deployment phases
  • Reusable components: Both new workflows can be reused by other pipelines
  • Guaranteed execution order: Infrastructure is always deployed before applications

The original az-deploy.yml remains in the repository but is no longer referenced, allowing for easy rollback if needed.

Fixes #2.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: lukecookssw <100659715+lukecookssw@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor CI/CD pipelines to separate IaC from deployment Refactor CI/CD pipelines to separate Infrastructure as Code from deployment Aug 5, 2025
Copilot AI requested a review from lukecookssw August 5, 2025 23:32
@lukecookssw
Copy link
Owner

@copilot why does the infra-deploy download artifacts? There are no infra artifacts.

Copy link
Author

Copilot AI commented Aug 6, 2025

@copilot why does the infra-deploy download artifacts? There are no infra artifacts.

The infra-deploy workflow does need to download infrastructure artifacts. The build.yml workflow uploads the entire ./infra directory (containing main.bicep and the modules) as an artifact named "infra" on lines 34-39. The infra-deploy workflow downloads this artifact to access the Bicep templates needed for the az deployment group create --template-file .\main.bicep command on line 60. Without downloading these artifacts, the deployment would fail because the Bicep files wouldn't be available in the runner environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor CI/CD pipelines to separate IaC from deployment

2 participants