diff --git a/README.md b/README.md index d7db8fb92ddeaf2d7bb0f7498cbd5a681cc1b82a..52b094f0de9c4997e4e3b617f1f93a6b545e00a1 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ It is bound to the `test` stage, and uses the following variables: | ------------------------ | ------------------------------- | ----------------------------- | | `SONAR_SCANNER_IMAGE` | The Docker image used to run [sonar-scanner](https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/) | `sonarsource/sonar-scanner-cli:latest` | | `SONAR_HOST_URL` | SonarQube server url | _none_ (disabled) | -| :lock: `SONAR_AUTH_TOKEN`| SonarQube authentication [token](https://docs.sonarqube.org/latest/user-guide/user-token/) (depends on your authentication method) | _none_ | +| :lock: `SONAR_TOKEN` | SonarQube authentication [token](https://docs.sonarqube.org/latest/user-guide/user-token/) (depends on your authentication method) | _none_ | | :lock: `SONAR_LOGIN` | SonarQube login (depends on your authentication method) | _none_ | | :lock: `SONAR_PASSWORD` | SonarQube password (depends on your authentication method) | _none_ | | `SONAR_BASE_ARGS` | SonarQube [analysis arguments](https://docs.sonarqube.org/latest/analysis/analysis-parameters/) | `-Dsonar.projectKey=${CI_PROJECT_PATH_SLUG} -Dsonar.projectName=${CI_PROJECT_PATH} -Dsonar.projectBaseDir=. -Dsonar.links.homepage=${CI_PROJECT_URL} -Dsonar.links.ci=${CI_PROJECT_URL}/-/pipelines -Dsonar.links.issue=${CI_PROJECT_URL}/-/issues` | diff --git a/kicker.json b/kicker.json index 2571b6899abd3527273e3cfb7382e59976edb8a2..22f59322b5c30c7b25ede1be083e31859e91b8c7 100644 --- a/kicker.json +++ b/kicker.json @@ -16,7 +16,7 @@ "mandatory": true }, { - "name": "SONAR_AUTH_TOKEN", + "name": "SONAR_TOKEN", "description": "SonarQube authentication [token](https://docs.sonarqube.org/latest/user-guide/user-token/) (depends on your authentication method)", "secret": true }, diff --git a/templates/gitlab-ci-sonar.yml b/templates/gitlab-ci-sonar.yml index 89e3b06c3c9542233849356bcb2f8f5481570ed7..d9f4750f8ee43702e94ed7c66f680e9dc592c319 100644 --- a/templates/gitlab-ci-sonar.yml +++ b/templates/gitlab-ci-sonar.yml @@ -319,7 +319,13 @@ sonar: log_warn '$SONAR_URL variable defined: use $SONAR_HOST_URL instead (see doc)' export SONAR_HOST_URL="$SONAR_URL" fi - - sonar-scanner ${TRACE+-Dsonar.verbose=true} $java_proxy_args ${SONAR_AUTH_TOKEN+-Dsonar.login=$SONAR_AUTH_TOKEN} ${SONAR_LOGIN+-Dsonar.login=$SONAR_LOGIN} ${SONAR_PASSWORD+-Dsonar.password=$SONAR_PASSWORD} $SONAR_BASE_ARGS $sonar_extra_args $sonar_mr_args + - | + if [[ "$SONAR_AUTH_TOKEN" ]] && [[ -z "$SONAR_TOKEN" ]] + then + log_warn '$SONAR_AUTH_TOKEN variable defined: use $SONAR_TOKEN instead (see doc)' + export SONAR_TOKEN="$SONAR_AUTH_TOKEN" + fi + - sonar-scanner ${TRACE+-Dsonar.verbose=true} $java_proxy_args ${SONAR_LOGIN+-Dsonar.login=$SONAR_LOGIN} ${SONAR_PASSWORD+-Dsonar.password=$SONAR_PASSWORD} $SONAR_BASE_ARGS $sonar_extra_args $sonar_mr_args rules: - !reference [.test-policy, rules]