-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.gitlab-ci.yml
46 lines (41 loc) · 1.11 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
image: registry.cn-shanghai.aliyuncs.com/choerodon-tools/cibase:0.9.1
stages:
- build
- release
build:
stage: build
script:
- update_pom_version
- mvn package -U -DskipTests=true
- cp target/app.jar src/main/docker
- docker_build
only:
- tags
- develop
- master
- /^release-.*$/
- /^hotfix-.*$/
release:
stage: release
script:
- chart_build
only:
- master
- tags
- develop
- /^hotfix-.*$/
- /^release-.*$/
.auto_devops: &auto_devops |
http_status_code=`curl -o .auto_devops.sh -s -m 10 --connect-timeout 10 -w %{http_code} "${CHOERODON_URL}/devops/ci?token=${Token}&type=microservice"`
if [ "$http_status_code" != "200" ]; then
cat .auto_devops.sh
exit 1
fi
source .auto_devops.sh
function docker_build(){
docker login -u ${DOCKER_USER} -p ${DOCKER_PWD} ${DOCKER_REGISTRY}
docker build -t ${DOCKER_REGISTRY}/${GROUP_NAME}/${PROJECT_NAME}:${CI_COMMIT_TAG} ${1:-"src/main/docker"}
docker push ${DOCKER_REGISTRY}/${GROUP_NAME}/${PROJECT_NAME}:${CI_COMMIT_TAG}
}
before_script:
- *auto_devops