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
Copy file name to clipboardExpand all lines: _docs/promotions/promotion-hooks.md
+22-7Lines changed: 22 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,9 @@ toc: true
6
6
---
7
7
8
8
9
-
##About promotionhooks
9
+
##Promotionhooks overview
10
10
11
-
Promotion hooks in GitOps Cloud are specialized Promotion Workflows that run at key stages of a product release. A product release is created when a Promotion Flow is triggered, either manually or automatically.
11
+
Promotion hooks in GitOps Cloud are specialized Promotion Workflows that run at key stages of a product release to provide information on the release and its environments. A product release is created when a Promotion Flow is triggered, either manually or automatically.
12
12
13
13
{% include
14
14
image.html
@@ -36,7 +36,7 @@ Promotion hooks can run at different stages of a product release:
36
36
***On success**: When the promotion completes successfully in an environment
37
37
***On failure**: When the promotion fails in an environment
38
38
39
-
See[Assigning promotion hooks in Promotion Flows](#assigning-promotion-hooks-in-promotion-flows).
39
+
See[Assigning promotion hooks in Promotion Flows](#assigning-promotion-hooks-in-promotion-flows). For the YAML specifications of promotion hooks when assigned, see[Promotion Flow YAML]({{site.baseurl}}/docs/promotions/yaml/promotion-flow-crd/).
40
40
41
41
#####Use cases for promotion hooks
42
42
* Auditing and visibility
@@ -48,6 +48,9 @@ See [Assigning promotion hooks in Promotion Flows](#assigning-promotion-hooks-in
48
48
* Integration with external tools
49
49
Automate updates to ticketing systems such as Jira, or observability platforms.
50
50
51
+
* Approvals from external systems
52
+
Handle approvals required from external systems such as ServiceNow by pausing the promotion through a promotion hook when a PR pause is not feasible.
53
+
51
54
Explore examples in[Codefresh Hub for Argo](https://codefresh.io/argohub/){:target="\_blank"}.
52
55
53
56
#####Arguments in promotion hooks
@@ -57,7 +60,8 @@ A default set of arguments are available to all Promotion Workflows with hooks.
57
60
58
61
The table lists key differences between Promotion Workflows containing hooks and Promotion (Pre- and Post-Action) Workflows.
59
62
60
-
|**Feature**|**Promotion Hooks in Workflows**|**Pre- and Post-Action Workflows**|
63
+
||**Promotion Workflows**|
64
+
|**Feature**|**Promotion Hook Workflows**|**Pre- and Post-Action Workflows**|
|**Purpose**| Provide information on the release.| Provide information on promoted changes in applications within an environment.|
63
67
|**Execution**| Run at release start, end (success, failure), or per environment (start, success, failure).| Run for each application in an environment before and after promotion.|
@@ -260,15 +264,26 @@ spec:
260
264
261
265
## Assigning promotion hooks in Promotion Flows
262
266
263
-
Assign Promotion Workflows with promotion hooksin the Promotion Flow for the release or environments:
267
+
Assign Promotion Workflows with promotion hooksto the Promotion Flow for the release or for one or more environments:
264
268
* Release-level hooks run before the trigger environment and after the final target environment.
265
269
* Environment-level hooks run on entry to or exit from each environment.
266
270
* Multiple hooks can run based the stage in the product release they are configured. Promotion failure for an environment will run both On Fail hooks if configured the environment and for the release.
267
271
272
+
You can also define them in the YAML manifest, as described in [Promotion Flow YAML]({{site.baseurl}}/docs/promotions/yaml/promotion-flow-crd/).
Copy file name to clipboardExpand all lines: _docs/promotions/yaml/promotion-flow-crd.md
+26-15Lines changed: 26 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ toc: true
9
9
---
10
10
11
11
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.
13
13
14
14
If you prefer working with YAML, create the manifest using the example Promotion Flow YAML below, and the table with field descriptions.
15
15
@@ -24,22 +24,27 @@ kind: PromotionFlow
24
24
metadata:
25
25
name:global-parallel-flow
26
26
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:
33
29
-environment:staging
34
30
dependsOn:
35
-
-qa
31
+
-dev
36
32
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
40
38
-environment:production
41
39
dependsOn:
42
40
-staging
41
+
policy:
42
+
action:commit
43
+
hooks:
44
+
onStart:slack-start-hook
45
+
onSuccess:success-hook-test
46
+
onFail:slack-fail-hook
47
+
43
48
```
44
49
45
50
##Promotion Flow YAML field descriptions
@@ -51,12 +56,18 @@ spec:
51
56
|`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|
52
57
|`spec.steps.environment`| The name of the specific target environment for which to trigger the promotion.| string| Required|
53
58
|`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><codeclass="highlighter-rouge">commit</code>: Executes a commit operation on the target application.</li><li><codeclass="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><codeclass="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><codeclass="highlighter-rouge">onStart</code>: The promotion hook to run when the promotion reaches the environment.</li><li><codeclass="highlighter-rouge">onSuccess</code>: The promotion hook to run when the promotion completes successfully in the environment.</li><li><codeclass="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><codeclass="highlighter-rouge">onStart</code>: The promotion hook to run when the release is initiated.</li><li><codeclass="highlighter-rouge">onSuccess</code>: The promotion hook to run when the release completes successfully.</li><li><codeclass="highlighter-rouge">onFail</code>: The promotion hook to run when the release fails.</li></ul>{:/}| string| Optional|