Skip to content

Instantly share code, notes, and snippets.

Created September 28, 2021 04:54
What would you like to do?
GitLab CI pipeline to execute SonarQube Scan using maven and checking status using Sonar REST api
- codequality
stage: codequality
- demo
- echo "codequality started for project"
- export JAVA_HOME=/usr/lib/jvm/java-11-openjdk- && export PATH=$JAVA_HOME/bin:$PATH
- mvn clean package sonar:sonar -Dsonar.projectKey=$CI_PROJECT_NAME -Dsonar.projectName=acm-client-sdk -Dmaven.test.skip=true
- echo "codequality finised for project checking for qualitydate"
- sleep 10s
- result=$(curl$CI_PROJECT_NAME)
- echo $result | if [ $(python -c 'import sys, json; print json.load(sys.stdin)["projectStatus"]["status"]') == "ERROR" ]; then exit 1; else echo "Sonar quality gate passed"; fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment