|
| 1 | +--- |
| 2 | +title:"Quick start: Advanced Promotion Flow with Promotion Workflows" |
| 3 | +description:"Promote product apps between multiple environments with promotion conditions" |
| 4 | +group:gitops-quick-start |
| 5 | +toc:true |
| 6 | +redirect_from: |
| 7 | + -/docs/promotions/promotion-scenarios/policy-multi-env-promotion/ |
| 8 | +--- |
| 9 | + |
| 10 | +##Automated promotions: Advanced Promotion Flow with Promotion Workflows |
| 11 | + |
| 12 | +With a Promotion Flow you can[automate promotions across multiple environments]({{site.baseurl}}/docs/gitops-quick-start/multi-env-sequential-flow/). |
| 13 | + |
| 14 | +This quick start explores how to enhance Promotion Flows by configuring conditions for each environment in the flow, ensuring that changes are promoted to environments only on meeting the specific requirements for the environment. |
| 15 | + |
| 16 | +You can automate and enforce gates throughout your promotion processes using Promotion Workflows. |
| 17 | +Promotion Workflows are essentially Argo Workflows customized for promoting changes through your environments. |
| 18 | +For detailed information, see[Configuring Promotion Workflows]({{site.baseurl}}/docs/promotions/promotion-workflow/). |
| 19 | + |
| 20 | +##Promotion Workflows in Promotion Flows |
| 21 | +Promotion Workflows are designed to define the conditions under which changes are promoted to the next environment. They provide a way to automate testing, quality checks, validation, and any other requirements based on your deployment process, establishing gates that control the flow of changes between environments. |
| 22 | + |
| 23 | +You can create workflows tailored to the specific tasks required during a promotion and categorize them based on the stage of the promotion process in which they are executed, as Pre- and Post-Action Workflows. |
| 24 | + |
| 25 | +#####Pre-Action Workflow |
| 26 | +A Promotion Workflow that runs_before the promotion action is triggered_. These workflows can be used for tasks like smoke tests, unit tests, security scans, or any other validation that must pass before a change is promoted to the next environment. |
| 27 | + |
| 28 | +The Pre-Action Workflow plays a critical role in ensuring that changes meet all necessary requirements before being promoted to the next environment. It acts as the gatekeeper, validating changes and stopping the promotion if any tests or validations fail. |
| 29 | + |
| 30 | + |
| 31 | +#####Post-Action Workflows |
| 32 | +A Promotion Workflow that runs_after the promotion action has completed_. These workflows can be used for tasks like performance monitoring, database migrations, or notifications to inform stakeholders that the promotion is complete. |
| 33 | + |
| 34 | +The Post-Action Workflow allows you to monitor and verify the effects of the promotion after it has taken place. This workflow helps ensure the promoted changes behave as expected in the new environment. |
| 35 | + |
| 36 | +##How to create Promotion Workflows |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | +##Requirements |
| 43 | + |
| 44 | +*[GitOps Runtime]({{site.baseurl}}/docs/quick-start/gitops-quick-start/runtime/) |
| 45 | +*[Git Source]({{site.baseurl}}/docs/gitops-quick-start/gitops-runtimes/create-git-source/) to store application manifests |
| 46 | +*[Environments]({{site.baseurl}}/docs/gitops-quick-start/products/quick-start-gitops-environments/) |
| 47 | + For a Promotion Flow, you need at least three environments. |
| 48 | + Here we use`dev`,`qa`, and`prod`. |
| 49 | +*[Products]({{site.baseurl}}/docs/gitops-quick-start/products/quick-start-product-create/) |
| 50 | +*[Applications]({{site.baseurl}}/docs/gitops-quick-start/products/create-app-ui/) |
| 51 | + Each environment must have an application for the product. |
| 52 | + For example,`demo-trioapp-dev`,`demo-trioapp-qa`, and`demo-trioapp-prod`representing the development, testing, and production versions. |
| 53 | + The structure of the repos with the resources accessed by the applications must be consistent across all the three applications. |
| 54 | + If it works for you, copy the corresponding subfolders in[demo-applications](https://github.com/codefresh-sandbox/codefresh-quickstart-demo/tree/main/demo-applications) with the resources.<!--- add a link to the repo?--> |
| 55 | +*[Promotion Workflows]({{site.baseurl}}/docs/promotions/entities/promotion-workflow/#create-promotion-workflows) |
| 56 | + |
| 57 | +##Assign Pre- and Post-Action Workflows to environments in Promotion Flow |
| 58 | +To ensure each environment's specific requirements are met, assign Promotion Workflows to govern promotion behavior. |
| 59 | +In this quick start, we’ll define the Promotion Workflows to govern promotion behavior for the`qa` and`prod` environments. |
| 60 | + |
| 61 | +1. From the Promotion Flow list, select the Promotion Flow you created,`multi-env-sequential-promotion` for the quick start. |
| 62 | +1. In the Settings panel, update the**Version** to indicate changes in the flow, for example,`2.0`. |
| 63 | +1. Assign the workflows by clicking the respective controls and selecting the Promotion Workflows and the Promotion Action from the list. |
| 64 | + The example below shows the Pre-Action Workflows available. |
| 65 | + |
| 66 | +{% include |
| 67 | +image.html |
| 68 | +lightbox="true" |
| 69 | +file="/images/quick-start/promotions/quick-start-seq-promo-policy-settings.png" |
| 70 | +url="/images/quick-start/promotions/quick-start-seq-promo-policy-settings.png" |
| 71 | +alt="Promotions quick start: Pre-Action Workflow to govern promotion behavior for environment" |
| 72 | +caption="Promotions quick start: Pre-Action Workflow to govern promotion behavior for environment" |
| 73 | +max-width="60%" |
| 74 | +%} |
| 75 | + |
| 76 | +{% include |
| 77 | +image.html |
| 78 | +lightbox="true" |
| 79 | +file="/images/quick-start/promotions/quick-start-seq-promo-policy-populated.png" |
| 80 | +url="/images/quick-start/promotions/quick-start-seq-promo-policy-populated.png" |
| 81 | +alt="Promotions quick start: Target environment configured with Promotion Workflows and Action" |
| 82 | +caption="Promotions quick start: Target environment configured with Promotion Workflows and Action" |
| 83 | +max-width="60%" |
| 84 | +%} |
| 85 | + |
| 86 | +{:start="4"} |
| 87 | +1. Repeat_step 3_ to select the Promotion Workflows and Actions for the other target environments in the Promotion Flow. |
| 88 | + For this quick start, we'll select the same workflows and the same promotion action for`prod` as we did for`qa`. |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | + Here's the YAML view of the flow with the workflows and promotion actions. |
| 93 | + |
| 94 | +{% include |
| 95 | +image.html |
| 96 | +lightbox="true" |
| 97 | +file="/images/quick-start/promotions/quick-start-seq-promo-policy-yaml.png" |
| 98 | +url="/images/quick-start/promotions/quick-start-seq-promo-policy-yaml.png" |
| 99 | +alt="Promotions quick start: YAML view of Promotion Flow with Promotion Workflows" |
| 100 | +caption="Promotions quick start: YAML view of Promotion Flow with Promotion Workflows" |
| 101 | +max-width="60%" |
| 102 | +%} |
| 103 | + |
| 104 | +{:start="5"} |
| 105 | +1. To save the changes, click**Save Promotion Flow**. |
| 106 | +1. Continue with[Trigger Promotion Flow and monitor product release](#trigger-promotion-flow-and-monitor-product-release). |
| 107 | + |
| 108 | + |
| 109 | +##Trigger Promotion Flow and monitor product release |
| 110 | +Trigger the Promotion Flow updated with the appropriate Pre- and Post-Action Workflows, and monitor its progress. |
| 111 | + |
| 112 | +The difference between the previous release (without workflows), and this one (with workflows), for the same Promotion Flow (`multi-env-sequential-promotion`), is that changes will only be promoted to the next environment when all workflows associated with the previous environment are complete. |
| 113 | + |
| 114 | +1. Open the Promotion Flow, for example,`multi-env-sequential-promotion` and click**Trigger**. |
| 115 | +1. Select the product, the application to promote, and then click**Trigger** once again. |
| 116 | +1. Click**View Release Details**. |
| 117 | + In the example below, the current release view shows the`qa` and`prod` environments with the Pre- and Post-Action Workflows defined for each environment. |
| 118 | + |
| 119 | +{% include |
| 120 | +image.html |
| 121 | +lightbox="true" |
| 122 | +file="/images/quick-start/promotions/quick-start-seq-promo-policy-release.png" |
| 123 | +url="/images/quick-start/promotions/quick-start-seq-promo-policy-release.png" |
| 124 | +alt="Promotions quick start: Release view for gated Promotion Flow" |
| 125 | +caption="Promotions quick start: Release view for gated Promotion Flow" |
| 126 | +max-width="60%" |
| 127 | +%} |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | +##What's next |
| 132 | +In the next quick start for promotions, we'll explore how to configure a Promotion Flow with parallel promotions, allowing changes to be promoted simultaneously across multiple environments. |
| 133 | + |
| 134 | +[Quick start: Advanced Promotion Flow: Parallel promotions across environments]({{site.baseurl}}/docs/gitops-quick-start/parallel-multi-env-promotion/) |
| 135 | + |
| 136 | + |
| 137 | + |