Skip to content

Commit 7f6366b

Browse files
committed
New Shout! Pipelines
1 parent 0270c35 commit 7f6366b

File tree

6 files changed

+404
-328
lines changed

6 files changed

+404
-328
lines changed

ci/pipeline.yml

Lines changed: 112 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ meta:
1919
pipeline: (( concat meta.name "-boshrelease" ))
2020
manifest:
2121
path: (( concat "manifests/" meta.name ".yml" ))
22-
vars: "--- {}"
23-
vars-pr: (( grab meta.manifest.vars ))
24-
operator_file_paths: "" # comma separated list relative to repo root
2522

2623
git:
2724
email: (( param "Please provide the git email for automated commits" ))
@@ -32,10 +29,10 @@ meta:
3229
tag: latest
3330

3431
aws:
35-
bucket: (( concat meta.pipeline "-pipeline" ))
32+
bucket: (( concat meta.pipeline "-pipeline" ))
3633
region_name: us-east-1
37-
access_key: (( param "Please set your AWS Access Key ID for your pipeline S3 Bucket" ))
38-
secret_key: (( param "Please set your AWS Secret Key ID for your pipeline S3 Bucket" ))
34+
access_key: (( param "Please set your AWS Access Key ID for your pipeline S3 Bucket" ))
35+
secret_key: (( param "Please set your AWS Secret Key ID for your pipeline S3 Bucket" ))
3936

4037
github:
4138
uri: (( concat "[email protected]:" meta.github.owner "/" meta.github.repo ))
@@ -50,24 +47,27 @@ meta:
5047
cacert: (( param "Please specify the BOSH Director Root CA cert" ))
5148
username: admin
5249
password: (( param "Please specify the BOSH Director admin password" ))
53-
deployment: (( concat meta.name "-testflight" ))
54-
deployment-pr: (( concat meta.name "-testflight-pr" ))
50+
deployment: (( concat meta.name "-testflight" ))
5551

56-
slack:
57-
webhook: (( param "Please specify your Slack Incoming Webhook Integration URL" ))
58-
success_moji: ":airplane_departure:"
59-
fail_moji: ":airplane_arriving:"
60-
upset_moji: ":sad_panda:"
61-
channel: (( param "Please specify the channel (#name) or user (@user) to send messages to" ))
62-
username: concourse
63-
icon: http://cl.ly/image/3e1h0H3H2s0P/concourse-logo.png
64-
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 ">" ))'
52+
shout:
53+
topic: (( concat meta.name "-pipeline" ))
54+
url: (( param "Please specify the Shout! endpoint" ))
55+
username: (( param "Please specify the Shout! operations username" ))
56+
password: (( param "Please specify the Shout! operations password" ))
57+
58+
metadata:
59+
build-team-name: $BUILD_TEAM_NAME
60+
build-job-name: $BUILD_JOB_NAME
61+
build-pipeline-name: $BUILD_PIPELINE_NAME
62+
63+
links:
64+
pipeline: (( concat meta.url "/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME" ))
65+
build: (( concat meta.shout.links.pipeline "/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME" ))
6566

6667
groups:
6768
- name: (( grab meta.pipeline ))
6869
jobs:
6970
- testflight
70-
- testflight-pr
7171
- rc
7272
- shipit
7373
- major
@@ -110,71 +110,30 @@ jobs:
110110
AWS_ACCESS_KEY: (( grab meta.aws.access_key ))
111111
AWS_SECRET_KEY: (( grab meta.aws.secret_key ))
112112
MANIFEST_PATH: (( grab meta.manifest.path ))
113-
MANIFEST_VARS: (( grab meta.manifest.vars ))
114-
MANIFEST_OP_PATHS: (( grab meta.manifest.operator_file_paths ))
113+
on_success:
114+
put: notify
115+
params:
116+
topic: (( concat meta.shout.topic "-$BUILD_JOB_NAME" ))
117+
message: tests job '$BUILD_JOB_NAME' succeeded.
118+
ok: yes
119+
link: (( grab meta.shout.links.build ))
115120
on_failure:
116121
put: notify
117122
params:
118-
channel: (( grab meta.slack.channel ))
119-
username: (( grab meta.slack.username ))
120-
icon_url: (( grab meta.slack.icon ))
121-
text: '(( concat meta.slack.fail_url " " meta.pipeline ": testflight job failed" ))'
123+
topic: (( concat meta.shout.topic "-$BUILD_JOB_NAME" ))
124+
message: tests job '$BUILD_JOB_NAME' failed.
125+
ok: no
126+
link: (( grab meta.shout.links.build ))
122127

123-
- name: testflight-pr
128+
- name: rc
124129
public: true
125130
serial: true
126131
plan:
127-
- name: main
128-
do:
129-
- name: get
130-
aggregate:
131-
- { get: git-pull-requests, trigger: true, version: every }
132-
- name: pending-status
133-
put: git-pull-requests
134-
params:
135-
path: git-pull-requests
136-
status: pending
137-
- name: testflights
138-
aggregate:
139-
- name: testflight
140-
task: testflight
141-
config:
142-
platform: linux
143-
image_resource:
144-
type: docker-image
145-
source:
146-
repository: (( grab meta.image.name ))
147-
tag: (( grab meta.image.tag ))
148-
inputs:
149-
- { name: git-pull-requests }
150-
run:
151-
path: ./git-pull-requests/ci/scripts/testflight
152-
args: []
153-
params:
154-
REPO_ROOT: git-pull-requests
155-
BOSH_ENVIRONMENT: (( grab meta.bosh-lite.target ))
156-
BOSH_CA_CERT: (( grab meta.bosh-lite.cacert ))
157-
BOSH_CLIENT: (( grab meta.bosh-lite.username ))
158-
BOSH_CLIENT_SECRET: (( grab meta.bosh-lite.password ))
159-
BOSH_DEPLOYMENT: (( grab meta.bosh-lite.deployment-pr ))
160-
TEST_ERRANDS: (( grab meta.test-errands || meta.test-errand || ~ ))
161-
AWS_ACCESS_KEY: (( grab meta.aws.access_key ))
162-
AWS_SECRET_KEY: (( grab meta.aws.secret_key ))
163-
MANIFEST_PATH: (( grab meta.manifest.path ))
164-
MANIFEST_VARS: (( grab meta.manifest.vars-pr ))
165-
MANIFEST_OP_PATHS: (( grab meta.manifest.operator_file_paths ))
166-
on_success:
167-
put: git-pull-requests
168-
params:
169-
path: git-pull-requests
170-
status: success
171-
on_failure:
172-
put: git-pull-requests
173-
params:
174-
path: git-pull-requests
175-
status: failure
176-
- name: pr-success-message
177-
task: pr-success-message
132+
- do:
133+
- aggregate:
134+
- { get: git, trigger: true, passed: [testflight] }
135+
- { get: version, trigger: true, params: {pre: rc} }
136+
- task: release-notes
178137
config:
179138
platform: linux
180139
image_resource:
@@ -183,70 +142,84 @@ jobs:
183142
repository: (( grab meta.image.name ))
184143
tag: (( grab meta.image.tag ))
185144
inputs:
186-
- { name: git-pull-requests }
187-
outputs:
188-
- { name: message }
145+
- { name: git }
189146
run:
190147
path: sh
191148
args:
192149
- -ce
193150
- |
194-
cd git-pull-requests
195-
pr_url=$(git config --get pullrequest.url)
196-
cd -
197-
echo "<${pr_url}|Pull request passed testflight> Merge when ready: ${pr_url}" > message/body
151+
cd git
152+
if [ -f ci/release_notes.md ]; then
153+
echo "###### RELEASE NOTES ###############"
154+
echo
155+
cat ci/release_notes.md
156+
echo
157+
echo "########################################"
158+
echo
159+
else
160+
echo "NO RELEASE NOTES HAVE BEEN WRITTEN"
161+
echo "You *might* want to do that before"
162+
echo "hitting (+) on that shipit job..."
163+
echo
164+
fi
165+
- put: version
166+
params: {file: version/number}
198167
on_success:
199168
put: notify
200169
params:
201-
channel: (( grab meta.slack.channel ))
202-
username: (( grab meta.slack.username ))
203-
icon_url: (( grab meta.slack.icon ))
204-
text_file: message/body
205-
206-
- name: rc
207-
public: true
208-
plan:
209-
- do:
210-
- aggregate:
211-
- { get: git, trigger: true, passed: [testflight] }
212-
- { get: version, trigger: true, params: {pre: rc} }
213-
- put: version
214-
params: {file: version/number}
170+
topic: (( concat meta.shout.topic "-$BUILD_JOB_NAME" ))
171+
message: release candidate job 'rc' succeeded.
172+
ok: yes
173+
link: (( grab meta.shout.links.build ))
215174
on_failure:
216175
put: notify
217176
params:
218-
channel: (( grab meta.slack.channel ))
219-
username: (( grab meta.slack.username ))
220-
icon_url: (( grab meta.slack.icon ))
221-
text: '(( concat meta.slack.fail_url " " meta.pipeline ": rc job failed" ))'
177+
topic: (( concat meta.shout.topic "-$BUILD_JOB_NAME" ))
178+
message: release candidate job 'rc' failed (which is unusual).
179+
ok: no
180+
link: (( grab meta.shout.links.build ))
222181

223182
- name: minor
224183
public: true
225184
plan:
226185
- do:
227186
- { get: version, trigger: false, params: {bump: minor} }
228187
- { put: version, params: {file: version/number} }
188+
on_success:
189+
put: notify
190+
params:
191+
topic: (( concat meta.shout.topic "-$BUILD_JOB_NAME" ))
192+
message: minor version bump job 'minor' succeeded.
193+
ok: yes
194+
link: (( grab meta.shout.links.build ))
229195
on_failure:
230196
put: notify
231197
params:
232-
channel: (( grab meta.slack.channel ))
233-
username: (( grab meta.slack.username ))
234-
icon_url: (( grab meta.slack.icon ))
235-
text: '(( concat meta.slack.fail_url " " meta.pipeline ": minor job failed" ))'
198+
topic: (( concat meta.shout.topic "-$BUILD_JOB_NAME" ))
199+
message: minor version bump job 'minor' failed (which is unusual).
200+
ok: no
201+
link: (( grab meta.shout.links.build ))
236202

237203
- name: major
238204
public: true
239205
plan:
240206
- do:
241207
- { get: version, trigger: false, params: {bump: major} }
242208
- { put: version, params: {file: version/number} }
209+
on_success:
210+
put: notify
211+
params:
212+
topic: (( concat meta.shout.topic "-$BUILD_JOB_NAME" ))
213+
message: major version bump job '$BUILD_JOB_NAME' succeeded.
214+
ok: no
215+
link: (( grab meta.shout.links.build ))
243216
on_failure:
244217
put: notify
245218
params:
246-
channel: (( grab meta.slack.channel ))
247-
username: (( grab meta.slack.username ))
248-
icon_url: (( grab meta.slack.icon ))
249-
text: '(( concat meta.slack.fail_url " " meta.pipeline ": major job failed" ))'
219+
topic: (( concat meta.shout.topic "-$BUILD_JOB_NAME" ))
220+
message: major version bump job '$BUILD_JOB_NAME' failed (which is unusual).
221+
ok: no
222+
link: (( grab meta.shout.links.build ))
250223

251224
- name: shipit
252225
public: true
@@ -277,17 +250,16 @@ jobs:
277250
path: ./git/ci/scripts/shipit
278251
args: []
279252
params:
280-
REPO_ROOT: git
281-
VERSION_FROM: version/number
282-
RELEASE_ROOT: gh
283-
REPO_OUT: pushme
284-
NOTIFICATION_OUT: notifications
285-
BRANCH: (( grab meta.github.branch ))
286-
GITHUB_OWNER: (( grab meta.github.owner ))
253+
REPO_ROOT: git
254+
VERSION_FROM: version/number
255+
RELEASE_ROOT: gh
256+
REPO_OUT: pushme
257+
BRANCH: (( grab meta.github.branch ))
258+
GITHUB_OWNER: (( grab meta.github.owner ))
287259
GIT_EMAIL: (( grab meta.git.email ))
288260
GIT_NAME: (( grab meta.git.name ))
289-
AWS_ACCESS_KEY: (( grab meta.aws.access_key ))
290-
AWS_SECRET_KEY: (( grab meta.aws.secret_key ))
261+
AWS_ACCESS_KEY: (( grab meta.aws.access_key ))
262+
AWS_SECRET_KEY: (( grab meta.aws.secret_key ))
291263

292264
- name: upload-git
293265
put: git
@@ -313,28 +285,30 @@ jobs:
313285
aggregate:
314286
- put: notify
315287
params:
316-
channel: (( grab meta.slack.channel ))
317-
username: (( grab meta.slack.username ))
318-
icon_url: (( grab meta.slack.icon ))
319-
text_file: notifications/message
288+
method: announce
289+
file: notifications/message
290+
link: (( concat meta.github.uri "/releases" ))
291+
292+
on_success:
293+
put: notify
294+
params:
295+
topic: (( concat meta.shout.topic "-$BUILD_JOB_NAME" ))
296+
message: release job '$BUILD_JOB_NAME' succeeded.
297+
ok: yes
298+
link: (( grab meta.shout.links.build ))
320299
on_failure:
321300
put: notify
322301
params:
323-
channel: (( grab meta.slack.channel ))
324-
username: (( grab meta.slack.username ))
325-
icon_url: (( grab meta.slack.icon ))
326-
text: '(( concat meta.slack.fail_url " " meta.pipeline ": shipit job failed" ))'
302+
topic: (( concat meta.shout.topic "-$BUILD_JOB_NAME" ))
303+
message: release job '$BUILD_JOB_NAME' failed.
304+
ok: no
305+
link: (( grab meta.shout.links.build ))
327306

328307
resource_types:
329-
- name: slack-notification
330-
type: docker-image
331-
source:
332-
repository: cfcommunity/slack-notification-resource
333-
334-
- name: pull-request
308+
- name: shout-notification
335309
type: docker-image
336310
source:
337-
repository: jtarchie/pr
311+
repository: huntprod/shout-resource
338312

339313
resources:
340314
- name: git
@@ -344,14 +318,6 @@ resources:
344318
branch: (( grab meta.github.branch ))
345319
private_key: (( grab meta.github.private_key ))
346320

347-
- name: git-pull-requests
348-
type: pull-request
349-
source:
350-
access_token: (( grab meta.github.access_token ))
351-
private_key: (( grab meta.github.private_key ))
352-
repo: (( concat meta.github.owner "/" meta.github.repo ))
353-
base: (( grab meta.github.branch ))
354-
355321
- name: version
356322
type: semver
357323
source :
@@ -364,9 +330,12 @@ resources:
364330
initial_version: (( grab meta.initial_version || "0.0.1" ))
365331

366332
- name: notify
367-
type: slack-notification
333+
type: shout-notification
368334
source:
369-
url: (( grab meta.slack.webhook ))
335+
topic: (( grab meta.shout.topic ))
336+
url: (( grab meta.shout.url ))
337+
username: (( grab meta.shout.username ))
338+
password: (( grab meta.shout.password ))
370339

371340
- name: github
372341
type: github-release

ci/repipe

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#
88
# author: James Hunt <[email protected]>
99
# Dennis Bell <[email protected]>
10-
# created: 2016-03-04
1110

1211
need_command() {
1312
local cmd=${1:?need_command() - no command name given}
@@ -63,6 +62,13 @@ if [[ -z ${TARGET} ]]; then
6362
exit 1
6463
fi
6564

65+
EXPOSED=$(spruce json .deploy.yml | jq -r '.meta.exposed // false')
66+
EXPOSE=expose
67+
if [[ ${EXPOSED} == "true" ]]; then
68+
EXPOSE=hide
69+
fi
70+
6671
set +x
67-
fly --target ${TARGET} set-pipeline --pipeline ${PIPELINE} --config .deploy.yml
68-
fly --target ${TARGET} unpause-pipeline --pipeline ${PIPELINE}
72+
fly --target ${TARGET} set-pipeline --pipeline ${PIPELINE} --config .deploy.yml
73+
fly --target ${TARGET} unpause-pipeline --pipeline ${PIPELINE}
74+
fly --target ${TARGET} ${EXPOSE}-pipeline --pipeline ${PIPELINE}

0 commit comments

Comments
 (0)