Commit fb76837b authored by Bùi Bá Trường's avatar Bùi Bá Trường

truongbb - test ci

parent 640eb733
Pipeline #380 failed with stages
in 21 seconds
...@@ -12,6 +12,9 @@ before_script: ...@@ -12,6 +12,9 @@ before_script:
- whoami - whoami
- unset SSH_ASKPASS - unset SSH_ASKPASS
variables:
QUALITY_GATE: "OK"
stages: stages:
- checkout - checkout
# - compile # - compile
...@@ -65,7 +68,8 @@ check_quality_gate: ...@@ -65,7 +68,8 @@ check_quality_gate:
- cd /root/GitlabRunner/repo/spring-ci-advanced - cd /root/GitlabRunner/repo/spring-ci-advanced
- ls - ls
- chmod +x ./build-test.sh - chmod +x ./build-test.sh
- ./build-test.sh quality-gate - export QUALITY_GATE = $(./build-test.sh quality-gate)
- echo $QUALITY_GATE
#build_up: #build_up:
# stage: build_up # stage: build_up
......
...@@ -12,6 +12,7 @@ sub_help(){ ...@@ -12,6 +12,7 @@ sub_help(){
echo " compile Compile java code" echo " compile Compile java code"
echo " sonar-scan Run sonar scanner" echo " sonar-scan Run sonar scanner"
echo " quality-gate Check quality gate" echo " quality-gate Check quality gate"
echo " build-up Build project with docker"
echo " send-email Send email after stage/pipeline" echo " send-email Send email after stage/pipeline"
echo "" echo ""
echo "For help with each sub-command run:" echo "For help with each sub-command run:"
...@@ -20,7 +21,6 @@ sub_help(){ ...@@ -20,7 +21,6 @@ sub_help(){
} }
sub_checkout(){ sub_checkout(){
echo "--------------CHECKING OUT GIT CODE--------------------"
cd /root/GitlabRunner/repo/ cd /root/GitlabRunner/repo/
ls ls
rm -rf ./spring-ci-advanced rm -rf ./spring-ci-advanced
...@@ -28,13 +28,11 @@ sub_checkout(){ ...@@ -28,13 +28,11 @@ sub_checkout(){
git config --global user.email 'truongbb@itsol.vn' git config --global user.email 'truongbb@itsol.vn'
git clone https://truongbb96:hoanghuynh0801@git.myitsol.com/truongbb96/spring-ci-advanced.git git clone https://truongbb96:hoanghuynh0801@git.myitsol.com/truongbb96/spring-ci-advanced.git
cd ./spring-ci-advanced cd ./spring-ci-advanced
echo "--------------DONE CHECKING OUT GIT CODE--------------------"
} }
sub_compile(){ sub_compile(){
# mvn install # mvn install
_docker_mvn compile -DskipTests _docker_mvn compile -DskipTests
} }
sub_sonar-scan(){ sub_sonar-scan(){
...@@ -50,12 +48,16 @@ sub_quality-gate(){ ...@@ -50,12 +48,16 @@ sub_quality-gate(){
--url http://192.168.1.210:9000/api/qualitygates/project_status?projectKey=spring-ci \ --url http://192.168.1.210:9000/api/qualitygates/project_status?projectKey=spring-ci \
--header 'cache-control: no-cache' --header 'content-type: application/json' | jq -r '.projectStatus.status') --header 'cache-control: no-cache' --header 'content-type: application/json' | jq -r '.projectStatus.status')
echo "Quality gate status: " ${qualityGateStatus} echo "Quality gate status: " ${qualityGateStatus}
if [[ ${qualityGateStatus} = "OK" ]] if [[ ${qualityGateStatus} != "OK" ]]
then then
echo "OK" # TODO - Fail quality gate --> stop pipeline???
else echo "*******QUALITY GATE FAILED!**********"
echo "NOK"
fi fi
return ${qualityGateStatus}
}
sub_build-up(){
echo "TODO - BUILD UP"
} }
sub_send-email(){ sub_send-email(){
...@@ -71,7 +73,6 @@ _docker_mvn() { ...@@ -71,7 +73,6 @@ _docker_mvn() {
mvn -U clean $@ mvn -U clean $@
} }
sub_command=$1 sub_command=$1
case sub_command in case sub_command in
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment