-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
69 lines (64 loc) · 2.38 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
63
64
65
66
67
68
69
stages:
- build
- test
- QualityGate
- tapd
job1:
stage: build
tags:
- LMJ-CI-1
script:
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/lsh-cluster-oam-kubernetes-runtime ./main.go
job2:
stage: test
tags:
- LMJ-CI-1
script:
- "/usr/local/scanner/sonar-scanner-4.3.0.2102-linux/bin/sonar-scanner -X \
-Dsonar.sonar.login=admin \
-Dsonar.sonar.password=admin \
-Dsonar.language=go \
-Dsonar.projectKey=${CI_PROJECT_NAME} \
-Dsonar.projectName=${CI_PROJECT_NAME} \
-Dsonar.projectVersion=1.0 \
-Dsonar.ws.timeout=30 \
-Dsonar.projectDescription=${CI_PROJECT_TITLE} \
-Dsonar.links.homepage=${CI_PROJECT_URL} \
-Dsonar.sources=${CI_PROJECT_DIR} \
-Dsonar.sourceEncoding=UTF-8 \
-Dsonar.java.binaries=${CI_PROJECT_DIR} \
-Dsonar.branch.name=${CI_COMMIT_REF_NAME} "
job3:
stage: QualityGate
tags:
- LMJ-CI-1
script:
- echo ${CI_PROJECT_NAME}
- AA=`curl -X GET "http://8.15.0.18:9001/api/measures/search?projectKeys=${CI_PROJECT_NAME}&metricKeys=alert_status" | sed 's/":"/\\n/g' | sed 's/","/\\n/g' | awk 'NR==4 {print}'`
- echo $AA
- if [ ${AA} == OK ]; then
- echo "sonarqube通过"
- else
- echo "sonarqube失败 http://8.15.0.18:9001"
- exit 1
- fi
job4:
stage: tapd
except:
- master
tags:
- LMJ-CI-1
script:
- TAPD_STATE=`grep -i "tapd_find" /lsh-cicd/ci/configure.conf | awk '{print $3}'`
- if [[ ${TAPD_STATE} == open ]]; then
- echo ${CI_COMMIT_MESSAGE} | grep -E -o 'sit[(]|st[(]|fix[(]|feat[(]' || echo "未找到缺陷单或需求 "
- NAME=`echo ${CI_COMMIT_MESSAGE} | grep -E -o 'sit[(]|st[(]|fix[(]|feat[(]'`
- ID_VALUE=`echo ${CI_COMMIT_MESSAGE} | grep -o 'Closes .[0-9]*' | awk -F "#" '{print $2}'`
- echo "${NAME}:${ID_VALUE}"
- cd /lsh-cicd/ci
- if [[ ${NAME} != 'feat(' ]]; then
- ./bug_id_find.sh ${ID_VALUE}
- else
- ./demand_id_find.sh ${ID_VALUE}
- fi
- fi