-
Notifications
You must be signed in to change notification settings - Fork 4
/
workflow-template.yaml
156 lines (150 loc) · 4.16 KB
/
workflow-template.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: ci-workflow
namespace: argo
spec:
templates:
- name: git-checkout-private
inputs:
parameters:
- name: repo
- name: revision
artifacts:
- name: source
path: /src
git:
repo: "{{inputs.parameters.repo}}"
revision: "{{inputs.parameters.revision}}"
sshPrivateKeySecret:
name: source-key
key: ssh-privatekey
container:
image: alpine/git
command: [sh, -c]
args: ["cd /src && git status && ls -l && git rev-parse --short HEAD > /tmp/git-commit"]
outputs:
artifacts:
- name: source
path: /src
parameters:
- name: tag
valueFrom:
path: /tmp/git-commit
- name: run-test
inputs:
artifacts:
- name: source
path: /src
container:
image: openjdk:8-jdk-alpine
command: [sh, -c]
args: ["cd /src && ls -a && chmod 755 gradlew && ./gradlew test && ./gradlew clean build"]
outputs:
artifacts:
- name: source
path: /src
- name: build-and-push
inputs:
artifacts:
- name: source
path: /workspace
parameters:
- name: imageUrl
- name: imageTag
- name: pathToContext
container:
image: gcr.io/kaniko-project/executor:latest
args: ["--dockerfile","Dockerfile", "--destination","{{inputs.parameters.imageUrl}}:{{inputs.parameters.imageTag}}"]
env:
- name: "GOOGLE_APPLICATION_CREDENTIALS"
value: "/secret/google.json"
volumeMounts:
- name: gcp-creds
mountPath: "/secret"
activeDeadlineSeconds: 60
- name: git-new-branch
inputs:
parameters:
- name: release
- name: repo
outputs:
artifacts:
- name: source
path: /git
container:
image: gcr.io/arctiqteam-images/git:v2.0.4
command: ["/bin/sh", "-c"]
args: ["git clone {{inputs.parameters.repo}} /git && git checkout -b {{inputs.parameters.release}}-update"]
volumeMounts:
- mountPath: "/opt/ssh"
name: ssh-deploy-creds
activeDeadlineSeconds: 60
- name: git-commit
inputs:
parameters:
- name: release
- name: author
- name: email
artifacts:
- name: source
path: /git
outputs:
artifacts:
- name: source
path: /git
container:
image: gcr.io/arctiqteam-images/git:v2.0.4
command: ["/bin/sh", "-c"]
args: ["git add * && git commit -m 'change to image {{inputs.parameters.release}}-update' && git push --set-upstream origin {{inputs.parameters.release}}-update"]
env:
- name: "GIT_AUTHOR_NAME"
value: "{{inputs.parameters.author}}"
- name: "GIT_AUTHOR_EMAIL"
value: "{{inputs.parameters.email}}"
- name: "GIT_COMMITTER_NAME"
value: "{{inputs.parameters.author}}"
- name: "GIT_COMMITTER_EMAIL"
value: "{{inputs.parameters.email}}"
volumeMounts:
- mountPath: "/opt/ssh"
name: ssh-deploy-creds
activeDeadlineSeconds: 60
- name: kustomize-image
inputs:
parameters:
- name: release
- name: imageUrl
artifacts:
- name: source
path: /git
outputs:
artifacts:
- name: source
path: /git
container:
image: gcr.io/arctiqteam-images/kustomizer:v3.3.0
command: ["/bin/sh", "-c", "chmod 666 /git/kustomization.yaml && kustomize edit set image {{inputs.parameters.imageUrl}}:{{inputs.parameters.release}}"]
workingDir: /git
activeDeadlineSeconds: 60
- name: git-pr
inputs:
artifacts:
- name: source
path: /git
container:
image: gcr.io/arctiqteam-images/git:v2.0.4
command: ["/bin/sh", "-c"]
args: ["hub pull-request --no-edit"]
env:
- name: GITHUB_USER
valueFrom:
secretKeyRef:
name: github-access
key: username
- name: GITHUB_PASSWORD
valueFrom:
secretKeyRef:
name: github-access
key: password
activeDeadlineSeconds: 60