-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
204 lines (183 loc) · 5.02 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
variables:
IMAGE: crest-service
VERSION: '0.2'
REGISTRY: 'svomtest.svom.fr:5543'
# REGISTRY: 'svomtest.svom.fr:5543'
CONTAINER_IMAGE: $REGISTRY/$IMAGE:$VERSION
WEB_CONTAINER_IMAGE: $REGISTRY/crest-ui:$VERSION
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
GIT_SSL_NO_VERIFY: "true"
# When using dind service we need to instruct docker, to talk with the
# daemon started inside of the service. The daemon is available with
# a network connection instead of the default /var/run/docker.sock socket.
#
# The 'docker' hostname is the alias of the service container as described at
# https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#accessing-the-services
#
# Note that if you're using Kubernetes executor, the variable should be set to
# tcp://localhost:2375 because of how Kubernetes executor connects services
# to the job container
# DOCKER_HOST: tcp://docker:2375/
# When using dind, it's wise to use the overlayfs driver for
# improved performance.
# DOCKER_DRIVER: overlay2
# Select a runner
# use tag keyword (see below)
#services:
# - docker:dind
# Make the gradle wrapper executable. This essentially downloads a copy of
# Gradle to build the project with.
# https://docs.gradle.org/current/userguide/gradle_wrapper.html
# It is expected that any modern gradle project has a wrapper
before_script:
- chmod +x gradlew
# We redirect the gradle user home using -g so that it caches the
# wrapper and dependencies.
# https://docs.gradle.org/current/userguide/gradle_command_line.html
#
# Unfortunately it also caches the build output so
# cleaning removes reminants of any cached builds.
# The assemble task actually builds the project.
# If it fails here, the tests can't run.
#build:
# stage: build
# script:
# - ./gradlew -g /cache/.gradle clean :crestdb-web:assemble -PwarName=crest.war
# allow_failure: false
# Use the generated build output to run the tests.
#test:
# stage: test
# script:
# - ./gradlew -g /cache/.gradle check
stages:
- package_application
- webui
- build
- release
- sonar_application
- redeploy
package_svom_application:
stage: package_application
image: openjdk:11-jdk-alpine
script:
- ./gradlew -g /cache/.gradle clean assemble -PwarName=crest.war
allow_failure: false
artifacts:
paths:
- ./crestdb-web/build/libs/crest.war
expire_in: 1 week
only:
- cms-v0
release:
stage: release
image: docker:19.03.1
services:
- docker:19.03.1-dind
before_script:
- docker login -u svom -p $SVOMREGISTRYPSWD $REGISTRY
script:
- docker build --rm --tag=$CONTAINER_IMAGE --file Dockerfile .
- docker push $CONTAINER_IMAGE
only:
- cms-v0
webui:
stage: webui
environment: dc0
tags:
- dc0-shell
script:
- docker info
- docker build --tag=$WEB_CONTAINER_IMAGE --file ./web-ui/crest-ui/Dockerfile.nginx.svom ./web-ui/crest-ui/
only:
- svom-dc1
sonar_application:
stage: sonar_application
image: openjdk:11-jdk-alpine
script:
- ./gradlew sonarqube -Dsonar.projectKey=crestdb -Dsonar.host.url=http://svom1.lal.in2p3.fr:20090 -Dsonar.login=f50918d8b780181f947ae83b42e78983ffde4bf3
allow_failure: false
only:
- stable
# build_svom_docker_image:
# stage: build
# environment: dc0
# tags:
# - dc0-shell
# image: java:8
# script:
# - docker info
# - docker build --tag=$CONTAINER_IMAGE --file Dockerfile.svom .
# only:
# - svom-dc1
# webui:
# stage: webui
# tags:
# - dc0-shell
# script:
# - docker info
# - docker build --tag=$WEB_CONTAINER_IMAGE ./web-ui/crest-ui/
# only:
# - svom-dc0
# registry-push:
# stage: release
# environment: dc0
# tags:
# - dc0-shell
# script:
# - docker login -u svom -p $SVOMREGISTRYPSWD $REGISTRY
# - docker push $CONTAINER_IMAGE
# only:
# - svom-dc1
package_cern_application:
stage: package_application
environment: cern
only:
refs:
- master
variables:
- $REMOTE_NAME == "cern"
image: adoptopenjdk:11-jdk-openj9
script:
- ./gradlew -g /cache/.gradle clean assemble -PwarName=crest.war
allow_failure: false
artifacts:
paths:
- ./crestdb-web/build/libs/crest.war
package_cern_web_application:
stage: webui
environment: cern
only:
refs:
- master
variables:
- $REMOTE_NAME == "cern"
image: node:lts-alpine
script:
- ./vuecompile.sh
allow_failure: false
artifacts:
paths:
- ./web-ui/crest-ui/dist
build_cern_docker_image:
stage: build
environment: cern
only:
refs:
- master
variables:
- $REMOTE_NAME == "cern"
tags:
- docker-image-build
script: "echo building $CI_REGISTRY_IMAGE:runner" # No empty scripts are allowed
variables:
TO: $CI_REGISTRY_IMAGE:latest # Where to push resulting image
redeploy:
stage: redeploy
environment: cern
only:
refs:
- master
variables:
- $REMOTE_NAME == "cern"
image: gitlab-registry.cern.ch/paas-tools/openshift-client:latest
script: "oc import-image $IMAGE_NAME --server=$SERVER --namespace $NAMESPACE --all --token=$IMAGE_IMPORT_TOKEN"