diff --git a/README.md b/README.md index 69aac89b4a52d646712d26b9316d3bf065ab3e33..f9b98c64e49747d812981e95903e4b5cf5b276f3 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ It is bound to the `test` stage, and uses the following variables: | Name | description | default value | | ------------------------ | -------------------------------------- | ----------------- | | `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/) | `sonar:sonar -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 617b8ef68c2d53c0df806569660aae6d439ec642..dac9f5addf95d531e42fd6e9a6722da8911d5667 100644 --- a/kicker.json +++ b/kicker.json @@ -53,7 +53,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-maven.yml b/templates/gitlab-ci-maven.yml index 24f23fd9a3a791df93f5863caaf7ac6f763ab5ff..4f7a7acf649132f2863bf724a1939d90d897204a 100644 --- a/templates/gitlab-ci-maven.yml +++ b/templates/gitlab-ci-maven.yml @@ -149,9 +149,9 @@ stages: } function sonar_http_auth_args() { - if [[ -n "$SONAR_AUTH_TOKEN" ]] + if [[ -n "$SONAR_TOKEN" ]] then - echo "$SONAR_AUTH_TOKEN:" + echo "$SONAR_TOKEN:" elif [[ -n "$SONAR_LOGIN" ]] && [[ -n "$SONAR_PASSWORD" ]] then echo "$SONAR_LOGIN:$SONAR_PASSWORD" @@ -506,8 +506,14 @@ mvn-sonar: log_warn '$SONAR_URL variable defined: use $SONAR_HOST_URL instead (see doc)' export SONAR_HOST_URL="$SONAR_URL" fi + - | + 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 - if [[ "$SONAR_GITLAB_TOKEN" ]]; then sonar_extra_args="$SONAR_GITLAB_ARGS"; fi - - mvn ${TRACE+-Dsonar.verbose=true} $MAVEN_CLI_OPTS $mvn_settings_opt $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 + - mvn ${TRACE+-Dsonar.verbose=true} $MAVEN_CLI_OPTS $mvn_settings_opt $java_proxy_args ${SONAR_LOGIN+-Dsonar.login=$SONAR_LOGIN} ${SONAR_PASSWORD+-Dsonar.password=$SONAR_PASSWORD} $SONAR_BASE_ARGS $sonar_extra_args $sonar_mr_args - if [[ "$SONAR_QUALITY_GATE_ENABLED" == "true" ]]; then sonar_quality_gate_check; fi rules: # exclude if $SONAR_URL and $SONAR_HOST_URL not set