-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpipeline.yml
361 lines (337 loc) · 12.3 KB
/
pipeline.yml
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
---
#
# ci/pipeline.yml
#
# Pipeline structure file for a Go Project pipeline
#
# DO NOT MAKE CHANGES TO THIS FILE. Instead, modify
# ci/settings.yml and override what needs overridden.
# This uses spruce, so you have some options there.
#
# author: James Hunt <[email protected]>
# created: 2016-03-30
meta:
name: (( param "Please name your pipeline" ))
release: (( concat meta.name " Release" ))
target: (( param "Please identify the name of the target Concourse CI" ))
pipeline: (( grab meta.name ))
git:
email: (( param "Please provide the git email for automated commits" ))
name: (( param "Please provide the git name for automated commits" ))
go:
version: 1.14
module: (( concat "github.com/" meta.github.owner "/" meta.github.repo ))
cmd_module: (( grab meta.go.module ))
binary: (( grab meta.github.repo ))
force_static_binary: false
image:
name: starkandwayne/concourse-go
tag: (( grab meta.go.version ))
aws:
bucket: (( concat meta.pipeline "-pipeline" ))
region_name: us-east-1
access_key: (( param "Please set your AWS Access Key ID" ))
secret_key: (( param "Please set your AWS Secret Key ID" ))
github:
uri: (( concat "[email protected]:" meta.github.owner "/" meta.github.repo ))
owner: (( param "Please specify the name of the user / organization that owns the Github repository" ))
repo: (( param "Please specify the name of the Github repository" ))
branch: master
private_key: (( param "Please generate an SSH Deployment Key for this repo and specify it here" ))
access_token: (( param "Please generate a Personal Access Token and specify it here" ))
slack:
webhook: (( param "Please specify your Slack Incoming Webhook Integration URL" ))
notification: '(( concat ":sadpanda: " meta.pipeline " build failed!<br>URL-GOES-HERE" ))'
channel: (( param "Please specify the channel (#name) or user (@user) to send messages to" ))
username: concourse
icon: http://cl.ly/image/3e1h0H3H2s0P/concourse-logo.png
fail_moji: ":airplane_arriving:"
success_moji: ":airplane_departure:"
upset_moji: ":sad_panda:"
fail_url: '(( concat "<" meta.url "/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME| Concourse Failure! " meta.slack.upset_moji ">" ))'
url: (( param "What is the URL for the Concourse instance this pipeline is located on?" ))
groups:
- name: (( grab meta.pipeline ))
jobs:
- test
- test-pr
- rc
- shipit
- major
- minor
- bump-patch
jobs:
- name: test
public: true
serial: true
plan:
- do:
- { get: git, trigger: true }
- task: test
config:
platform: linux
image_resource:
type: docker-image
source:
repository: (( grab meta.image.name ))
tag: (( grab meta.image.tag ))
inputs:
- name: git
path: (( concat "gopath/src/" meta.go.module ))
run:
path: (( concat "./gopath/src/" meta.go.module "/ci/scripts/test" ))
args: []
params:
MODULE: (( grab meta.go.module ))
on_failure:
put: notify
params:
channel: (( grab meta.slack.channel ))
username: (( grab meta.slack.username ))
icon_url: (( grab meta.slack.icon ))
text: '(( concat meta.slack.fail_url " " meta.pipeline ": test job failed" ))'
- name: test-pr
public: true
serial: true
plan:
- do:
- { get: git-pull-requests, trigger: true, version: every }
- put: git-pull-requests
params:
path: git-pull-requests
status: pending
- task: test
config:
platform: linux
image_resource:
type: docker-image
source:
repository: (( grab meta.image.name ))
tag: (( grab meta.image.tag ))
inputs:
- name: git-pull-requests
path: (( concat "gopath/src/" meta.go.module ))
run:
path: (( concat "./gopath/src/" meta.go.module "/ci/scripts/test" ))
args: []
params:
MODULE: (( grab meta.go.module ))
on_success:
put: git-pull-requests
params:
path: git-pull-requests
status: success
on_failure:
put: git-pull-requests
params:
path: git-pull-requests
status: failure
- task: pr-success-message
config:
platform: linux
image_resource:
type: docker-image
source:
repository: (( grab meta.image.name ))
tag: (( grab meta.image.tag ))
inputs:
- { name: git-pull-requests }
outputs:
- { name: message }
run:
path: sh
args:
- -ce
- |
cd git-pull-requests
pr_url=$(git config --get pullrequest.url)
cd -
echo "<${pr_url}|Pull request passed test> Merge when ready: ${pr_url}" > message/body
on_failure:
put: notify
params:
channel: (( grab meta.slack.channel ))
username: (( grab meta.slack.username ))
icon_url: (( grab meta.slack.icon ))
text: '(( concat meta.slack.fail_url " " meta.pipeline ": test job failed" ))'
- name: rc
public: true
plan:
- do:
- in_parallel:
- { get: git, trigger: true, passed: [test] }
- { get: version, trigger: true, params: {pre: rc} }
- put: shipit-version
params: {file: version/number}
on_failure:
put: notify
params:
channel: (( grab meta.slack.channel ))
username: (( grab meta.slack.username ))
icon_url: (( grab meta.slack.icon ))
text: '(( concat meta.slack.fail_url " " meta.pipeline ": rc job failed" ))'
- name: bump-patch
public: true
plan:
- do:
- { get: version, trigger: true, params: { bump: patch, pre: rc }, passed: [shipit] } # bump rc + patch, so that subesquent version bumps can trigger a new bump-patch
- { put: version, params: { file: version/number} }
on_failure:
put: notify
params:
channel: (( grab meta.slack.channel ))
username: (( grab meta.slack.username ))
icon_url: (( grab meta.slack.icon ))
text: '(( concat meta.slack.fail_url " " meta.pipeline ": bump-patch job failed" ))'
- name: minor
public: true
plan:
- do:
- { get: version, trigger: false, params: {bump: minor} }
- { put: version, params: {file: version/number} }
on_failure:
put: notify
params:
channel: (( grab meta.slack.channel ))
username: (( grab meta.slack.username ))
icon_url: (( grab meta.slack.icon ))
text: '(( concat meta.slack.fail_url " " meta.pipeline ": minor job failed" ))'
- name: major
public: true
plan:
- do:
- { get: version, trigger: false, params: {bump: major} }
- { put: version, params: {file: version/number} }
on_failure:
put: notify
params:
channel: (( grab meta.slack.channel ))
username: (( grab meta.slack.username ))
icon_url: (( grab meta.slack.icon ))
text: '(( concat meta.slack.fail_url " " meta.pipeline ": major job failed" ))'
- name: shipit
public: true
serial: true
plan:
- do:
- in_parallel:
- { get: version, resource: shipit-version, passed: [rc], params: {bump: final} }
- { get: git, passed: [rc] }
- task: release
config:
image_resource:
type: docker-image
source:
repository: (( grab meta.image.name ))
tag: (( grab meta.image.tag ))
platform: linux
inputs:
- name: version
- name: git
path: (( concat "gopath/src/" meta.go.module ))
outputs:
- name: gh
- name: pushme
run:
path: (( concat "./gopath/src/" meta.go.module "/ci/scripts/shipit" ))
args: []
params:
BINARY: (( grab meta.go.binary ))
REPO_ROOT: (( concat "gopath/src/" meta.go.module ))
VERSION_FROM: version/number
RELEASE_NAME: (( grab meta.release ))
RELEASE_ROOT: gh
REPO_OUT: pushme
BRANCH: (( grab meta.github.branch ))
CMD_PKG: (( grab meta.go.cmd_module ))
STATIC_BINARY: (( grab meta.go.force_static_binary ))
GIT_EMAIL: (( grab meta.git.email ))
GIT_NAME: (( grab meta.git.name ))
- put: version
params: { bump: final }
- put: git
params:
rebase: true
repository: pushme/git
- put: github
params:
name: gh/name
tag: gh/tag
body: gh/notes.md
globs: [gh/artifacts/*]
- in_parallel:
- put: notify
params:
channel: (( grab meta.slack.channel ))
username: (( grab meta.slack.username ))
icon_url: (( grab meta.slack.icon ))
#I want this to actually print out the safe version, but for now.... may as well print _something_
#text_file: notifications/message
text: A new version of safe was released!
on_failure:
put: notify
params:
channel: (( grab meta.slack.channel ))
username: (( grab meta.slack.username ))
icon_url: (( grab meta.slack.icon ))
text: '(( concat meta.slack.fail_url " " meta.pipeline ": shipit job failed" ))'
resource_types:
- name: slack-notification
type: docker-image
source:
repository: cfcommunity/slack-notification-resource
- name: pull-request
type: docker-image
source:
repository: jtarchie/pr
resources:
- name: git
type: git
check_every: 60m
webhook_token: ((webhook.token))
source:
uri: (( grab meta.github.uri ))
branch: (( grab meta.github.branch ))
private_key: (( grab meta.github.private_key ))
- name: version
type: semver
source :
driver: s3
bucket: (( grab meta.aws.bucket ))
region_name: (( grab meta.aws.region_name ))
key: version
access_key_id: (( grab meta.aws.access_key ))
secret_access_key: (( grab meta.aws.secret_key ))
initial_version: (( grab meta.initial_version || "0.0.1" ))
- name: shipit-version
type: semver
source :
driver: s3
bucket: (( grab meta.aws.bucket ))
region_name: (( grab meta.aws.region_name ))
key: shipit-version
access_key_id: (( grab meta.aws.access_key ))
secret_access_key: (( grab meta.aws.secret_key ))
initial_version: (( grab meta.initial_version || "0.0.1" ))
- name: notify
check_every: 24h
type: slack-notification
source:
url: (( grab meta.slack.webhook ))
- name: github
type: github-release
check_every: 60m
webhook_token: ((webhook.token))
source:
user: (( grab meta.github.owner ))
repository: (( grab meta.github.repo ))
access_token: (( grab meta.github.access_token ))
- name: git-pull-requests
type: pull-request
check_every: 60m
webhook_token: ((webhook.token))
source:
access_token: (( grab meta.github.access_token ))
private_key: (( grab meta.github.private_key ))
repo: (( concat meta.github.owner "/" meta.github.repo ))
base: (( grab meta.github.branch ))