-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitlab-ci.yml
62 lines (54 loc) · 1.33 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
image: openjdk:8-jdk-alpine
services:
- mysql:latest
variables:
SPRING_PROFILES_ACTIVE: "gitlabci"
MYSQL_DATABASE: example_db
MYSQL_ROOT_PASSWORD: abcd1234
stages:
- gradle-build
- gradle-docker
- security-checks
gradle-build:
stage: gradle-build
script:
- ./gradlew clean build
artifacts:
paths:
- build/
when: always
reports:
junit: [build/test-results/test/TEST-*.xml, build/test-results/integrationTest/TEST-*.xml]
security-checks:
stage: security-checks
services:
- docker:dind
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
script:
- ./scripts/security-checks.sh
artifacts:
paths:
- build/reports/hawkeye
when: always
gradle-docker:
stage: gradle-docker
services:
- docker:dind
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
script:
- export BUILD_NUM_DOCKER_TAG=0.1.$CI_JOB_ID
- ./gradlew jibDockerBuild
- docker images
- docker tag net.thoughtworks/example-product-service:latest ryandjf/example-product-service:$BUILD_NUM_DOCKER_TAG
- docker login -u $DOCKER_USER -p $DOCKER_PASS
- docker push ryandjf/example-product-service:$BUILD_NUM_DOCKER_TAG
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
- apk add --no-cache git bash docker
cache:
paths:
- .gradle