Skip to content

Latest commit

 

History

History
87 lines (55 loc) · 7.04 KB

WORKFLOW.md

File metadata and controls

87 lines (55 loc) · 7.04 KB

Orchestrators workflow

Creating pipelines for Infrastructure as code seems easy to build task, but in a mature system, things can get complicated as it needs to handle many changing dynamics parts. A mature workflow for IAC not only automates the deployment of the IAC resources but also incorporates engineering fundamentals, resources validation, dependency management, test execution, security scanning, and more.

Symphony offers multiple workflows to ensure engineering excellence at every stage of the IaC process. The workflows are designed to be orchestrator independent by relying on the logic implemented in bash scripts and the pipelines being thin shim layers that execute the logic scripts. This design makes it easy to update the workflows or port on new tools regardless of the SCM by adding those tools to the workflow scripts.

Main Deploy Workflow

This is the CI workflow to deploy the IaC resources to the target environment and subscription. It ensures best practices in IAC code repos, through multi-stage tasks to vet, deploy, test, all needed resources, and report any failures. Note that the details of stage execution may vary based on features available on the orchestrator's IAC tool.

This workflow has a set of inputs variable that can be updated at the execution time. While the inputs could vary based on the selected IaC tool, one common input variable across all is the environment name, which defines what environment configurations to be used.

Workflow steps

Validate

This stage ensures code readiness. It executes pre_validate events, runs validations and linting tools, scans code for possible cred leaks, and executes any unit tests. Stage steps are executed in the following sequential order.

flowchart LR
  A(Prep Env) --> B(Run Custom Scanners) --> C(Run IAC lint cmd)
  C -->D(Run IAC validate cmd) --> E(Run IAC unit test)
  E -->F(Finalize/Publish reports)
Loading

Preview & Deploy

This stage plans the execution of the IAC code and estimates the scope of the changes. It initializes the IAC tool selected, runs plan/what-if commands to detect the changing scope, executes pre_deploy events, then runs deploy commands to update the resources, executes post_deploy events, and eventually ensures successful resource updates.

flowchart LR
  A(Init IAC tool) --> B(Run IAC cmds to preview changes) -->  C(Check for resources destroy operations)
  C-->D(Run IAC Deploy cmds) -->E(Finalize/Publish reports)
Loading

Test

This stage executes the integration or end-to-end tests against the recently deployed/updated resources to ensure the configurations/changes are reflected and resources are working as expected. It then publishes the results of the tests and drops them as artifacts for future reference.

flowchart LR
  A(Init test framework) --> B(Execute e2e tests) -->E(Finalize/Publish reports)
Loading

Report

This stage generates the needed scripts to repro the deployments, publish the created reports, and backup state files if required.

flowchart LR
  A(Generate deployment scripts) --> B(Publish created scripts) --> E(Backup deployment state)
Loading

Destroy workflow

This is a single-stage workflow to destroy the deployed IaC resources of an environment and report any failures for easier cost and resource management. Note that the details of stage execution may vary based on features available on the orchestrator's IAC tool.

This workflow has a set of inputs variable that can be updated at the execution time. While the inputs could vary based on the selected IaC tool, one common input variable across all is the environment name, which defines what environment configurations to be used.

Workflow steps

Pull Request Workflow (currently for GitHub only)

This is a feature that helps ensuring best practices in IAC code repos when development is in progress, Pull Request workflow offers a set of validations to vet the pull request branch code changes as part of the review process. This will ensure changes of the IaC have not only been validated at the code quality level but also been properly tested on a real deployed environment to see the impact of resource changes.

Workflow steps

Workflow tools

Symphony workflows use a set of tools to run tasks at each stage. Those tools are automatically installed and configured by the workflow tasks as needed on the SCM agent during the execution of the workflow tasks.

Bicep workflow tools

Terraform workflow tools