You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Promotion Workflows (Argo Workflows) automate environment-specific tests and validations before and after promotion.
46
-
* Create and use Promotion Workflows to run smoke tests, database validation, and other requirements to verify readiness.
48
+
* Create Promotion Workflows to run smoke tests, database validation, and any other requirements to verify readiness of each application in an environment.
49
+
50
+
1.[Create Promotion Workflows with hooks]({{site.baseurl}}/docs/promotions/promotion-hooks/)
51
+
Promotion hooks provide promotion status and custom information for releases and environments during the Promotion Flow.
52
+
* Create hooks in Promotion Workflows to implement actions such as Slack notifications
53
+
* Define and export promotion contexts in hooks to expose and pass custom parameters such as Jira ID
Copy file name to clipboardExpand all lines: _docs/promotions/promotion-components.md
+8-2Lines changed: 8 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,12 +98,18 @@ These entities provide additional control and automation, enabling advanced mult
98
98
<td>Users with ABAC permissions</td>
99
99
<td><a href="https://codefresh.io/docs/docs/products/configure-product-settings/">Promotion settings for products</a></td>
100
100
</tr>
101
-
<tr>
101
+
<tr>
102
102
<td><strong>Promotion Workflow</strong></td>
103
-
<td>An Argo Workflow which runs tests and validations during promotion for each environment. Promotion Workflows can include smoke tests, rollback mechanisms, database validation checks, performance checks, and more.</td>
103
+
<td>An Argo Workflow which runs tests and validations during promotion for eachapplication within anenvironment. Promotion Workflows can include smoke tests, rollback mechanisms, database validation checks, performance checks, and more.</td>
<td>Promotion hooks are configured in Promotion Workflows to run at the start or end of a product release, or at the start or end of promotions in environments. Promotion hooks can include notifications and actions such as sending Slack messages or custom issue-tracking information based on the status of the promotion for release or environment.</td>
<td>Defines promotion behavior for environments by combining Promotion Workflows (tests and validations), with the promotion action such as commits or pull requests.</td>
description:"Use promotion contexts to expose custom parameters to hooks in Promotion Flows"
4
+
group:promotions
5
+
toc:true
6
+
---
7
+
8
+
9
+
10
+
11
+
##Promotion contexts in promotion hooks
12
+
Promotion Workflows with hooks in GitOps Cloud have access to a standard set of[default parameters]({{site.baseurl}}/docs/promotions/promotion-hooks/#default-arguments-in-promotion-hooks), such as the release ID, product, and commit SHA.
13
+
For promotion hooks to have access to additional, custom parameters that are not natively available, you need to use**promotion contexts**.
14
+
15
+
Because promotion hooks run within GitOps Runtimes in your own clusters, they do not automatically have access to custom internal parameters. To pass custom values like Jira ticket IDs, approver names, or Slack channel information between hooks in the same Promotion Flow, you must define and export a promotion context, which is a user-defined JSON object. See[Creating and exporting a promotion context](#creating-and-exporting-a-promotion-context).
16
+
17
+
Each hook in the Promotion Flow has access to the information it needs, no matter where it's running.
18
+
This ability to pass custom data across hooks can help with scenarios like notifying specific Slack channels or tracking specific Jira tickets associated with the promotion process. See[Example of Promotion Workflow with promotion context](#example-of-promotion-workflow-with-promotion-context) and[How promotion context works during execution](#how-promotion-context-works-during-execution).
19
+
20
+
21
+
##Creating and exporting a promotion context
22
+
You can use any method to create a promotion context as a JSON object and define the parameters you need.
23
+
The key step is**exporting the promotion context**, as this makes its content available to the Promotion Workflow.
24
+
25
+
Export the promotion context as an output parameter and make it available to the promotion mechanism:
26
+
* Add`PROMOTION_CONTEXT` as the`name` to`outputs.parameters`._The name must not be changed_.
27
+
* Add the`globalName` attribute to make it available globally. The value must match the name of the promotion context.
28
+
* Add the`valueFrom` attribute to reference the file path.
29
+
30
+
31
+
##Example of Promotion Workflow with promotion context
32
+
The example creates a promotion context`PROMOTION_CONTEXT` as a JSON object and exports it as an output parameter.
33
+
* The promotion context defines`JIRA_ISSUE_SOURCE_FIELD` and`JIRA_BASE_URL`
34
+
* Writes the context to a file`/tmp/promotion-context.txt`
35
+
* Adds`PROMOTION_CONTEXT` to`outputs.parameters.name`, defines`globalName` as the name of the promotion context, and in`valueFrom.path` specifies the file path where the promotion context JSON was saved for GitOps Cloud to retrieve and pass on to subsequent Promotion Workflows.
globalName:PROMOTION_CONTEXT# name of promotion context
61
+
valueFrom:
62
+
path:/tmp/promotion-context.txt
63
+
...
64
+
```
65
+
66
+
##How promotion context works during execution
67
+
68
+
When a hook exports a promotion context, the promotion mechanism passes those parameters to all subsequent hooks in the Promotion Flow, regardless of whether the hooks include promotion contexts. The promotion context is saved in the GitOps Cloud platform.
69
+
70
+
This ensures:
71
+
* Context values persist across environments and clusters
72
+
* If a hook redefines a parameter already in the context, the new value takes precedence
73
+
74
+
75
+
#####Triggering the first promotion hook
76
+
When the Promotion Flow is triggered and a product release is created, the promotion mechanism:
77
+
* Passes the default metadata (release ID, commit SHA for example) to all hooks configured for the Promotion Flow
78
+
* Initializes the promotion context, if defined and exported, with custom values
79
+
80
+
#####Triggering subsequent promotion hooks
81
+
As the Flow progresses, the promotion mechanism:
82
+
* Retrieves the promotion context from the previous hook
83
+
* Passes the context automatically to the next hook as input parameters:
84
+
* New parameters are added to the input parameters of the next hook
85
+
* For existing parameters, the value of the parameter in the current hook always takes precedence
Copy file name to clipboardExpand all lines: _docs/promotions/promotion-flow.md
+23-5Lines changed: 23 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -150,12 +150,28 @@ Although this behavior may seem intuitive, it’s crucial to recognize that each
150
150
151
151
Adding or deleting files from applications in target environments does not affect the Promotion Flow. The promotion mechanism simply retains the added/deleted files as they are in the target environments.
152
152
153
+
###Hooks in Promotion Flows
154
+
Promotion hooks provide promotion status and custom information for releases and environments during the Promotion Flow.
155
+
* Hooks are configured in Promotion Workflows and assigned to start/end of the release or specific environments in the Promotion Flow.
156
+
* All hooks receive a default set of arguments to configure actions or notifications based on success or failure.
157
+
* Promotion contexts within hooks when exported, expose custom parameters not natively available to the hooks. For example, you can link a Jira issue by creating a promotion context with the Jira ID and exporting it.
158
+
153
159
154
160
###Promotion Policy settings
155
161
156
-
For each environment, you can explicitly set the Promotion Policy that defines governs promotion behavior for the environment through the Promotion Action (required), andPre- and Post-Action Workflows.
162
+
For each environment, you can explicitly set the Promotion Policy that defines governs promotion behavior for the environment through the Promotion Action (required), and Pre- and Post-Action Workflows.
157
163
You can also preview Policy settings by product before the flow is triggered.
When you create or edit a Promotion Flow, the Flow Builder displays the Pre- and Post-Action Workflows, and the Promotion Action available for selection.
@@ -230,7 +246,7 @@ Visually design and create the flow by selecting environments, Promotion Actions
230
246
***Flow Timeout**: The maximum duration allowed for the Promotion Flow to complete execution after being triggered, before it is automatically terminated. If not specified, the default timeout is 1 day (24 hours).
231
247
***Version**: (Optional) The version of the Promotion Flow. This is manually defined and manually updated, and is useful to indicate changes in the same flow.
232
248
1. In**Select Trigger Environment**, click {::nomarkdown}<imgsrc="/images/icons/plus-icon.png"display=inline-block>{:/} to see the list of available environments:
233
-
* Select an existing environment, select it and click**Add**.
249
+
* Select an existing environment and click**Add**.
234
250
* To create a new environment, click**Add New Environment**.
235
251
236
252
{% include
@@ -244,7 +260,7 @@ max-width="50%"
244
260
%}
245
261
246
262
{:start="5"}
247
-
1. Optional. Toadd a trigger workflow to validate the trigger environment after the change and commit action, mouse over the left of the environment node, and click {::nomarkdown}<imgsrc="../../../../images/icons/flow-builder-add-workflow.png"display=inline-block>{:/}, and select a Workflow.
263
+
1. Optional. Toassign a workflow to validate the trigger environment after the change and commit action, mouse over the left of the environment node, and click {::nomarkdown}<imgsrc="../../../../images/icons/flow-builder-add-workflow.png"display=inline-block>{:/}, and select a Workflow.
248
264
* To apply a trigger workflow from global Promotion Policy settings, click**Account-level Promotion Policy**.
249
265
* To add a new Promotion Workflow as the trigger workflow, click**Add New Workflow**.
250
266
@@ -261,7 +277,6 @@ max-width="50%"
261
277
{:start="6"}
262
278
1. To add a target environment to promote to, either sequentially or in parallel, mouse over the right of the environment to add to, click {::nomarkdown}<imgsrc="../../../../images/icons/plus-icon.png"display=inline-block>{:/} and then select the environment or environments.
263
279
The example below shows two environments,`qa` and`staging` as parallel environments to`dev`.
264
-
<!--- To add parallel environments, click {::nomarkdown}<img src="../../../../images/icons/plus-icon.png" display=inline-block>{:/} on the right of the previous environment. For example, to add `qa` and `staging` as parallel environments to `dev`, you would click {::nomarkdown}<img src="../../../../images/icons/plus-icon.png" display=inline-block>{:/} on the `dev` environment.-->