forked from finos/common-domain-model
-
Notifications
You must be signed in to change notification settings - Fork 0
/
codefresh.yml
425 lines (404 loc) · 18.8 KB
/
codefresh.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
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
version: '1.0'
stages:
- build
- distribute
- finalise
steps:
main_clone:
title: Cloning main repository...
type: git-clone
git: github
repo: "${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}"
revision: "${{CF_REVISION}}"
TagReleaseName:
stage: 'build'
title: Setup RELEASE_NAME variable with tag
image: alpine/git
when:
condition:
all:
releaseNameNotDefined: "${{TAG_REPO}} == true"
commands:
- cf_export RELEASE_NAME=${{TAG_NAME}}
BranchReleaseName:
stage: 'build'
title: Setup RELEASE_NAME variable with branch name
image: alpine/git
when:
condition:
all:
releaseNameNotDefined: "${{TAG_REPO}} == false"
commands:
- cf_export RELEASE_NAME=${{GLOBAL_RELEASE_VERSION}}.${{CF_BRANCH_TAG_NORMALIZED}}
BuildNormal:
stage: 'build'
title: Maven build
fail_fast: false
image: regnosys-docker-registry.jfrog.io/regnosys/mvn-docker-build:java-11
working_directory: ./
when:
condition:
all:
isNotRelease: "${{TAG_REPO}} == false"
commands:
- rm -rf /codefresh/volume/.m2/com/regnosys
- mvn -s /settings.xml versions:set -DnewVersion=${{RELEASE_NAME}} versions:update-child-modules
- mvn -U -s /settings.xml clean install -P daml,scala,typescript,golang,csharp8,csharp9,kotlin
- zip -r isda-demo/target/isda-demo-${{RELEASE_NAME}}.zip ./isda-demo/ -x "*.git/*" -x "*.versionsBackup*" -x "isda-demo/target/*"
- mvn -U -s /settings.xml deploy -P daml,scala,typescript,golang,csharp8,csharp9,kotlin
BuildRelease:
stage: 'build'
title: Maven build for release
fail_fast: false
image: regnosys-docker-registry.jfrog.io/regnosys/mvn-docker-build:java-11
working_directory: ./
when:
condition:
all:
isRelease: "${{TAG_REPO}}"
commands:
- rm -rf /codefresh/volume/.m2/com/regnosys
- mvn -s /settings.xml versions:set -DnewVersion=${{RELEASE_NAME}} versions:update-child-modules
- mvn -s /settings.xml clean install -P daml,scala,typescript,golang,csharp8,csharp9,kotlin,full
- zip -r isda-demo/target/isda-demo-${{RELEASE_NAME}}.zip ./isda-demo/ -x "*.git/*" -x "*.versionsBackup*"
- mvn -s /settings.xml deploy -P daml,scala,typescript,golang,csharp8,csharp9,kotlin,full
BuildParallelTasks:
stage: 'build'
type: parallel
steps:
BuildDaml:
stage: 'build'
title: DAML build
fail_fast: false
image: digitalasset/daml-sdk:1.3.0
working_directory: ./rosetta-source/
shell: bash
commands:
- daml build -o target/cdm-daml-${{RELEASE_NAME}}.dar
BuildScala:
stage: 'build'
title: Scala build
fail_fast: false
image: mozilla/sbt:8u292_1.5.7
working_directory: ./rosetta-source/target/classes/cdm/scala
shell: bash
commands:
- sbt compile
- sbt package
BuildCSharp8:
stage: 'build'
title: CSharp8 build
fail_fast: false
image: mcr.microsoft.com/dotnet/core/sdk:3.1
working_directory: ./rosetta-source/target/classes/cdm/csharp8/NetStandard.2.1
shell: bash
commands:
- dotnet build Cdm/Cdm.csproj
- dotnet test Test/Test.csproj
- dotnet publish Cdm/Cdm.csproj -c release -o ./app
BuildCSharp9:
stage: 'build'
title: CSharp9 build
fail_fast: false
image: mcr.microsoft.com/dotnet/sdk:5.0
working_directory: ./rosetta-source/target/classes/cdm/csharp9/Net.5.0
shell: bash
commands:
- dotnet build Cdm/Cdm.csproj
- dotnet test Test/Test.csproj
- dotnet publish Cdm/Cdm.csproj -c release -o ./app
DeployParallelTasks:
stage: 'build'
type: parallel
steps:
DeployDaml:
stage: 'build'
title: DAML deploy
fail_fast: false
image: regnosys-docker-registry.jfrog.io/regnosys/mvn-docker-build:java-11
working_directory: ./rosetta-source/
shell: bash
commands:
- cd /codefresh/volume/${{CF_REPO_NAME}}/rosetta-source/target
- tar -cvzf cdm-daml-${{RELEASE_NAME}}.tar.gz cdm-daml-${{RELEASE_NAME}}.dar
- mvn -U -s /settings.xml deploy:deploy-file -Durl=https://regnosys.jfrog.io/regnosys/libs-snapshot-local -Dfile=cdm-daml-${{RELEASE_NAME}}.tar.gz -DrepositoryId=snapshots -DgroupId=com.isda -DartifactId=cdm-daml -Dversion=${{RELEASE_NAME}} -Dpackaging=tar.gz -DgeneratePom=true
DeployScala:
stage: 'build'
title: Scala deploy
fail_fast: false
image: regnosys-docker-registry.jfrog.io/regnosys/mvn-docker-build:java-11
working_directory: ./rosetta-source/target/classes/cdm/scala
shell: bash
commands:
- cd /codefresh/volume/${{CF_REPO_NAME}}/rosetta-source/target/classes/cdm/scala/target/scala-2.12
- mv cdm-scala_2.12-0.0.0.snapshot.jar cdm-scala-${{RELEASE_NAME}}.jar
- mvn -U -s /settings.xml deploy:deploy-file -Durl=https://regnosys.jfrog.io/regnosys/libs-snapshot-local -Dfile=cdm-scala-${{RELEASE_NAME}}.jar -DrepositoryId=snapshots -DgroupId=com.isda -DartifactId=cdm-scala -Dversion=${{RELEASE_NAME}} -DgeneratePom=true
DeployCSharp8:
stage: 'build'
title: CSharp8 deploy
fail_fast: false
image: regnosys-docker-registry.jfrog.io/regnosys/mvn-docker-build:java-11
working_directory: ./rosetta-source/target/classes/cdm/csharp8/NetStandard.2.1
shell: bash
commands:
- tar -cvzf cdm-csharp8-${{RELEASE_NAME}}.tar.gz app
- mvn -U -s /settings.xml deploy:deploy-file -Durl=https://regnosys.jfrog.io/regnosys/libs-snapshot-local -Dfile=cdm-csharp8-${{RELEASE_NAME}}.tar.gz -DrepositoryId=snapshots -DgroupId=com.isda -DartifactId=cdm-csharp8 -Dversion=${{RELEASE_NAME}} -Dpackaging=tar.gz -DgeneratePom=true
DeployCSharp9:
stage: 'build'
title: CSharp9 deploy
fail_fast: false
image: regnosys-docker-registry.jfrog.io/regnosys/mvn-docker-build:java-11
working_directory: ./rosetta-source/target/classes/cdm/csharp9/Net.5.0
shell: bash
commands:
- tar -cvzf cdm-csharp9-${{RELEASE_NAME}}.tar.gz app
- mvn -U -s /settings.xml deploy:deploy-file -Durl=https://regnosys.jfrog.io/regnosys/libs-snapshot-local -Dfile=cdm-csharp9-${{RELEASE_NAME}}.tar.gz -DrepositoryId=snapshots -DgroupId=com.isda -DartifactId=cdm-csharp9 -Dversion=${{RELEASE_NAME}} -Dpackaging=tar.gz -DgeneratePom=true
DeployTypeScript:
stage: 'build'
title: TypeScript deploy
fail_fast: false
image: regnosys-docker-registry.jfrog.io/regnosys/mvn-docker-build:java-11
working_directory: ./rosetta-source/target/classes/cdm
shell: bash
commands:
- tar -cvzf cdm-typescript-${{RELEASE_NAME}}.zip typescript
- mvn -U -s /settings.xml deploy:deploy-file -Durl=https://regnosys.jfrog.io/regnosys/libs-snapshot-local -Dfile=cdm-typescript-${{RELEASE_NAME}}.zip -DrepositoryId=snapshots -DgroupId=com.isda -DartifactId=cdm-typescript -Dversion=${{RELEASE_NAME}} -DgeneratePom=true
DeployGo:
stage: 'build'
title: Go deploy
fail_fast: false
image: regnosys-docker-registry.jfrog.io/regnosys/mvn-docker-build:java-11
working_directory: ./rosetta-source/target/classes/cdm
shell: bash
commands:
- tar -cvzf cdm-golang-${{RELEASE_NAME}}.tar.gz golang
- mvn -U -s /settings.xml deploy:deploy-file -Durl=https://regnosys.jfrog.io/regnosys/libs-snapshot-local -Dfile=cdm-golang-${{RELEASE_NAME}}.tar.gz -DrepositoryId=snapshots -DgroupId=com.isda -DartifactId=cdm-golang -Dversion=${{RELEASE_NAME}} -Dpackaging=tar.gz -DgeneratePom=true
DeployKotlin:
stage: 'build'
title: Kotlin deploy
fail_fast: false
image: regnosys-docker-registry.jfrog.io/regnosys/mvn-docker-build:java-11
working_directory: ./rosetta-source/
shell: bash
commands:
- cd /codefresh/volume/${{CF_REPO_NAME}}/rosetta-source/target/classes/cdm/kotlin
- mvn -s /settings.xml -f kotlin-pom.xml versions:set -DnewVersion=${{RELEASE_NAME}}
- mvn -s /settings.xml -f kotlin-pom.xml clean deploy
BuildJavaDocs:
stage: 'build'
title: Javadocs build and deploy
fail_fast: false
image: regnosys-docker-registry.jfrog.io/regnosys/mvn-docker-build:java-11
working_directory: ./
commands:
- cd rosetta-source
- mvn -s /settings.xml javadoc:jar
- mvn -s /settings.xml javadoc:jar
- cd ..
- curl -X PUT -u ${{ARTIFACTORY_USER}}:${{ARTIFACTORY_API_KEY}} -T rosetta-source/target/cdm-${{RELEASE_NAME}}-javadoc.jar "https://regnosys.jfrog.io/artifactory/libs-snapshot-local/com/isda/cdm/${{RELEASE_NAME}}/cdm-${{RELEASE_NAME}}-javadoc.jar"
BuildDistributionNormal:
stage: 'distribute'
title: Maven distribution build
fail_fast: false
image: regnosys-docker-registry.jfrog.io/regnosys/mvn-docker-build:java-11
working_directory: ./
when:
condition:
all:
isNotRelease: "${{TAG_REPO}} == false"
commands:
- rm -rf /codefresh/volume/.m2/com/regnosys /codefresh/volume/.m2/com/isda
- mvn -s /settings.xml versions:set -DnewVersion=${{RELEASE_NAME}}
- cd cdm-distribution
- mvn -U -s /settings.xml clean deploy -P distribute
BuildDistributionRelease:
stage: 'distribute'
title: Maven distribution build for release
fail_fast: false
image: regnosys-docker-registry.jfrog.io/regnosys/mvn-docker-build:java-11
working_directory: ./
when:
condition:
all:
isRelease: "${{TAG_REPO}}"
commands:
- rm -rf /codefresh/volume/.m2/com/regnosys /codefresh/volume/.m2/com/isda
- mvn -s /settings.xml versions:set -DnewVersion=${{RELEASE_NAME}}
- cd cdm-distribution
- mvn -U -s /settings.xml clean deploy -P distribute,distribute-full
DistributeDaml:
stage: 'distribute'
title: Maven DAML distribution
fail_fast: false
image: regnosys-docker-registry.jfrog.io/regnosys/mvn-docker-build:java-11
working_directory: ./cdm-distribution
commands:
- rm -rf /codefresh/volume/.m2/com/regnosys /codefresh/volume/.m2/com/isda
- mvn -s /settings.xml -f daml-pom.xml versions:set -DnewVersion=${{RELEASE_NAME}}
- mvn -U -s /settings.xml -f daml-pom.xml clean deploy
DistributeScala:
stage: 'distribute'
title: Maven Scala distribution
fail_fast: false
image: regnosys-docker-registry.jfrog.io/regnosys/mvn-docker-build:java-11
working_directory: ./cdm-distribution
commands:
- rm -rf /codefresh/volume/.m2/com/regnosys /codefresh/volume/.m2/com/isda
- mvn -s /settings.xml -f scala-pom.xml versions:set -DnewVersion=${{RELEASE_NAME}}
- mvn -U -s /settings.xml -f scala-pom.xml clean deploy
DistributeCSharp8:
stage: 'distribute'
title: Maven CSharp8 distribution
fail_fast: false
image: regnosys-docker-registry.jfrog.io/regnosys/mvn-docker-build:java-11
working_directory: ./cdm-distribution
commands:
- rm -rf /codefresh/volume/.m2/com/regnosys /codefresh/volume/.m2/com/isda
- mvn -s /settings.xml -f csharp8-pom.xml versions:set -DnewVersion=${{RELEASE_NAME}}
- mvn -U -s /settings.xml -f csharp8-pom.xml clean deploy
DistributeCSharp9:
stage: 'distribute'
title: Maven CSharp9 distribution
fail_fast: false
image: regnosys-docker-registry.jfrog.io/regnosys/mvn-docker-build:java-11
working_directory: ./cdm-distribution
commands:
- rm -rf /codefresh/volume/.m2/com/regnosys /codefresh/volume/.m2/com/isda
- mvn -s /settings.xml -f csharp9-pom.xml versions:set -DnewVersion=${{RELEASE_NAME}}
- mvn -U -s /settings.xml -f csharp9-pom.xml clean deploy
DistributeTypeScript:
stage: 'distribute'
title: Maven TypeScript distribution
fail_fast: false
image: regnosys-docker-registry.jfrog.io/regnosys/mvn-docker-build:java-11
working_directory: ./cdm-distribution
commands:
- rm -rf /codefresh/volume/.m2/com/regnosys /codefresh/volume/.m2/com/isda
- mvn -s /settings.xml -f typescript-pom.xml versions:set -DnewVersion=${{RELEASE_NAME}}
- mvn -U -s /settings.xml -f typescript-pom.xml clean deploy
DistributeGo:
stage: 'distribute'
title: Maven Golang distribution
fail_fast: false
image: regnosys-docker-registry.jfrog.io/regnosys/mvn-docker-build:java-11
working_directory: ./cdm-distribution
commands:
- rm -rf /codefresh/volume/.m2/com/regnosys /codefresh/volume/.m2/com/isda
- mvn -s /settings.xml -f golang-pom.xml versions:set -DnewVersion=${{RELEASE_NAME}}
- mvn -U -s /settings.xml -f golang-pom.xml clean deploy
DistributeKotlin:
stage: 'distribute'
title: Maven Kotlin distribution
fail_fast: false
image: regnosys-docker-registry.jfrog.io/regnosys/mvn-docker-build:java-11
working_directory: ./cdm-distribution
commands:
- rm -rf /codefresh/volume/.m2/com/regnosys /codefresh/volume/.m2/com/isda
- mvn -s /settings.xml -f kotlin-pom.xml versions:set -DnewVersion=${{RELEASE_NAME}}
- mvn -U -s /settings.xml -f kotlin-pom.xml clean deploy
NotifySlackOnFail:
stage: 'finalise'
title: Trigger Slack dev channel notification if master build failed
image: codefresh/cli
when:
branch:
only:
- master
condition:
any:
buildNormalFailed: steps.BuildNormal.result == 'error'
buildReleaseFailed: steps.BuildRelease.result == 'error'
buildDamlFailed: steps.BuildDaml.result == 'error'
buildScalaFailed: steps.BuildScala.result == 'error'
buildCSharp8Failed: steps.BuildCSharp8.result == 'error'
buildCSharp9Failed: steps.BuildCSharp9.result == 'error'
deployDamlFailed: steps.DeployDaml.result == 'error'
deployScalaFailed: steps.DeployScala.result == 'error'
deployTypeScriptFailed: steps.DeployTypeScript.result == 'error'
deployCSharp8Failed: steps.DeployCSharp8.result == 'error'
deployCSharp9Failed: steps.DeployCSharp9.result == 'error'
deployGoFailed: steps.DeployGo.result == 'error'
deployKotlinFailed: steps.DeployKotlin.result == 'error'
buildJavaDocsFailed: steps.BuildJavaDocs.result == 'error'
distributeNormalFailed: steps.BuildDistributionNormal.result == 'error'
distributeReleaseFailed: steps.BuildDistributionRelease.result == 'error'
distributeDamlFailed: steps.DistributeDaml.result == 'error'
distributeScalaFailed: steps.DistributeScala.result == 'error'
distributeTypeScriptFailed: steps.DistributeTypeScript.result == 'error'
distributeCSharp8Failed: steps.DistributeCSharp8.result == 'error'
distributeCSharp9Failed: steps.DistributeCSharp9.result == 'error'
distributeGoFailed: steps.DistributeGo.result == 'error'
distributeKotlinFailed: steps.DistributeKotlin.result == 'error'
distributeJavaDocsFailed: steps.DistributeJavaDocs.result == 'error'
commands:
- export SAFE_COMMIT_AUTHOR='${{CF_COMMIT_AUTHOR}}'
- export COMMIT_AUTHOR=${SAFE_COMMIT_AUTHOR:-MissingAuthor}
- export SAFE_REPO_NAME='${{CF_REPO_NAME}}'
- export REPO_NAME=${SAFE_REPO_NAME:-NoRepo}
- export SAFE_COMMIT_MESSAGE='${{CF_COMMIT_MESSAGE}}'
- export COMMIT_MESSAGE=${SAFE_COMMIT_MESSAGE:-NoCommitMsg}
- echo Author is $SAFE_COMMIT_AUTHOR and commit msg is $SAFE_COMMIT_MESSAGE and repo is $SAFE_REPO_NAME
- echo After substitution author is $COMMIT_AUTHOR and commit msg is $COMMIT_MESSAGE and repo is $REPO_NAME
- codefresh run slack-notifier -v REPO_NAME="${REPO_NAME}" -v COMMIT_AUTHOR="${COMMIT_AUTHOR}" -v COMMIT_MESSAGE="${COMMIT_MESSAGE}" --detach
FailPipeline:
stage: 'finalise'
title: Fail pipeline if the Maven build failed
image: codefresh/cli
when:
condition:
any:
normalBuildFailure: steps.BuildNormal.result == 'failure'
releaseBuildFailure: steps.BuildRelease.result == 'failure'
damlBuildFailure: steps.BuildDaml.result == 'failure'
scalaBuildFailure: steps.BuildScala.result == 'failure'
cSharp8BuildFailure: steps.BuildCSharp8.result == 'failure'
cSharp9BuildFailure: steps.BuildCSharp9.result == 'failure'
damlDeployFailure: steps.DeployDaml.result == 'failure'
scalaDeployFailure: steps.DeployScala.result == 'failure'
typeScriptDeployFailure: steps.DeployTypeScript.result == 'failure'
cSharp8DeployFailure: steps.DeployCSharp8.result == 'failure'
cSharp9DeployFailure: steps.DeployCSharp9.result == 'failure'
goDeployFailure: steps.DeployGo.result == 'failure'
kotlinDeployFailure: steps.DeployKotlin.result == 'failure'
javaDocsBuildFailure: steps.BuildJavaDocs.result == 'failure'
distributeNormalFailure: steps.BuildDistributionNormal.result == 'failure'
distributeReleaseFailure: steps.BuildDistributionRelease.result == 'failure'
distributeDamlFailure: steps.DistributeDaml.result == 'failure'
distributeScalaFailure: steps.DistributeScala.result == 'failure'
distributeTypeScriptFailure: steps.DistributeTypeScript.result == 'failure'
distributeCSharp8Failure: steps.DistributeCSharp8.result == 'failure'
distributeCSharp9Failure: steps.DistributeCSharp9.result == 'failure'
distributeGoFailure: steps.DistributeGo.result == 'failure'
distributeKotlinFailure: steps.DistributeKotlin.result == 'failure'
distributeJavaDocsFailure: steps.DistributeJavaDocs.result == 'failure'
commands:
- exit 1
TagRepo:
stage: 'finalise'
title: Tag git repo with release name
image: alpine/git
when:
condition:
all:
buildPassed: steps.BuildRelease.result == 'success'
isRelease: "${{TAG_REPO}}"
commands:
- echo This is a release build, tag repos with release name [${{RELEASE_NAME}}]
- git fetch --prune https://${{REGNOSYS_OPS}}:${{REGNOSYS_OPS_TOKEN}}@github.com/${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}.git "+refs/tags/*:refs/tags/*"
- git tag ${{RELEASE_NAME}}
- git push https://${{REGNOSYS_OPS}}:${{REGNOSYS_OPS_TOKEN}}@github.com/${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}.git ${{RELEASE_NAME}}
StartNextBuild:
stage: 'finalise'
title: Build rosetta-navigation if on master
image: codefresh/cli
when:
branch:
only:
- master
condition:
all:
buildPassed: steps.BuildNormal.result == 'success'
variableDefined: "${{TAG_REPO}} == false"
skipNextBuild: "${{SKIP_NEXT_BUILD}} == false"
commands:
- codefresh run REGnosys/rosetta-navigation/rosetta-navigation --branch master --detach