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:
- whoami
- unset SSH_ASKPASS
variables:
QUALITY_GATE: "OK"
stages:
- checkout
# - compile
......@@ -65,7 +68,8 @@ check_quality_gate:
- cd /root/GitlabRunner/repo/spring-ci-advanced
- ls
- chmod +x ./build-test.sh
- ./build-test.sh quality-gate
- export QUALITY_GATE = $(./build-test.sh quality-gate)
- echo $QUALITY_GATE
#build_up:
# stage: build_up
......
......@@ -12,6 +12,7 @@ sub_help(){
echo " compile Compile java code"
echo " sonar-scan Run sonar scanner"
echo " quality-gate Check quality gate"
echo " build-up Build project with docker"
echo " send-email Send email after stage/pipeline"
echo ""
echo "For help with each sub-command run:"
......@@ -20,7 +21,6 @@ sub_help(){
}
sub_checkout(){
echo "--------------CHECKING OUT GIT CODE--------------------"
cd /root/GitlabRunner/repo/
ls
rm -rf ./spring-ci-advanced
......@@ -28,13 +28,11 @@ sub_checkout(){
git config --global user.email 'truongbb@itsol.vn'
git clone https://truongbb96:hoanghuynh0801@git.myitsol.com/truongbb96/spring-ci-advanced.git
cd ./spring-ci-advanced
echo "--------------DONE CHECKING OUT GIT CODE--------------------"
}
sub_compile(){
# mvn install
_docker_mvn compile -DskipTests
}
sub_sonar-scan(){
......@@ -50,12 +48,16 @@ sub_quality-gate(){
--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')
echo "Quality gate status: " ${qualityGateStatus}
if [[ ${qualityGateStatus} = "OK" ]]
if [[ ${qualityGateStatus} != "OK" ]]
then
echo "OK"
else
echo "NOK"
# TODO - Fail quality gate --> stop pipeline???
echo "*******QUALITY GATE FAILED!**********"
fi
return ${qualityGateStatus}
}
sub_build-up(){
echo "TODO - BUILD UP"
}
sub_send-email(){
......@@ -71,7 +73,6 @@ _docker_mvn() {
mvn -U clean $@
}
sub_command=$1
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