I am trying to change SonarQube Quality Gate, add tag and make Sonar Project Public to private using gitlab-ci.yaml
in gitlab-ci.yaml:
SONAR_QUALITYGATE_NAME: "Cybersecurity_QG_Default" SONAR_VISIBILITY: "PRIVATE" #SONAR_CONFIG : '-Dsonar.qualitygate.timeout=360 -Dsonar.java.binaries=.' SONAR_CONFIG : "-Dsonar.qualitygate.timeout=360 -Dsonar.java.binaries=. -Dsonar.visibility=$SONAR_VISIBILITY -Dsonar.projectTags=${PROJECT_NAME}_${SERVICE_NAME} -Dsonar.qualitygate=$SONAR_QUALITYGATE_NAME"
in template file:
sonarqube scan: stage: code scan image: $DOMAIN_NAME/hubdocker/sonarsource/sonar-scanner-cli:latest tags: - docker variables: SONAR_SCANNER_OPTS: -Djavax.net.ssl.trustStore=/etc/ssl/certs/cacerts -Djavax.net.ssl.trustStorePassword=changeit SONAR_QUALITYGATE_NAME: "Cybersecurity_QG_Default" SONAR_VISIBILITY: "private" script: #- echo $SONAR_VISIBILITY ${PROJECT_NAME}_${SERVICE_NAME $SONAR_QUALITYGATE_NAME - echo parameter $SONAR_CONFIG - cat /opt/sonar-scanner/conf/sonar-scanner.properties - sonar-scanner -Dsonar.projectKey=$PROJECT_NAME-$SERVICE_NAME -Dsonar.sources=. -Dsonar.host.url=https://$DOMAIN_NAME_SAST -Dsonar.login=$SONARQUBE_TOKEN -Dsonar.qualitygate.wait=true -Dsonar.visibility=PRIVATE -Dsonar.projectTags="DevOps" -Dsonar.qualitygate=Cybersecurity_QG_Default $SONAR_CONFIG - cat /opt/sonar-scanner/conf/sonar-scanner.properties - echo End allow_failure: true only: - develop
But SonarQube it’s still showing Visibility PUBLIC, no Tags added and no Quality Gate changed to Cybersecurity_QG_Default!
Gilab Console Output:
WARN: Property 'sonar.visibility' with value 'PRIVATE' is overridden with value 'private' WARN: Property 'sonar.projectTags' with value 'DevOps' is overridden with value 'fik-test_java' WARN: Property 'sonar.qualitygate' with value 'Cybersecurity_QG_Default' is overridden with value 'Cybersecurity_QG_Default'
SonaQube Prject information shows: