-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitlab-ci.yml
208 lines (186 loc) · 5.42 KB
/
.gitlab-ci.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
variables:
DOMAIN_SUFFIX: minium-developer.test
MAVEN_EXTRA_ARGS: -Pprod,generate-electrons,generate-docs -DskipITs -pl !minium-developer-e2e-tests --settings $MAVEN_CUSTOM_CONFIGS/engineering.team/engineering-settings.xml
MAVEN_RELEASE_EXTRA_ARGS: -DpreparationGoals="clean"
JAVA_HOME: /usr/lib/jvm/jdk8
stages:
- build
- deploy
- test
- prepare-release
- release
before_script:
# login into bia
- docker login -u ${DOCKER_REGISTRY_USER:-gitlab-ci-token} -p ${DOCKER_REGISTRY_PASS:-$CI_BUILD_TOKEN} bia.vilt-group.com 2> /dev/null || true
#############################################################
# Build
#############################################################
.build definition: &build-template
stage: build
tags:
- maven
artifacts:
paths:
- version.txt
- minium-developer-bundle/target/minium-developer/*
- minium-developer-bundle/Dockerfile
- minium-developer-bundle/docker/*
- minium-developer-docs/target/mkdocs/docs/
build:
<<: *build-template
except:
- tags
script:
- mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec > version.txt
- mvn clean install -U -Pprod,generate-docs -DskipITs -pl !minium-developer-e2e-tests
build complete:
<<: *build-template
only:
- tags
script:
- mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec > version.txt
- mvn clean install -U $MAVEN_EXTRA_ARGS
#############################################################
# Deploy
#############################################################
.deploy definition: &deploy-template
stage: deploy
tags:
- docker
script:
- build $CI_PROJECT_DIR/minium-developer-bundle
- deploy $CI_PROJECT_DIR/minium-developer-bundle/docker
.deploy manual definition: &deploy-manual-template
<<: *deploy-template
when: manual
dependencies:
- build
.stop deploy manual definition: &stop-deploy-manual-template
stage: deploy
tags:
- docker
when: manual
script:
- cleanup
deploy manual staging:
<<: *deploy-manual-template
only:
- master
variables:
APP: $CI_PROJECT_NAME-staging
APP_HOST: staging.$DOMAIN_SUFFIX
APP_VERSION: staging
environment:
name: staging
url: http://staging.$DOMAIN_SUFFIX
on_stop: stop deploy manual staging
deploy manual review:
<<: *deploy-manual-template
only:
- /release\/.*$/
- /feature\/.*$/
- /bug\/.*$/
variables:
APP: $CI_PROJECT_NAME-$CI_COMMIT_REF_SLUG
APP_HOST: $CI_COMMIT_REF_SLUG.$DOMAIN_SUFFIX
APP_VERSION: $CI_COMMIT_REF_SLUG
environment:
name: review/$CI_COMMIT_REF_NAME
url: http://$CI_COMMIT_REF_SLUG.$DOMAIN_SUFFIX
on_stop: stop deploy manual review
deploy uat:
<<: *deploy-template
only:
- /^minium-developer-.*-RC\d+$/
variables:
APP: $CI_PROJECT_NAME-uat
APP_HOST: uat.$DOMAIN_SUFFIX
APP_VERSION: uat
environment:
name: uat
url: http://uat.$DOMAIN_SUFFIX
dependencies:
- build complete
stop deploy manual staging:
<<: *stop-deploy-manual-template
only:
- master
variables:
APP: $CI_PROJECT_NAME-staging
environment:
name: staging
action: stop
stop deploy manual review:
<<: *stop-deploy-manual-template
only:
- /release\/.*$/
- /feature\/.*$/
- /bug\/.*$/
variables:
APP: $CI_PROJECT_NAME-$CI_COMMIT_REF_SLUG
environment:
name: review/$CI_COMMIT_REF_NAME
action: stop
#############################################################
# Test
#############################################################
test uat:
stage: test
tags:
- docker
only:
- /^minium-developer-.*-RC\d+$/
script:
- sh ./scripts/launch-minium-manager-job.sh
variables:
MINIUM_MANAGER_PROJECT_ID: "100"
MINIUM_REPORT_PATH: $CI_PROJECT_DIR/minium-report-uat.pdf
dependencies:
- deploy uat
environment:
name: uat
artifacts:
name: "$CI_BUILD_REF_NAME/$CI_BUILD_ID"
when: on_failure
paths:
- minium-report-uat.pdf
#############################################################
# Prepare Release
#############################################################
prepare release candidate:
stage: prepare-release
tags:
- maven
when: manual
only:
- /^release\/.*$/
script:
# we must ensure we have all remote tags to compute the next release candidate version
- git fetch --tags
- git checkout -B $CI_COMMIT_REF_NAME
- sh ./scripts/prepare-release-candidate.sh
prepare release:
stage: prepare-release
tags:
- maven
when: manual
only:
- /^release\/.*$/
script:
- git fetch --tags
- git checkout -B $CI_COMMIT_REF_NAME
- sh ./scripts/prepare-release.sh
#############################################################
# Release
#############################################################
release:
stage: release
tags:
- maven
only:
- tags
script:
- mvn clean deploy $MAVEN_EXTRA_ARGS -DperformRelease=true
# store the documentation to be used at the minium website
- ssh -o StrictHostKeyChecking=no -i /mnt/cidata/configs/minium/id_rsa_decima root@decima "mkdir -p /var/www/minium.vilt.io/minium-website/minium-developer/docs"
- scp -o StrictHostKeyChecking=no -i /mnt/cidata/configs/minium/id_rsa_decima -r minium-developer-docs/target/mkdocs/docs/* root@decima:/var/www/minium.vilt.io/minium-website/minium-developer/docs