-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcodefresh.yml
124 lines (115 loc) · 3.61 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
version: "1.0"
stages:
- setup
- build
- finalise
steps:
main_clone:
title: Cloning main repository...
stage: 'setup'
type: git-clone
git: github
repo: "${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}"
revision: "${{CF_REVISION}}"
SetProperties:
title: Setup build
stage: 'setup'
image: alpine/git
commands:
- cf_export GPG_IMPORT_COMMAND="cat <(echo -e '${{GPG_PRIVATE_KEY}}') | gpg --batch --import" --mask
TagReleaseName:
title: Setup RELEASE_NAME variable with tag
stage: 'setup'
image: alpine/git
when:
condition:
all:
releaseNameNotDefined: "${{TAG_REPO}} == true"
commands:
- cf_export RELEASE_NAME=${{TAG_NAME}}
BranchReleaseName:
title: Setup RELEASE_NAME variable with branch name
stage: 'setup'
image: alpine/git
when:
condition:
all:
releaseNameNotDefined: "${{TAG_REPO}} == false"
commands:
- cf_export RELEASE_NAME=${{GLOBAL_RELEASE_VERSION}}.${{CF_BRANCH_TAG_NORMALIZED}}-SNAPSHOT
ReleaseProperties:
title: Setup release build
stage: 'setup'
image: alpine/git
when:
condition:
all:
releaseNameNotDefined: "${{TAG_REPO}} == true"
commands:
- cf_export MVN_SET_VERSION="versions:set-property -DnewVersion=${{RELEASE_NAME}}"
BranchProperties:
title: Setup branch build
stage: 'setup'
image: alpine/git
when:
condition:
all:
releaseNameNotDefined: "${{TAG_REPO}} == false"
commands:
- cf_export MVN_SET_VERSION="versions:update-property -DnewVersion=[${{RELEASE_NAME}}] -DallowSnapshots=true -DallowDowngrade=true"
BuildTesting:
title: Maven build rune-testing
stage: 'build'
fail_fast: false
image: maven:3.8.5-openjdk-17
working_directory: ./
commands:
- rm -rf /codefresh/volume/.m2/com/regnosys
- bash -c "${{GPG_IMPORT_COMMAND}}"
- mvn versions:set -DnewVersion=${{RELEASE_NAME}}
- mvn ${{MVN_SET_VERSION}} -Dproperty=rosetta.common.version
- export CI_DEPLOY_USERNAME="${{CI_DEPLOY_USERNAME}}"
- export CI_DEPLOY_PASSWORD="${{CI_DEPLOY_PASSWORD}}"
- export GPG_KEYNAME="${{GPG_KEYNAME}}"
- export GPG_PASSPHRASE="${{GPG_PASSPHRASE}}"
- mvn -s settings.xml -B clean deploy -P gpg
FailPipeline:
title: Fail pipeline if the Maven build failed
stage: 'finalise'
image: codefresh/cli
when:
steps:
- name: BuildTesting
on:
- failure
commands:
- exit 1
TagRepo:
title: Tag git repo with release name
stage: 'finalise'
image: alpine/git
when:
condition:
all:
buildTestingPassed: steps.BuildTesting.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/finos/${{CF_REPO_NAME}}.git "+refs/tags/*:refs/tags/*"
- git tag ${{RELEASE_NAME}}
- git push https://${{REGNOSYS_OPS}}:${{REGNOSYS_OPS_TOKEN}}@github.com/finos/${{CF_REPO_NAME}}.git ${{RELEASE_NAME}}
StartNextBuild:
title: Build rosetta-components if on main
stage: 'finalise'
image: codefresh/cli
when:
branch:
only:
- main
condition:
all:
buildPassed: steps.BuildTesting.result == 'success'
variableDefined: "${{TAG_REPO}} == false"
skipNextBuild: "${{SKIP_NEXT_BUILD}} == false"
commands:
- codefresh run REGnosys/rosetta-components/rosetta-components --branch main --detach