-
Notifications
You must be signed in to change notification settings - Fork 3
/
.pipeline.yml
256 lines (254 loc) · 6.84 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
# fly -tee sp -p halfpipe-cli -c .pipeline.yml
groups: []
resources:
- name: artifactory-linux
type: artifactory
check_every: 24h
source:
endpoint: https://springernature.jfrog.io/springernature
password: ((artifactory.password))
regex: halfpipe_linux_(?<version>.*)
repository: /halfpipe
username: ((artifactory.username))
- name: halfpipe
type: git
check_every: 10m
source:
branch: main
private_key: ((halfpipe-github.private_key))
uri: [email protected]:springernature/halfpipe.git
- name: version
type: semver
check_every: 24h
source:
branch: version
driver: git
file: version
private_key: ((halfpipe-github.private_key))
uri: [email protected]:springernature/halfpipe.git
- name: artifactory-darwin
type: artifactory
check_every: 24h
source:
endpoint: https://springernature.jfrog.io/springernature
password: ((artifactory.password))
regex: halfpipe_darwin_(?<version>.*)
repository: /halfpipe
username: ((artifactory.username))
- name: artifactory-windows
type: artifactory
check_every: 24h
source:
endpoint: https://springernature.jfrog.io/springernature
password: ((artifactory.password))
regex: halfpipe_windows_(?<version>.*).exe
repository: /halfpipe
username: ((artifactory.username))
- name: github-statuses
type: halfpipe-github-statuses-resource
check_every: 24h
source:
access_token: ((halfpipe-github.statuses-token))
repo: springernature/halfpipe
path: halfpipe
- name: release
type: github-release-latest
source:
access_token: ((github-halfpipe-io-user.repo_pat))
owner: springernature
repository: halfpipe
resource_types:
- name: artifactory
type: docker-image
check_every: 24h
source:
repository: pivotalservices/artifactory-resource
- name: github-release-latest
type: registry-image
source:
repository: concourse/github-release-resource
- name: halfpipe-github-statuses-resource
type: registry-image
check_every: 24h
source:
password: ((halfpipe-gcr.private_key))
repository: eu.gcr.io/halfpipe-io/engineering-enablement/github-status-resource
username: _json_key
jobs:
- name: Test
serial: true
on_failure:
put: github-statuses
timeout: 1m
params:
state: failure
on_success:
put: github-statuses
timeout: 1m
params:
state: success
plan:
- get: halfpipe
trigger: true
- put: github-statuses
timeout: 1m
params:
state: pending
- task: Test
config:
platform: linux
image_resource:
type: docker-image
source:
repository: golang
tag: "1.23"
run:
path: /bin/bash
args:
- -ec
- |
export GOMODCACHE=/var/halfpipe/cache/gomodcache
export HALFPIPE_SKIP_COVERAGE_TESTS=true
cd halfpipe
./build.sh ci
echo timing build ...
time ./build.sh > /dev/null
inputs:
- name: halfpipe
caches:
- path: ../../../var/halfpipe/cache
- name: Bump Major
plan:
- put: version
params:
bump: major
- name: Bump Minor
plan:
- put: version
params:
bump: minor
- name: Bump Patch
plan:
- put: version
params:
bump: patch
- name: Release
disable_manual_trigger: true
plan:
- in_parallel:
- get: halfpipe
passed:
- Test
- get: version
trigger: true
- task: Build
config:
platform: linux
image_resource:
type: docker-image
source:
repository: golang
tag: "1.23"
run:
path: /bin/sh
args:
- -ec
- |
export GOMODCACHE=/var/halfpipe/cache/gomodcache
export VERSION="$(cat version/version)"
export LDFLAGS="-X github.com/springernature/halfpipe/config.Version=${VERSION}"
export CGO_ENABLED=0
cd halfpipe
GOOS=darwin GOARCH=amd64 go build -o ../binaries/halfpipe_darwin_x86_$VERSION -ldflags "${LDFLAGS}" cmd/halfpipe.go
GOOS=darwin GOARCH=arm64 go build -o ../binaries/halfpipe_darwin_arm_$VERSION -ldflags "${LDFLAGS}" cmd/halfpipe.go
GOOS=linux GOARCH=amd64 go build -o ../binaries/halfpipe_linux_$VERSION -ldflags "${LDFLAGS}" cmd/halfpipe.go
GOOS=windows GOARCH=amd64 go build -o ../binaries/halfpipe_windows_unsigned_$VERSION.exe -ldflags "${LDFLAGS}" cmd/halfpipe.go
ls -l ../binaries
inputs:
- name: halfpipe
- name: version
outputs:
- name: binaries
caches:
- path: ../../../var/halfpipe/cache
- task: Sign
config:
platform: linux
image_resource:
type: docker-image
source:
repository: quay.io/giantswarm/signcode-util
tag: latest
run:
path: /bin/sh
args:
- -ec
- |
export VERSION="$(cat version/version)"
echo $SIGN_KEY | base64 -d > key.pfx
echo $WTF
osslsigncode sign \
-pkcs12 key.pfx \
-pass $SIGN_KEY_PWD \
-n "halfpipe" \
-i https://www.springernature.com/ \
-t http://timestamp.digicert.com \
-in binaries/halfpipe_windows_unsigned_$VERSION.exe \
-out binaries/halfpipe_windows_$VERSION.exe
chmod +x binaries/halfpipe_windows_$VERSION.exe
rm binaries/halfpipe_windows_unsigned_$VERSION.exe
ls -al binaries
inputs:
- name: halfpipe
- name: version
- name: binaries
outputs:
- name: binaries
params:
SIGN_KEY: ((halfpipe-cli.sign_key))
SIGN_KEY_PWD: ((halfpipe-cli.sign_key_pwd))
WTF: ((halfpipe-cli.whats-this))
- task: Unversal Binary
config:
platform: linux
image_resource:
type: docker-image
source:
password: ((halfpipe-gcr.private_key))
repository: eu.gcr.io/halfpipe-io/build-cctools
tag: latest
username: _json_key
run:
path: /bin/sh
args:
- -ec
- |
export VERSION="$(cat version/version)"
cd binaries
lipo -create -output halfpipe_darwin_$VERSION halfpipe_darwin_x86_$VERSION halfpipe_darwin_arm_$VERSION
rm -f halfpipe_darwin_x86_$VERSION halfpipe_darwin_arm_$VERSION
ls -l
inputs:
- name: version
- name: binaries
outputs:
- name: binaries
- put: halfpipe
params:
repository: halfpipe
tag: version/version
- put: release
params:
globs:
- binaries/halfpipe_*
name: version/version
tag: version/version
- put: artifactory-darwin
params:
file: binaries/halfpipe_darwin_*
- put: artifactory-linux
params:
file: binaries/halfpipe_linux_*
- put: artifactory-windows
params:
file: binaries/halfpipe_windows_*