forked from vmware-archive/concourse-pipeline-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgated-pipeline-03-shipit-enhanced.yml
189 lines (183 loc) · 4.9 KB
/
gated-pipeline-03-shipit-enhanced.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
---
resources:
- name: send-email
type: email
source:
from: YOUR-SENDER-EMAIL-GOES-HERE
- name: fly-release
type: github-release
source:
user: concourse
repository: concourse
access_token: {{github-access-token}}
jobs:
- name: Build-it
plan:
- get: fly-release
params:
globs:
- fly_linux_amd64
trigger: true
- task: do-your-build-task-here
config:
platform: linux
image_resource:
type: docker-image
source:
repository: concourse/buildroot
tag: "git"
run:
path: sh
args:
- -exc
- |
echo "Output of build job. It gets automatically triggered by any changes in the resource."
- name: Test-it
plan:
- get: fly-release
params:
globs:
- fly_linux_amd64
passed:
- Build-it
trigger: true
- task: do-your-test-task-here
config:
platform: linux
image_resource:
type: docker-image
source:
repository: concourse/buildroot
tag: "git"
run:
path: sh
args:
- -exc
- |
echo "Output of test job. It gets automatically triggered after a successful Build-it job."
- task: prep-email-text
config:
platform: linux
image_resource:
type: docker-image
source:
repository: concourse/buildroot
tag: "git"
inputs:
- name: fly-release
outputs:
- name: email-text
run:
path: sh
args:
- -exc
- |
export LATEST_GOOD_VERSION=$(cat ./fly-release/version)
echo "Version $LATEST_GOOD_VERSION is ready to ship!" > ./email-text/email-subject.txt
echo "Version $LATEST_GOOD_VERSION is ready to ship! For details, see pipeline {{ BUILD_PIPELINE_NAME }}, build {{ BUILD_NAME }}, job {{ BUILD_JOB_NAME }}." > ./email-text/email-body.txt
- put: send-email
params:
to: [YOUR-EMAIL-GOES-HERE]
subject: ./email-text/email-subject.txt
body: ./email-text/email-body.txt
- task: update-ship-it-job-name
config:
platform: linux
image_resource:
type: docker-image
source:
repository: concourse/buildroot
tag: "git"
inputs:
- name: fly-release
outputs:
- name: email-text
run:
path: sh
args:
- -exc
- |
export LATEST_GOOD_VERSION=$(cat ./fly-release/version)
mv ./fly-release/fly_linux_amd64 ./fly
chmod +x ./fly
./fly -t local login -c {{concourse-url}} -n {{concourse-team}} #-u {{concourse-username}} -p {{concourse-password}}
./fly -t local sync
./fly -t local get-pipeline -p {{concourse-pipeline-name}} > ./original-pipeline.yml
sed "s/Ship-version-.*/Ship-version-$LATEST_GOOD_VERSION/" ./original-pipeline.yml > ./updated-pipeline.yml
./fly -t local set-pipeline -p {{concourse-pipeline-name}} -c ./updated-pipeline.yml -n
- name: Ship-version-2.6.0
plan:
- get: fly-release
params:
globs:
- fly_linux_amd64
passed:
- Test-it
trigger: false
- task: do-your-shipit-task-here
config:
platform: linux
image_resource:
type: docker-image
source:
repository: concourse/buildroot
tag: "git"
run:
path: sh
args:
- -exc
- |
echo "Output of your manually triggered Ship-it task."
- name: Deploy-and-AT-it!
plan:
- get: fly-release
params:
globs:
- fly_linux_amd64
passed:
- Ship-version-2.6.0
trigger: true
- task: do-your-deploy-and-AT-tasks-here
config:
platform: linux
image_resource:
type: docker-image
source:
repository: concourse/buildroot
tag: "git"
run:
path: sh
args:
- -exc
- |
echo "Output of your Deploy and AT tasks."
- task: prep-email-text
config:
platform: linux
image_resource:
type: docker-image
source:
repository: concourse/buildroot
tag: "git"
inputs:
- name: fly-release
outputs:
- name: email-text
run:
path: sh
args:
- -exc
- |
export LATEST_GOOD_VERSION=$(cat ./fly-release/version)
echo "Version $LATEST_GOOD_VERSION deployed and tested!" > ./email-text/email-subject.txt
echo "Version $LATEST_GOOD_VERSION has been deployed and tested successfully! For details, see pipeline {{ BUILD_PIPELINE_NAME }}, build {{ BUILD_NAME }}, job {{ BUILD_JOB_NAME }}." > ./email-text/email-body.txt
- put: send-email
params:
to: [YOUR-EMAIL-GOES-HERE]
subject: ./email-text/email-subject.txt
body: ./email-text/email-body.txt
resource_types:
- name: email
type: docker-image
source:
repository: mdomke/concourse-email-resource