Skip to content

Modularize deployment workflows into independent triggerable components#60

Merged
fpittelo merged 6 commits intodevfrom
copilot/triggerable-modular-workflow
Nov 22, 2025
Merged

Modularize deployment workflows into independent triggerable components#60
fpittelo merged 6 commits intodevfrom
copilot/triggerable-modular-workflow

Conversation

Copy link
Contributor

Copilot AI commented Nov 22, 2025

The monolithic deploy.yaml workflow ran backend creation, Terraform operations, and frontend builds sequentially for every deployment, regardless of what actually changed.

Changes

New Independent Workflows

  • deploy-backend.yaml - Creates Terraform state storage (Azure Storage Account/Container). Run once per environment.
  • deploy-infra.yaml - Terraform init/apply for all infrastructure resources. Run when infrastructure code changes.
  • deploy-app.yaml - Builds and deploys frontend only. Run on every app code change (~2min vs ~10min full deployment).
  • destroy-backend.yaml, destroy-infra.yaml, destroy-app.yaml - Corresponding destruction workflows with proper dependency ordering.

Updated Orchestrators

  • deploy.yaml / destroy.yaml - Now orchestrate the modular workflows with optional component selection via boolean inputs. Conditional job execution uses always() with result checks to handle skipped dependencies:
deploy-infra:
  if: ${{ always() && github.event.inputs.deploy_infra == 'true' && (needs.backend.result == 'success' || needs.backend.result == 'skipped') }}
  needs: backend

Safety & Documentation

  • Backend destroy defaults to false with explicit warnings about state deletion
  • Comprehensive usage guide at .github/workflows/README.md covering common scenarios
  • Updated all GitHub Actions from v3 to v4

Workflow Dependencies

Deploy:  backend → infra → app
Destroy: app → infra → backend

Each workflow is independently triggerable via workflow_dispatch. Orchestrators maintain backward compatibility while enabling granular control.

Original prompt

This section details on the original issue you should resolve

<issue_title>Triggerable modular deployment workflow and destroy worflow.</issue_title>
<issue_description>The current pipeline is a monolith disguised as a workflow. Running backend creation, Azure login, and all of Terraform before simply deploying a front-end build is peak inefficiency. To solve we need three distinct, triggerable workflows to succeed to ./github/deploy.yaml and ./github/destroy.yaml :

deploy-backend.yaml: Creates the remote state storage (Azure Blob/Container). This runs once per environment and is rarely touched. destroy-backend.yaml destroys what is created in deploy-backend.yaml, deploy-infra.yaml and deploy-app.yaml

deploy-infra.yaml: Runs Terraform Apply. This is your full IaC deployment and should only run when infrastructure changes. A destroy-infra.yaml destroys what is created in deploy-app.yaml and deploy-infra.yaml

deploy-app.yaml: Builds and deploys the Web App/Frontend. This runs on every code change to the app. destroy-app.yaml destroys what is created in deploy-app.yaml
</issue_description>

<agent_instructions>Go slowly and carefully. this quite a change. Verify the implications as you progress to make sure all is consistent. if you need more info, or not sure, ask me.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 5 commits November 22, 2025 11:53
Co-authored-by: fpittelo <3135901+fpittelo@users.noreply.github.com>
Co-authored-by: fpittelo <3135901+fpittelo@users.noreply.github.com>
Co-authored-by: fpittelo <3135901+fpittelo@users.noreply.github.com>
Co-authored-by: fpittelo <3135901+fpittelo@users.noreply.github.com>
Co-authored-by: fpittelo <3135901+fpittelo@users.noreply.github.com>
Copilot AI changed the title [WIP] Add triggerable modular deployment workflows Modularize deployment workflows into independent triggerable components Nov 22, 2025
Copilot AI requested a review from fpittelo November 22, 2025 12:05
@fpittelo fpittelo requested a review from Copilot November 22, 2025 13:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR successfully modularizes the monolithic deployment and destroy workflows into independent, triggerable components, enabling efficient, granular control over infrastructure deployments. Instead of running backend creation, Terraform operations, and frontend builds sequentially on every deployment, teams can now trigger only the necessary components.

Key Changes:

  • Created six independent workflows for deploying and destroying backend storage, infrastructure, and applications separately
  • Converted existing deploy.yaml and destroy.yaml into orchestrators with optional component selection via boolean inputs
  • Updated GitHub Actions from v3 to v4 across all workflows
  • Added comprehensive documentation explaining workflow usage, dependencies, and best practices

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
.github/workflows/deploy-backend.yaml New workflow for creating Terraform state storage (Azure Storage Account/Container)
.github/workflows/deploy-infra.yaml New workflow for Terraform init/apply operations on infrastructure resources
.github/workflows/deploy-app.yaml New workflow for building and deploying frontend React application only
.github/workflows/destroy-backend.yaml New workflow for destroying backend storage with state deletion warnings
.github/workflows/destroy-infra.yaml New workflow for Terraform destroy operations on infrastructure
.github/workflows/destroy-app.yaml New workflow for stopping Azure Web App deployment
.github/workflows/deploy.yaml Updated to orchestrate modular workflows with conditional execution and optional component selection
.github/workflows/destroy.yaml Updated to orchestrate destruction workflows with safe defaults (backend destroy defaults to false)
.github/workflows/README.md Comprehensive documentation covering workflow architecture, usage scenarios, and troubleshooting
WORKFLOW_MODULARIZATION_SUMMARY.md Implementation summary detailing technical decisions, testing considerations, and migration guidance

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Owner

@fpittelo fpittelo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@fpittelo fpittelo marked this pull request as ready for review November 22, 2025 13:04
@fpittelo fpittelo merged commit 3c67652 into dev Nov 22, 2025
6 checks passed
@fpittelo fpittelo deleted the copilot/triggerable-modular-workflow branch November 22, 2025 13:04
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.

3 participants