-
Notifications
You must be signed in to change notification settings - Fork 6
/
post-action.yaml
68 lines (65 loc) · 2.95 KB
/
post-action.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# DO NOT REMOVE the following attributes:
# annotations.codefresh.io/workflow-origin (identifies type of Workflow Template as Promotion Workflow)
# annotations.version (identifies version of Promotion Workflow used)
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: post-action
annotations:
codefresh.io/workflow-origin: promotion
version: 0.0.1
argo-hub/version: '0.0.1'
argo-hub/description: 'This Workflow Template is an example of a post-promotion workflow that uses a script template to display application details, commit information, and the Argo CD host, taking these parameters from the promotion flow process.'
argo-hub/categories: 'promotion example workflow'
argo-hub/license: 'MIT'
argo-hub/owner_name: 'Eti Zaguri'
argo-hub/owner_email: '[email protected]'
argo-hub/owner_avatar: 'https://avatars.githubusercontent.com/u/85868206'
argo-hub/owner_url: 'https://github.com/eti-codefresh'
argo-hub/icon_url: "https://cdn.jsdelivr.net/gh/codefresh-io/argo-hub@main/examples/post-promotion-starter/assets/icon.svg"
argo-hub/icon_background: "#f4f4f4"
spec:
arguments:
parameters:
- name: APP_NAMESPACE
- name: APP_NAME
- name: REPO_URL
- name: BRANCH
- name: PATH
- name: COMMIT_SHA
value: ""
- name: COMMIT_MESSAGE
value: ""
- name: COMMIT_AUTHOR
value: ""
- name: COMMIT_DATE
value: ""
# Before using this template make sure to apply rbac to your runtime cluster
# https://github.com/codefresh-io/argo-hub/blob/main/examples/post-promotion-starter/versions/0.0.1/rbac.yaml
serviceAccountName: argo-hub.post-promotion-starter.0.0.1
entrypoint: echo
templates:
- name: echo
metadata:
annotations:
argo-hub-template/description: 'Echo the commit parameters and argo cd host from the promotion flow process'
argo-hub-template/icon_url: "https://cdn.jsdelivr.net/gh/codefresh-io/argo-hub@main/examples/post-promotion-starter/assets/icon.svg"
argo-hub-template/icon_background: "#f4f4f4"
script:
image: alpine
command:
- sh
source: |
echo "syncing {{workflow.parameters.APP_NAMESPACE}}/{{workflow.parameters.APP_NAME}} from {{workflow.parameters.REPO_URL}} branch {{workflow.parameters.BRANCH}} path {{workflow.parameters.PATH}}"
if [[ -n "{{workflow.parameters.COMMIT_SHA}}" ]]; then
echo "commit SHA: {{workflow.parameters.COMMIT_SHA}}"
fi
if [[ -n "{{workflow.parameters.COMMIT_AUTHOR}}" ]]; then
echo "commit author: {{workflow.parameters.COMMIT_AUTHOR}}"
fi
if [[ -n "{{workflow.parameters.COMMIT_MESSAGE}}" ]]; then
echo "commit message: {{workflow.parameters.COMMIT_MESSAGE}}"
fi
if [[ -n "{{workflow.parameters.COMMIT_DATE}}" ]]; then
echo "commit date: {{workflow.parameters.COMMIT_DATE}}"
fi