Skip to content

Commit e643444

Browse files
authoredMay 14, 2025··
Gitops promotion hooks (#1277)
* Update promotion-flow.md * Update promotion-flow.md * Add promotion hooks * Rename and update promotion hooks * Update promotion-hooks.md * Add promotion hooks to nav yamls * Add sym link for promotion hooks to _gitops collection * Update promotion-hooks.md * Update promotion-hooks.md Edits after feedback from Dev * Update content Added draft diagram for promotion context behavior and content updates * Update promotion-hooks.md * Remove entities from mapping file * Update * Update diagram * Update promotion-hooks.md * Add new articles fro service accounts and promotion contexts * Updates * Update content for promotion contexts Added walkthrough example for promotion context * Update promotion-context-promotion-workflows.md * Update hook-slack-notification-example.png * Update promotion-context-promotion-workflows.md * Add promotion context example Added example template to define promotion context and use in promotion hook * Update overview title * Update promotion-context-promotion-workflows.md * Add feedback from review Implemented feedback from Francisco's review * Update product-releases.md * Add note on early access Added note on early access availability for publish
1 parent d2efdd2 commit e643444

24 files changed

+1007
-116
lines changed
 

‎_data/argohub-nav.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,17 @@
255255
- title: Promotion setup guidelines
256256
url: "/create-promotion-sequence"
257257
- title: Promotion Flows
258-
url: "/promotion-flow"
258+
url: "/promotion-flow"
259259
- title: Promotion Policies
260260
url: "/promotion-policy"
261261
- title: Promotion Workflows
262-
url: "/promotion-workflow"
262+
url: "/promotion-workflow"
263+
- title: Service accounts for Promotion Workflows
264+
url: "/service-accounts-promotion-workflows"
265+
- title: Promotion hooks
266+
url: "/promotion-hooks"
267+
- title: Promotion contexts in promotion hooks
268+
url: "/promotion-context-promotion-workflows"
263269
- title: Product promotion settings
264270
url: "/product-promotion-props"
265271
- title: Promotion entity YAMLs

‎_data/nav.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,11 +434,17 @@
434434
- title: Promotion setup guidelines
435435
url: "/create-promotion-sequence"
436436
- title: Promotion Flows
437-
url: "/promotion-flow"
437+
url: "/promotion-flow"
438438
- title: Promotion Policies
439439
url: "/promotion-policy"
440440
- title: Promotion Workflows
441441
url: "/promotion-workflow"
442+
- title: Service accounts for Promotion Workflows
443+
url: "/service-accounts-promotion-workflows"
444+
- title: Promotion hooks
445+
url: "/promotion-hooks"
446+
- title: Promotion contexts in promotion hooks
447+
url: "/promotion-context-promotion-workflows"
442448
- title: Product promotion settings
443449
url: "/product-promotion-props"
444450
- title: Promotion entity YAMLs

‎_docs/promotions/create-promotion-sequence.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Promotions are a critical part of continuous delivery, enabling you to move chan
1414

1515
## Prerequisites
1616
1. [Configuration Runtime]({{site.baseurl}}/docs/installation/gitops/configuration-runtime/)
17-
The Configuration Runtime is a GitOps Runtime that stores promotion-related entities.
17+
The Configuration Runtime is a GitOps Runtime that stores configuration for GitOps promotion entities.
1818
* Designate at least one GitOps Runtime as the Configuration Runtime.
1919
* If no GitOps Runtime has been designated as such, Codefresh assigns one of the existing Runtimes.
2020

@@ -24,10 +24,12 @@ Promotions are a critical part of continuous delivery, enabling you to move chan
2424
1. [User permissions]({{site.baseurl}}/docs/administration/account-user-management/gitops-abac/)
2525
Users need permissions to create Promotion Workflows, configure promotion settings for products, and trigger promotions.
2626

27+
28+
## Setup tasks
2729
1. [Create environments]({{site.baseurl}}/docs/environments/create-manage-environments/#create-environments)
2830
Environments define the starting point and destination of promotions.
2931
A promotion requires at least two environments:
30-
* Trigger environment, the source of the changes being promoted
32+
* Trigger Environment, the source of the changes being promoted
3133
* Target environment, to which to promote the changes
3234

3335
1. [Create applications]({{site.baseurl}}/docs/deployments/gitops/create-application/#create-an-argo-cd-application)
@@ -43,26 +45,39 @@ Promotions are a critical part of continuous delivery, enabling you to move chan
4345

4446
1. [Create Promotion Workflows]({{site.baseurl}}/docs/promotions/promotion-workflow/)
4547
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
54+
4755

4856
1. [Define Promotion Policies]({{site.baseurl}}/docs/promotions/promotion-policy/)
4957
Promotion Policies govern promotion behavior for environments enforcing rules, checks, and validations.
5058
* Define policies that combine Promotion Workflows with promotion actions such as commits, pull requests
5159
* The policy mechanism merges relevant settings from global policies according to priority, enforcing automated governance
5260

61+
5362
1. [Create Promotion Flows]({{site.baseurl}}/docs/promotions/promotion-flow/)
5463
Promotion Flows orchestrate the sequence of actions required to move and deploy changes through multiple environments.
5564
* Automatically integrate environments, products, Promotion Workflows, and Promotion Policies into a structured promotion process
65+
* Assign promotion hooks to track release and environment statuses for product releases
5666
* Reuse Promotion Flows across products for consistent and reliable promotions
67+
68+
5769

5870
1. [Customize promotions for products]({{site.baseurl}}/docs/promotions/product-promotion-props/)
5971
After setting up promotion entities, configure additional promotion settings at the product level.
6072
* Promotion Templates to define attributes to be promoted across the product's applications
6173
* Promotion Flows valid for the product and trigger conditions for each flow
6274

75+
## Trigger and monitor promotions
76+
6377
1. [Trigger promotions]({{site.baseurl}}/docs/promotions/trigger-promotions/)
6478
Trigger the promotion manually or automatically.
65-
79+
80+
6681
1. [Monitor promotion releases for products]({{site.baseurl}}/docs/promotions/product-releases/)
6782
Monitor deployment progress as applications move through the promotion sequence.
6883
* Use the Releases feature for products to monitor deployments

‎_docs/promotions/product-releases.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ toc: true
77

88

99

10-
10+
## Releases for promotions in GitOps
1111
Releases in Codefresh GitOps offer a consolidated view of the deployment lifecycle for a product as it progresses through environments during a promotion. They enable you to track, visualize, and analyze changes from the initial trigger to the final deployment, providing comprehensive insights for all stakeholders.
1212

1313
A release is automatically created whenever a promotion is triggered for a product, either manually or through an automated flow. This ensures every change is documented and linked to its promotion lifecycle, giving teams complete visibility into their deployment processes.
1414

15-
## Releases in GitOps
1615
In the context of GitOps, a release captures the progression of a product as it is promoted through environments. The release reflects the collective state of all environments and workflows involved in deploying a change, from the initial trigger to the final target environment, whether production or another specified target.
1716

1817

@@ -28,7 +27,7 @@ max-width="60%"
2827
%}
2928

3029
### Why Releases matter
31-
Whether you are a product manager or an application developer, Releases offer:
30+
Whether you are a product manager or an application developer, releases offer:
3231
* Lifecycle visualization: Clearly track the deployment lifecycle of a product
3332
* Integrated change list: Access a unified list of changes leading to a deployment
3433
* Deployment status: Monitor ongoing deployments and quickly identify issues
@@ -64,7 +63,7 @@ There are two key aspects of tracking deployments for a product through releases
6463

6564
##### Release promotion flow
6665
Track the release visually to monitor its progression through each phase of the promotion lifecycle across environments.
67-
Specific Release views centralizes all information, allowing you to:
66+
Release views centralizes all information, allowing you to:
6867
* Identify and resolve deployment issues without switching between tools
6968
* Access everything you need to troubleshoot errors in one place.
7069

@@ -82,7 +81,7 @@ Release notes compile changes from various sources into a single view, enabling
8281
See [Analyze change history in Release Notes](#analyze-change-history-in-release-notes).
8382

8483

85-
## View Releases for products
84+
## View releases for products
8685

8786
The Releases tab for a product displays the releases for that product, whether successful or failed.
8887

@@ -145,7 +144,7 @@ max-width="60%"
145144
The header in the Releases page summarizes the change that triggered the promotion, the overall status of the release, and the count of failed, successful, running, and pending environments.
146145

147146
>**NOTE:**
148-
The commit details are always for the trigger environment that initiated the promotion.
147+
The commit details are always for the Trigger Environment that initiated the promotion.
149148

150149
{% include
151150
image.html
@@ -186,8 +185,8 @@ max-width="60%"
186185

187186
## Environments in product releases
188187

189-
The graphical view of the different environments defined in the Promotion Flo allows you to:
190-
* Understand the interconnections between the environments, whether sequential or parallel.
188+
The graphical view of the different environments defined in the Promotion Flow allows you to:
189+
* Understand the interconnections between the environments, whether sequential or parallel
191190
* Visualize the dependencies between environments to see how changes propagate through the deployment process
192191

193192
Each environment is color-coded to indicate the overall status of the promotion for that environment.
@@ -253,8 +252,9 @@ If there is an update that triggers a Pre- or Post-Action Workflow within an env
253252
For example, if an update in the `staging` environment triggers the `echo-pre-action` Pre-Action Workflow, and a later update in the same environment also triggers the same `echo-pre-action` Pre-Action Workflow, the earlier instance is terminated, and the later instance continues to run.
254253

255254

255+
## Promotion Hooks in product release
256+
The **Show/Hide Hooks** toggle button in the Release view displays/hides the [promotion hooks]({{site.baseurl}}/docs/promotions/promotion-hooks/) assigned to the Promotion Flow.
256257

257-
<!--- NIMA: how will it be shown in the releases tab? -->
258258

259259
## Promotion Workflows in product releases
260260

‎_docs/promotions/promotion-components.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,18 @@ These entities provide additional control and automation, enabling advanced mult
9898
<td>Users with ABAC permissions</td>
9999
<td><a href="https://codefresh.io/docs/docs/products/configure-product-settings/">Promotion settings for products</a></td>
100100
</tr>
101-
<tr>
101+
<tr>
102102
<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 each application within an environment. Promotion Workflows can include smoke tests, rollback mechanisms, database validation checks, performance checks, and more.</td>
104104
<td>Users with ABAC permissions</td>
105105
<td><a href="https://codefresh.io/docs/docs/promotions/promotion-workflow/">Promotion Workflows</a></td>
106106
</tr>
107+
<tr>
108+
<td><strong>Promotion hooks</strong></td>
109+
<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>
110+
<td>Users with ABAC permissions</td>
111+
<td><a href="https://codefresh.io/docs/docs/promotions/promotion-hooks/">Promotion Workflows</a></td>
112+
</tr>
107113
<tr>
108114
<td><strong>Promotion Policy</strong></td>
109115
<td>Defines promotion behavior for environments by combining Promotion Workflows (tests and validations), with the promotion action such as commits or pull requests.</td>

‎_docs/promotions/promotion-context-promotion-workflows.md

Lines changed: 427 additions & 0 deletions
Large diffs are not rendered by default.

‎_docs/promotions/promotion-flow.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ To ensure a successful promotion, the product must include an application in eac
140140
#### Application sync and health status
141141
Applications must be **Synced** and **Healthy** for a promotion to succeed.
142142

143+
143144
#### Multiple applications in a target environment
144145
If a target environment includes multiple applications for the same product—segmented for example by region, tenant, or other criteria—each application in that environment is updated with changes from the source environment.
145146

@@ -149,12 +150,28 @@ Although this behavior may seem intuitive, it’s crucial to recognize that each
149150

150151
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.
151152

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+
152159

153160
### Promotion Policy settings
154161

155-
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.
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.
156163
You can also preview Policy settings by product before the flow is triggered.
157164

165+
{% include
166+
image.html
167+
lightbox="true"
168+
file="/images/gitops-promotions/hooks/promotion-hooks-in-flow.png"
169+
url="/images/gitops-promotions/hooks/promotion-hooks-in-flow.png"
170+
alt="Promotion hooks in Promotion Flow"
171+
caption="Promotion hooks in Promotion Flow"
172+
max-width="60%"
173+
%}
174+
158175
#### Inline vs. global Promotion Policy settings
159176

160177
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.
@@ -229,7 +246,7 @@ Visually design and create the flow by selecting environments, Promotion Actions
229246
* **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).
230247
* **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.
231248
1. In **Select Trigger Environment**, click {::nomarkdown}<img src="/images/icons/plus-icon.png" display=inline-block>{:/} to see the list of available environments:
232-
* Select an existing environment, select it and click **Add**.
249+
* Select an existing environment and click **Add**.
233250
* To create a new environment, click **Add New Environment**.
234251

235252
{% include
@@ -243,7 +260,7 @@ max-width="50%"
243260
%}
244261

245262
{:start="5"}
246-
1. Optional. To add 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}<img src="../../../../images/icons/flow-builder-add-workflow.png" display=inline-block>{:/}, and select a Workflow.
263+
1. Optional. To assign a workflow to validate the trigger environment after the change and commit action, mouse over the left of the environment node, and click {::nomarkdown}<img src="../../../../images/icons/flow-builder-add-workflow.png" display=inline-block>{:/}, and select a Workflow.
247264
* To apply a trigger workflow from global Promotion Policy settings, click **Account-level Promotion Policy**.
248265
* To add a new Promotion Workflow as the trigger workflow, click **Add New Workflow**.
249266

@@ -260,7 +277,6 @@ max-width="50%"
260277
{:start="6"}
261278
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}<img src="../../../../images/icons/plus-icon.png" display=inline-block>{:/} and then select the environment or environments.
262279
The example below shows two environments, `qa` and `staging` as parallel environments to `dev`.
263-
<!--- 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. -->
264280

265281
{% include
266282
image.html
@@ -319,7 +335,9 @@ caption="Add Pre-/Post-Action Workflows"
319335
max-width="60%"
320336
%}
321337

322-
{:start="10"}
338+
1. To assign promotion hooks to the start or release or to an environment do
339+
340+
{:start="11"}
323341
1. Click **Save Promotion Flow** on the top-right.
324342
The Name and Description are populated from the Settings. The flow's YAML version on the right lists the environment sequence.
325343
1. To confirm, click **Save**.
@@ -400,6 +418,7 @@ TBD
400418
-->
401419

402420
## Related articles
421+
[Hooks in Promotion Flows]({{site.baseurl}}/docs/promotions/promotion-hooks/)
403422
[Trigger promotions]({{site.baseurl}}/docs/promotions/trigger-promotions/)
404423
[Tracking product promotions through releases]({{site.baseurl}}/docs/promotions/product-releases/)
405424
[Promotions: Setup & configuration guidelines]({{site.baseurl}}/docs/promotions/create-promotion-sequence/)

‎_docs/promotions/promotion-hooks.md

Lines changed: 301 additions & 0 deletions
Large diffs are not rendered by default.

‎_docs/promotions/promotion-policy.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ For more information, see [Promotion Workflows in Product Releases]({{site.baseu
341341
## Related articles
342342
[Configure Promotion Flows]({{site.baseurl}}/docs/promotions/promotion-flow/)
343343
[Configure Promotion Workflows]({{site.baseurl}}/docs/promotions/promotion-workflow/)
344+
[Hooks in Promotion Flows]({{site.baseurl}}/docs/promotions/promotion-hooks/)
344345
[Trigger promotions]({{site.baseurl}}/docs/promotions/trigger-promotions/)
345346
[Tracking product releases]({{site.baseurl}}/docs/promotions/product-releases/)
346347
[Promotions: Setup & configuration guidelines]({{site.baseurl}}/docs/promotions/create-promotion-sequence/)

‎_docs/promotions/promotion-workflow.md

Lines changed: 62 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ You can run Promotion Workflows at different stages of the promotion:
4545
See [Creating Promotion Workflows](#create-promotion-workflows) and [Promotion Workflow examples](#promotion-workflow-examples).
4646

4747

48-
4948
##### Arguments in Pre-Action and Post-Action Workflows
5049
Codefresh passes arguments retrieved during the promotion process to both Pre- and Post-Action Workflows. You can use these arguments to dynamically adjust requirements throughout the promotion lifecycle.
5150

5251
See [Parameters in Pre-Action and Post-Action Workflows](#parameters-in-pre-action-and-post-action-workflows).
5352

53+
54+
55+
5456
## Using Promotion Workflows in promotions
5557
After creating Promotion Workflows, depending on the level of control and scalability you need, you can use them through:
5658

@@ -75,7 +77,11 @@ See [Annotation attribute for Promotion Workflows](#annotation-attribute-for-pro
7577
## Promotion Workflow YAML
7678
Once configured and committed, Promotion Workflow settings are saved as a CRD (Custom Resource Definition) within the Shared Configuration Repository in the GitOps Runtime selected as the Configuration Runtime.
7779
The path in the Shared Configuration Repo is `<gitops-runtime>/<shared-configuration-repo>/resources/control-planes/promotion-workflows/`.
78-
See [Shared Configuration Repository]({{site.baseurl}}/docs/installation/gitops/shared-configuration/) and [Designating Configuration Runtimes]({{site.baseurl}}/docs/installation/gitops/configuration-runtime/).
80+
See [Shared Configuration Repository]({{site.baseurl}}/docs/installation/gitops/shared-configuration/) and [Designating Configuration Runtimes]({{site.baseurl}}/docs/installation/gitops/configuration-runtime/).
81+
82+
## Service accounts for Promotion Workflow
83+
84+
Every Promotion Workflow requires a service account to run. The service account grants the necessary permissions for actions in the target cluster. For details, see [Service accounts for Promotion Workflows]({{site.baseurl}}/docs/promotions/service-accounts-promotion-workflows/).
7985

8086
## Annotation attribute for Promotion Workflows
8187
An Argo Workflow or Workflow Template is classified as a Promotion Workflow when it includes the following annotation:
@@ -777,85 +783,65 @@ caption="Workflow execution instances"
777783
max-width="60%"
778784
%}
779785

786+
## Promotion hooks in Promotion Workflows
787+
Promotion hooks are special steps you can configure within Promotion Workflows to expose promotion status and trigger custom actions during a Promotion Flow. Compared to Pre- and Post-Action Promotion Workflows that run on applications within environments, hooks provide tailored information about the success or failure of a release or environment, and can send notifications, execute external logic, or update external systems.
780788

789+
Promotion hooks run at specific stages when a Promotion Flow is triggered manually or automatically. They can be reused across releases and environments to standardize processes and improve visibility across your GitOps workflows.
781790

791+
Hooks have access to a default set of promotion arguments, such as the product, release ID, and commit SHA. You can also pass custom information, such as Jira ticket IDs, Slack channels, or release notes, by creating and exporting a promotion context within the workflow.
782792

783-
<!--- ### View/analyze Workflow instances
784-
785-
786-
787-
1. In the Codefresh UI, from the sidebar, select **Promotion Workflows**.
788-
1. Click a Promotion Workflow, and then click the **Workflows** tab to see its instances.
789-
1. If needed, filter by Status, Target Environment, Product, or Application.
790-
1. To visualize steps and view detailed information, click **View Workflow Details**.
791-
792-
{% include
793-
image.html
794-
lightbox="true"
795-
file="/images/gitops-promotions/workflows/workflow-instance-details.png"
796-
url="/images/gitops-promotions/workflows/workflow-instance-details.png"
797-
alt="Detailed view of workflow execution instance"
798-
caption="Detailed view of workflow execution instance"
799-
max-width="60%"
800-
%}
801-
802-
803-
804-
### Workflow summary
805-
806-
SCREENSHOT
807-
808-
The table highlights key information you can find in the Summary tab for a workflow.
809-
810-
{: .table .table-bordered .table-hover}
811-
| Workflow Summary | Description |
812-
| -------------- | ------------------------------|
813-
| **Errors** | Displayed when the Workflow instance has at least one failed step. |
814-
| **Summary** | Namespace, memory and CPU resource usage, and execution context of the workflow.<br>If triggered by a parent workflow, displays the link to that workflow.|
815-
| **Manifests** | The version of the manifest used for the specific Workflow execution. This may not be the same version currently displayed in the Manifest tab. Useful to troubleshoot failed steps and errors in the execution instance. |
816-
| **Labels** | Labels assigned to the workflow. Useful to filter, search, organize workflow executions. <br>Examples:<br>`codefresh.io/app-name: trioapp-qa`, `codefresh.io/app-namespace: gitops`.|
817-
| **Parameters** | The inputs set/modified for the specific execution. <br>Examples:<br>`Threshold: 50`, `Nb: 100`.|
818-
| **Artifacts** | The outputs if any generated by a workflow step, and can be logs, test-reports, binaries or any other type of file. Each artifact is associated with a specific step in the workflow. For example: `main-logs: smoketests-k9ss6`.|
819-
820-
821-
822-
### Workflow actions
823-
Depending on the status of the workflow instance, you can do the following:
824-
825-
826-
827-
SCREENSHOT
828-
Remove unused or legacy workflow instances. Deleting a workflow instance removes it from the list of executions. The Promotion Workflow itself is not changed.
829-
830-
### Workflow steps
831-
Visualize the steps in the Workflow. For additional information on the step, click the step to open the pull-out panel.
832-
833-
{% include
834-
image.html
835-
lightbox="true"
836-
file="/images/gitops-promotions/workflows/workflow-step-details.png"
837-
url="/images/gitops-promotions/workflows/workflow-step-details.png"
838-
alt="Workflow instance step detailed view"
839-
caption="Workflow instance step detailed view"
840-
max-width="60%"
841-
%}
842-
843-
844-
845-
### Workflow logs
846-
793+
The following example shows an on-start hook in a Promotion Workflow that sends a Slack notification at the start of a product release or environment promotion.
847794

848795

849-
{% include
850-
image.html
851-
lightbox="true"
852-
file="/images/gitops-promotions/workflows/workflow-logs.png"
853-
url="/images/gitops-promotions/workflows/workflow-logs.png"
854-
alt="Workflow instance logs"
855-
caption="Workflow instance logs"
856-
max-width="60%"
857-
%}
858-
-->
796+
```yaml
797+
apiVersion: argoproj.io/v1alpha1
798+
kind: WorkflowTemplate
799+
metadata:
800+
name: on-start-hook
801+
annotations:
802+
codefresh.io/workflow-origin: promotion
803+
version: 0.0.1
804+
spec:
805+
arguments:
806+
parameters:
807+
- name: RELEASE_URL
808+
- name: PRODUCT_NAME
809+
- name: COMMIT_SHA
810+
- name: PROMOTION_FLOW_NAME
811+
- name: RELEASE_ID
812+
serviceAccountName: hook
813+
entrypoint: send-message
814+
templates:
815+
# Send-message template
816+
- name: send-message
817+
retryStrategy:
818+
limit: "1"
819+
retryPolicy: "Always"
820+
backoff:
821+
duration: "5s"
822+
inputs:
823+
parameters:
824+
- name: MODE
825+
value: "simple"
826+
- name: SLACK_HOOK_URL
827+
value: <put here your webhook url>
828+
- name: SLACK_TEXT
829+
value: Successfully started a release flow {{workflow.parameters.RELEASE_URL}}!
830+
container:
831+
name: main
832+
imagePullPolicy: Always
833+
image: quay.io/codefreshplugins/argo-hub-slack-send-message:0.0.2-main
834+
command:
835+
- node
836+
- /usr/src/app/index.js
837+
env:
838+
- name: MODE
839+
value: '{{ inputs.parameters.MODE }}'
840+
- name: SLACK_HOOK_URL
841+
value: '{{ inputs.parameters.SLACK_HOOK_URL }}'
842+
- name: SLACK_TEXT
843+
value: '{{ inputs.parameters.SLACK_TEXT }}'
844+
```
859845

860846

861847
## Promotion Workflows in product release views
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
title: "Service account for Promotion Workflows"
3+
description: "Understand the service account and role requirements for Promotion Workflows"
4+
group: promotions
5+
toc: true
6+
---
7+
8+
{{site.data.callout.callout_tip}}
9+
Available as part of the early access program.
10+
{{site.data.callout.end}}
11+
12+
## Service accounts & service account roles for Promotion Workflows
13+
Service accounts are essential for all types of Promotion Workflows in GitOps Cloud. These accounts provide the necessary permissions for workflows to interact with clusters and other resources during the promotion process, including when hooks are used.
14+
15+
When a GitOps Runtime is installed, GitOps Cloud automatically creates the required service account, service account role, and binding to support Promotion Workflows.
16+
17+
18+
## Default service account and service role
19+
20+
* **Service account**
21+
`cf-default-promotion-workflows-sa` with the required role and role binding.
22+
* Workflow template manifests reference this service account.
23+
* When you create a Promotion Workflow from the UI, the service account is added automatically to the YAML.
24+
* If you're creating the Promotion Workflow in Git, you must add the service account manually.
25+
26+
* **Service account role**
27+
`cf-default-promotion-workflows-role`, the default role for promotion hooks, automatically bound to the service account `cf-default-promotion-workflows-sa`.
28+
29+
* **RBAC permissions for service account role**
30+
The following Role-Based Access Control (RBAC) permissions are required to allow hooks to retrieve and update release and promotion details securely:
31+
* `GET`
32+
* `WATCH`
33+
* `PATCH`
34+
35+
36+
## Custom options for service account and role
37+
38+
If you need a role with additional permissions or a new service account, do one of the following:
39+
40+
* **Use a custom role**
41+
Create a new service role with the required permissions, and bind it to the default service account, `cf-default-promotion-workflows-sa`.
42+
43+
* **Use a custom service account**
44+
Use your own service account, and bind it to the default service role, `cf-default-promotion-workflows-role`.
45+
46+
## Example of a service account and role
47+
48+
```yaml
49+
apiVersion: v1
50+
kind: ServiceAccount
51+
metadata:
52+
name: hook
53+
annotations:
54+
argo-hub/version: '0.0.2'
55+
---
56+
apiVersion: rbac.authorization.k8s.io/v1
57+
kind: Role
58+
metadata:
59+
name: hook
60+
annotations:
61+
argo-hub/version: '0.0.2'
62+
rules:
63+
- apiGroups:
64+
- ""
65+
resources:
66+
- pods
67+
verbs:
68+
- get
69+
- watch
70+
- patch
71+
- apiGroups:
72+
- ""
73+
resources:
74+
- pods/log
75+
verbs:
76+
- get
77+
- watch
78+
- apiGroups:
79+
- argoproj.io
80+
resources:
81+
- workflowtaskresults
82+
verbs:
83+
- create
84+
- get
85+
- list
86+
- patch
87+
- watch
88+
---
89+
apiVersion: rbac.authorization.k8s.io/v1
90+
kind: RoleBinding
91+
metadata:
92+
name: hook
93+
annotations:
94+
argo-hub/version: '0.0.2'
95+
roleRef:
96+
apiGroup: rbac.authorization.k8s.io
97+
kind: Role
98+
name: hook
99+
subjects:
100+
- kind: ServiceAccount
101+
name: hook
102+
```
103+
104+
## Related articles
105+
[Configure Promotion Workflows]({{site.baseurl}}/docs/promotions/promotion-workflow/)
106+
[Configure hooks in Promotion Workflows]({{site.baseurl}}/docs/promotions/promotion-hooks/)
107+
[Configure Promotion Flows]({{site.baseurl}}/docs/promotions/promotion-flow/)

‎_docs/promotions/yaml.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ title: "YAML specs"
33
description: "YAML specifications for promotion entities"
44
group: promotions
55
redirect-from:
6-
- /docs/promotions/entities/yaml
6+
- /docs/promotions/configuration/
7+
- /docs/promotions/entities/yaml/
78
toc: true
89
---
910

‎_docs/promotions/yaml/promotion-flow-crd.md

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ toc: true
99
---
1010

1111

12-
Codefresh provides two options for defining manifests for promotion entities: Form mode and YAML mode.
12+
Codefresh provides two options for defining manifests for promotion entities: [Chart mode]({{site.baseurl}}/docs/promotions/promotion-flow/) and YAML mode.
1313

1414
If you prefer working with YAML, create the manifest using the example Promotion Flow YAML below, and the table with field descriptions.
1515

@@ -24,22 +24,27 @@ kind: PromotionFlow
2424
metadata:
2525
name: global-parallel-flow
2626
spec:
27-
properties:
28-
triggerEnvironment: dev # name of the initial environment that triggers promotion flow
29-
steps: # one or more environments across which to promote product
30-
- environment: qa # target environment
31-
dependsOn: # environment to successfully promote before triggering promotion for target
32-
- dev
27+
triggerEnvironment: dev
28+
steps:
3329
- environment: staging
3430
dependsOn:
35-
- qa
31+
- dev
3632
policy:
37-
preAction: pre-action # optional; the promotion workflow to run before the promotion action
38-
postAction: post-action # optional; the promotion workflow to run after the promotion action
39-
action: commit # required; the promotion action to execute
33+
action: commit
34+
hooks:
35+
onStart: slack-start-hook
36+
onSuccess: simple-fail
37+
onFail: jira-open-bug
4038
- environment: production
4139
dependsOn:
4240
- staging
41+
policy:
42+
action: commit
43+
hooks:
44+
onStart: slack-start-hook
45+
onSuccess: success-hook-test
46+
onFail: slack-fail-hook
47+
4348
```
4449

4550
## Promotion Flow YAML field descriptions
@@ -51,12 +56,18 @@ spec:
5156
|`spec.steps` | The step in the Promotion Flow that defines the list of target environments and their dependencies. <br>At least one target environment and dependency must be defined. | array | Required |
5257
|`spec.steps.environment` | The name of the specific target environment for which to trigger the promotion. | string | Required |
5358
|`spec.steps.environment.dependsOn`| One or more environments that must be successfully promoted before promotion can be triggered in the succeeding environments. | array | Required |
54-
|`spec.steps.policy`| The Pre-Action Workflow, Action, and Post-Action Workflow to implement for the Promotion Policy through the `action`, `preAction`, and `postAction` attributes. <br>The Action attribute is required.<br>An `policy` attribute defined here overrides global Policies that match the product/environment. See [Promotion Policy implementation logic]({{site.baseurl}}/docs/promotions/promotion-policy/#promotion-policy-implementation-logic) for information on how they are applied. | object | Optional |
55-
| `spec.steps.policy.action` | The action that should trigger the promotion in the target environment for this Promotion Policy.<br>Can be one of the following:{::nomarkdown}<ul><li><code class="highlighter-rouge">commit</code>: Executes a commit operation on the target application.</li><li><code class="highlighter-rouge">pr</code>: Executes a commit and opens a pull request for the target application.<br>Useful when you need manual approval before commit.</li><li><code class="highlighter-rouge">none</code>: Does not execute any action on the target application.<br>In this case, the Post-Action workflow must include a step that is equivalent </li></ul>{:/}| string | Required |
56-
| `spec.steps.policy.preAction` | The name of the Promotion Workflow to execute _before_ `spec.steps.policy.action`. | string | Optional |
57-
| `spec.steps.policy.postAction` | The name of the Promotion Workflow to execute _after_ `spec.steps.policy.action`. | string | Optional |
59+
|`spec.steps.environment.policy`| The Pre-Action Workflow, Action, and Post-Action Workflow to implement for the Promotion Policy through the `action`, `preAction`, and `postAction` attributes. <br>The Action attribute is required.<br>An `policy` attribute defined here overrides global Policies that match the product/environment. See [Promotion Policy implementation logic]({{site.baseurl}}/docs/promotions/promotion-policy/#promotion-policy-implementation-logic) for information on how they are applied. | object | Optional |
60+
| `spec.steps.environment.policy.preAction` | The name of the Promotion Workflow to execute _before_ `spec.steps.policy.action`. | string | Optional |
61+
| `spec.steps..environment.policy.postAction` | The name of the Promotion Workflow to execute _after_ `spec.steps.policy.action`. | string | Optional |
62+
| `spec.steps.environment.policy.action` | The action that should trigger the promotion in the target environment for this Promotion Policy.<br>Can be one of the following:{::nomarkdown}<ul><li><code class="highlighter-rouge">commit</code>: Executes a commit operation on the target application.</li><li><code class="highlighter-rouge">pr</code>: Executes a commit and opens a pull request for the target application.<br>Useful when you need manual approval before commit.</li><li><code class="highlighter-rouge">none</code>: Does not execute any action on the target application.<br>In this case, the Post-Action workflow must include a step that is equivalent </li></ul>{:/}| string | Required |
63+
|`spec.steps.environment.hooks` | The promotion hooks to run for the _environment_, and can be any of the following:{::nomarkdown}<ul><li><code class="highlighter-rouge">onStart</code>: The promotion hook to run when the promotion reaches the environment.</li><li><code class="highlighter-rouge">onSuccess</code>: The promotion hook to run when the promotion completes successfully in the environment.</li><li><code class="highlighter-rouge">onFail</code>: The promotion hook to run when the promotion fails in the environment.</li></ul>{:/}| string | Optional |
64+
|`spec.hooks` | The promotion hooks to run for the _product release_, and can be any of the following:{::nomarkdown}<ul><li><code class="highlighter-rouge">onStart</code>: The promotion hook to run when the release is initiated.</li><li><code class="highlighter-rouge">onSuccess</code>: The promotion hook to run when the release completes successfully.</li><li><code class="highlighter-rouge">onFail</code>: The promotion hook to run when the release fails.</li></ul>{:/}| string | Optional |
65+
66+
5867

5968
## Related articles
69+
[Configure Promotion Flows]({{site.baseurl}}/docs/promotions/promotion-flow/)
70+
[Configure hooks in Promotion Workflows]({{site.baseurl}}/docs/promotions/promotion-hooks/)
6071
[Product YAML]({{site.baseurl}}/docs/promotions/yaml/product-crd/)
6172
[Promotion Policy YAML]({{site.baseurl}}/docs/promotions/yaml/promotion-policy-crd/)
6273
[Promotion Template YAML]({{site.baseurl}}/docs/promotions/yaml/promotion-template-crd/)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../_docs/promotions/promotion-context-promotion-workflows.md

‎_gitops/promotions/promotion-hooks.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../_docs/promotions/promotion-hooks.md
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../_docs/promotions/service-accounts-promotion-workflows.md

‎assets/js/src/argohub-redirect-mapping.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
"/docs/products/promotion-version-properties/": "/gitops/products/promotion-version-properties/",
6666
"/docs/products/releases-in-products/": "/gitops/products/releases-in-products/",
6767
"/docs/promotions/create-promotion-sequence/": "/gitops/promotions/create-promotion-sequence/",
68-
"/docs/promotions/entities/": "/gitops/promotions/entities/",
6968
"/docs/promotions/product-promotion-props/": "/gitops/promotions/product-promotion-props/",
7069
"/docs/promotions/product-releases/": "/gitops/promotions/product-releases/",
7170
"/docs/promotions/promotion-components/": "/gitops/promotions/promotion-components/",
@@ -116,7 +115,10 @@
116115
"/docs/installation/gitops/runtime-argocd-admin-api-token/": "/gitops/gitops-runtimes/runtime-argocd-admin-api-token/",
117116
"/docs/installation/gitops/runtime-install-ingress-service-mesh-access-mode/": "/gitops/gitops-runtimes/runtime-install-ingress-service-mesh-access-mode/",
118117
"/docs/promotions/getting-started/": "/gitops/promotions/getting-started/",
118+
"/docs/promotions/promotion-hooks/": "/gitops/promotions/promotion-hooks/",
119119
"/docs/installation/gitops/runtime-troubleshooting/": "/gitops/gitops-runtimes/runtime-troubleshooting/",
120120
"/docs/products/promotion-concurrency/": "/gitops/products/promotion-concurrency/",
121+
"/docs/promotions/promotion-context-promotion-workflows/": "/gitops/promotions/promotion-context-promotion-workflows/",
122+
"/docs/promotions/service-accounts-promotion-workflows/": "/gitops/promotions/service-accounts-promotion-workflows/",
121123
"/docs/installation/gitops/runtime-install-with-new-argo-cd/": "/gitops/gitops-runtimes/runtime-install-with-new-argo-cd/"
122124
}
Loading
Loading
Loading
Loading
Loading
Loading
85.6 KB
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.