Skip to content

Commit 2fddfd9

Browse files
feat: post-promotion-starter 0.0.2 (#549)
1 parent f683a38 commit 2fddfd9

File tree

6 files changed

+196
-1
lines changed

6 files changed

+196
-1
lines changed

examples/post-promotion-starter/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## v0.0.2 (16.09.2024)
4+
5+
### post-promotion-starter
6+
7+
Update parameters and add service account name
8+
9+
310
## v0.0.1 (12.05.2024)
411

512
### post-promotion-starter

examples/post-promotion-starter/versions/0.0.1/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
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.
66
## Templates
77

8-
1. [post-promotion-starter](https://github.com/codefresh-io/argo-hub/blob/main/examples/post-promotion-starter/versions/0.0.1/docs/post-promotion-starter.md)
8+
1. [post-promotion-starter](https://github.com/codefresh-io/argo-hub/blob/main/examples/post-promotion-starter/versions/0.0.1/docs/echo.md)
99

1010
## Security
1111

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Post Promotion Starter
2+
3+
## Summary
4+
5+
This Workflow Template is an example of a post-promotion workflow that uses a script template to display application details, and commit information, taking these parameters from the promotion flow process.
6+
## Templates
7+
8+
1. [post-promotion-starter](https://github.com/codefresh-io/argo-hub/blob/main/examples/post-promotion-starter/versions/0.0.2/docs/echo.md)
9+
10+
## Security
11+
12+
Minimal required permissions
13+
14+
[Full rbac permissions list](https://github.com/codefresh-io/argo-hub/blob/main/examples/post-promotion-starter/versions/0.0.2/rbac.yaml)
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Post Promotion Starter
2+
3+
## Summary
4+
This Workflow Template is an example of a post-promotion workflow that uses a script template to display application details, and commit information, taking these parameters from the promotion flow process.
5+
6+
7+
## Inputs/Outputs
8+
9+
#### Parameters
10+
* APP_NAMESPACE
11+
* APP_NAME
12+
* REPO_URL
13+
* BRANCH
14+
* PATH
15+
* COMMIT_SHA
16+
* COMMIT_MESSAGE
17+
* COMMIT_AUTHOR
18+
* COMMIT_DATE
19+
20+
### Outputs
21+
no outputs
22+
23+
## Examples
24+
25+
### task Example
26+
```
27+
apiVersion: argoproj.io/v1alpha1
28+
kind: Workflow
29+
metadata:
30+
generateName: post-promotion-starter
31+
spec:
32+
entrypoint: main
33+
volumes:
34+
templates:
35+
- name: main
36+
dag:
37+
tasks:
38+
- name: post-promotion-starter
39+
templateRef:
40+
name: argo-hub.post-promotion-starter.0.0.2
41+
template: post-promotion-starter
42+
arguments:
43+
parameters:
44+
- name: APP_NAMESPACE
45+
value: 'staging
46+
- name: APP_NAME
47+
value: 'my-app'
48+
- name: REPO_URL
49+
value: 'my-repo-url'
50+
- name: BRANCH
51+
value: 'main'
52+
- name: PATH
53+
value: 'path/to/app'
54+
- name: COMMIT_SHA
55+
value: '123456'
56+
- name: COMMIT_MESSAGE
57+
value: 'Initial commit'
58+
- name: COMMIT_AUTHOR
59+
value: 'John Doe'
60+
- name: COMMIT_DATE
61+
value: '2023-12-27T03:00:00Z'
62+
63+
```
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: argo-hub.post-promotion-starter.0.0.2
5+
annotations:
6+
argo-hub/version: '0.0.2'
7+
---
8+
apiVersion: rbac.authorization.k8s.io/v1
9+
kind: Role
10+
metadata:
11+
name: argo-hub.post-promotion-starter.0.0.2
12+
annotations:
13+
argo-hub/version: '0.0.2'
14+
rules:
15+
- apiGroups:
16+
- ""
17+
resources:
18+
- pods
19+
verbs:
20+
- get
21+
- watch
22+
- patch
23+
- apiGroups:
24+
- ""
25+
resources:
26+
- pods/log
27+
verbs:
28+
- get
29+
- watch
30+
---
31+
apiVersion: rbac.authorization.k8s.io/v1
32+
kind: RoleBinding
33+
metadata:
34+
name: argo-hub.post-promotion-starter.0.0.2
35+
annotations:
36+
argo-hub/version: '0.0.2'
37+
roleRef:
38+
apiGroup: rbac.authorization.k8s.io
39+
kind: Role
40+
name: argo-hub.post-promotion-starter.0.0.2
41+
subjects:
42+
- kind: ServiceAccount
43+
name: argo-hub.post-promotion-starter.0.0.2
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# DO NOT REMOVE the following attributes:
2+
# annotations.codefresh.io/workflow-origin (identifies type of Workflow Template as Promotion Workflow)
3+
# annotations.version (identifies version of Promotion Workflow used)
4+
apiVersion: argoproj.io/v1alpha1
5+
kind: WorkflowTemplate
6+
metadata:
7+
name: post-action
8+
annotations:
9+
codefresh.io/workflow-origin: promotion
10+
version: 0.0.2
11+
argo-hub/version: '0.0.2'
12+
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.'
13+
argo-hub/categories: 'promotion example workflow'
14+
argo-hub/license: 'MIT'
15+
argo-hub/owner_name: 'Eti Zaguri'
16+
argo-hub/owner_email: '[email protected]'
17+
argo-hub/owner_avatar: 'https://avatars.githubusercontent.com/u/85868206'
18+
argo-hub/owner_url: 'https://github.com/eti-codefresh'
19+
argo-hub/icon_url: "https://cdn.jsdelivr.net/gh/codefresh-io/argo-hub@main/examples/post-promotion-starter/assets/icon.svg"
20+
argo-hub/icon_background: "#f4f4f4"
21+
spec:
22+
arguments:
23+
parameters:
24+
- name: APP_NAMESPACE
25+
- name: APP_NAME
26+
- name: REPO_URL
27+
- name: BRANCH
28+
- name: PATH
29+
- name: COMMIT_SHA
30+
value: ""
31+
- name: COMMIT_MESSAGE
32+
value: ""
33+
- name: COMMIT_AUTHOR
34+
value: ""
35+
- name: COMMIT_DATE
36+
value: ""
37+
# Before using this template make sure to apply rbac to your runtime cluster
38+
# https://github.com/codefresh-io/argo-hub/blob/main/examples/post-promotion-starter/versions/0.0.2/rbac.yaml
39+
serviceAccountName: argo-hub.post-promotion-starter.0.0.2
40+
entrypoint: echo
41+
templates:
42+
- name: echo
43+
metadata:
44+
annotations:
45+
argo-hub-template/description: 'Echo the commit parameters and argo cd host from the promotion flow process'
46+
argo-hub-template/icon_url: "https://cdn.jsdelivr.net/gh/codefresh-io/argo-hub@main/examples/post-promotion-starter/assets/icon.svg"
47+
argo-hub-template/icon_background: "#f4f4f4"
48+
script:
49+
image: alpine
50+
command:
51+
- sh
52+
source: |
53+
echo "syncing {{workflow.parameters.APP_NAMESPACE}}/{{workflow.parameters.APP_NAME}} from {{workflow.parameters.REPO_URL}} branch {{workflow.parameters.BRANCH}} path {{workflow.parameters.PATH}}"
54+
if [[ -n "{{workflow.parameters.COMMIT_SHA}}" ]]; then
55+
echo "commit SHA: {{workflow.parameters.COMMIT_SHA}}"
56+
fi
57+
58+
if [[ -n "{{workflow.parameters.COMMIT_AUTHOR}}" ]]; then
59+
echo "commit author: {{workflow.parameters.COMMIT_AUTHOR}}"
60+
fi
61+
62+
if [[ -n "{{workflow.parameters.COMMIT_MESSAGE}}" ]]; then
63+
echo "commit message: {{workflow.parameters.COMMIT_MESSAGE}}"
64+
fi
65+
66+
if [[ -n "{{workflow.parameters.COMMIT_DATE}}" ]]; then
67+
echo "commit date: {{workflow.parameters.COMMIT_DATE}}"
68+
fi

0 commit comments

Comments
 (0)