-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
71 lines (62 loc) · 2.29 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
# This file is a template, and might need editing before it works on your project.
# This template uses the java:8 docker image because there isn't any
# official Gradle image at this moment
#
# This is the Gradle build system for JVM applications
# https://gradle.org/
# https://github.com/gradle/gradle
#image: java:8
# Disable the Gradle daemon for Continuous Integration servers as correctness
# is usually a priority over speed in CI environments. Using a fresh
# runtime for each build is more reliable since the runtime is completely
# isolated from any previous builds.
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
# 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
- build_application_docker_image
- redeploy
package_application:
stage: package_application
image: java:8
script:
- ./gradlew -g /cache/.gradle clean :crestdb-web:assemble -PwarName=crest.war
allow_failure: false
artifacts:
paths:
- ./crestdb-web/build/libs/crest.war
build_application_docker_image:
stage: build_application_docker_image
tags:
- docker-image-build
script: "echo building $CI_REGISTRY_IMAGE:runner" # No empty scripts are allowed
variables:
TO: $CI_REGISTRY_IMAGE:runner # Where to push resulting image
redeploy:
stage: redeploy
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"