-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
55 lines (51 loc) · 1.34 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
variables:
IMAGE_NAME: fasibio/hbci-elastic
SONAR_NAME: fasibio_hbci-elastic_
SONAR_HOST: https://sonar.server2.fasibio.de
# sonar upload
uploadSonarqube:
image: ciricihq/gitlab-sonar-scanner
stage: sonarqube
script:
- sonar-scanner -Dsonar.projectKey=${SONAR_NAME}${CI_COMMIT_REF_NAME} -Dsonar.sources=. -Dsonar.host.url=${SONAR_HOST} -Dsonar.login=$sonarqubelogin
only:
- main
tags:
- dockerfasibio
artifacts:
paths:
- ./cov.out
# build binary
buildBin:
stage: buildBin
only:
- main
tags:
- dockerfasibio
image: openjdk:17-alpine
script:
- ./gradlew build
artifacts:
paths:
- build/libs/hbci-app-0.0.1-SNAPSHOT.jar
expire_in: 1 day
# build latest stable version of docker image
buildImageMasterAndPush:
stage: buildPushImage
only:
- main
tags:
- dockerfasibio
image: docker
script:
- docker pull ${IMAGE_NAME}:latest || true
- docker build --pull --cache-from ${IMAGE_NAME}:latest --build-arg buildNumber=${CI_PIPELINE_IID} -t ${IMAGE_NAME}:${CI_PIPELINE_IID} .
- docker login -u ${dockerhubuser} -p ${dockerhubpassword}
- docker tag ${IMAGE_NAME}:${CI_PIPELINE_IID} ${IMAGE_NAME}:latest
- docker push ${IMAGE_NAME}:${CI_PIPELINE_IID}
- docker push ${IMAGE_NAME}:latest
stages:
- test
- sonarqube
- buildBin
- buildPushImage