-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
64 lines (58 loc) · 1.64 KB
/
.gitlab-ci.yml
File metadata and controls
64 lines (58 loc) · 1.64 KB
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
image: registry.cn-hangzhou.aliyuncs.com/choerodon-tools/cibase:0.5.0
stages:
- mvn-package
- docker-build
maven-test-branches:
stage: mvn-package
script:
- git_merge master
- mvn package -U -DskipTests=false
only:
- branches
except:
- master
- tags
- develop
- /^release-.*$/
- /^hotfix-.*$/
maven-test-build:
stage: mvn-package
script:
- update_pom_version
- mvn package -U -DskipTests=false
- mkdir -p /cache/${CI_PROJECT_NAME}-${CI_PROJECT_ID}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}
- cp target/app.jar /cache/${CI_PROJECT_NAME}-${CI_PROJECT_ID}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}/app.jar
only:
- tags
- develop
- master
- /^release-.*$/
- /^bugfix-.*$/
- /^hotfix-.*$/
docker-build:
stage: docker-build
script:
- docker_build
- chart_build
only:
- tags
- develop
- master
- /^release-.*$/
- /^hotfix-.*$/
.auto_devops: &auto_devops |
curl -o .auto_devops.sh \
"${CHOERODON_URL}/devops/ci?token=${Token}&type=microservice"
if [ $? -ne 0 ];then
cat .auto_devops.sh
exit 1
fi
source .auto_devops.sh
function docker_build(){
cp /cache/${CI_PROJECT_NAME}-${CI_PROJECT_ID}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}/app.jar ${1:-"src/main/docker"}/app.jar || true
docker build --pull -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}
rm -rf /cache/${CI_PROJECT_NAME}-${CI_PROJECT_ID}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}
}
before_script:
- *auto_devops