This repository has been archived by the owner on Jun 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitlab-ci.yml
59 lines (55 loc) · 1.6 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
cache:
paths:
- .m2/repository
stages:
- build
- register
build:
stage: build
tags:
- dind
image: maven:3.6.0-jdk-11-slim
script:
- mvn -f ./pom.xml $MAVEN_CLI_OPTS clean package -U -DskipTests
only:
- master
- develop
artifacts:
paths:
- target/*.jar
register develop:
stage: register
tags:
- dind
image: docker:latest
variables:
DOCKER_DRIVER: overlay2
services:
- docker:dind
only:
- develop
script:
- docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" $CI_REGISTRY
- docker build --pull -t $CI_REGISTRY_IMAGE:${CI_COMMIT_SHA:0:8} .
- docker tag $CI_REGISTRY_IMAGE:${CI_COMMIT_SHA:0:8} $CI_REGISTRY_IMAGE:${CI_COMMIT_SHA:0:8}
- docker tag $CI_REGISTRY_IMAGE:${CI_COMMIT_SHA:0:8} $CI_REGISTRY_IMAGE:latest
- docker push $CI_REGISTRY_IMAGE:${CI_COMMIT_SHA:0:8}
- docker push $CI_REGISTRY_IMAGE:latest
register master:
stage: register
tags:
- dind
image: docker:latest
variables:
DOCKER_DRIVER: overlay2
services:
- docker:dind
only:
- master
script:
- docker login -u "$HUB_LOGIN" -p "$HUB_CREDENTIALS"
- docker build --pull -t ${HUB_ORGANIZATION}/${CI_PROJECT_NAME}:${CI_COMMIT_SHA:0:8} .
- docker tag ${HUB_ORGANIZATION}/${CI_PROJECT_NAME}:${CI_COMMIT_SHA:0:8} ${HUB_ORGANIZATION}/${CI_PROJECT_NAME}:${CI_COMMIT_SHA:0:8}
- docker tag ${HUB_ORGANIZATION}/${CI_PROJECT_NAME}:${CI_COMMIT_SHA:0:8} ${HUB_ORGANIZATION}/${CI_PROJECT_NAME}:latest
- docker push ${HUB_ORGANIZATION}/${CI_PROJECT_NAME}:${CI_COMMIT_SHA:0:8}
- docker push ${HUB_ORGANIZATION}/${CI_PROJECT_NAME}:latest