diff --git a/README.md b/README.md index 5bcd5a242e480f9e50f0435178c18715d3821b56..ba58a2cf5d8453c75dd26cf992e2740e4d6e581c 100644 --- a/README.md +++ b/README.md @@ -31,9 +31,9 @@ It is bound to the `test` stage, and uses the following variables: | :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.host.url=${SONAR_URL} -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` | | :lock: `SONAR_GITLAB_TOKEN` | GitLab [access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html) with `api` scope. When set, activates the [Sonar GitLab plugin](https://github.com/gabrie-allaigre/sonar-gitlab-plugin/#plugins-properties) integration. | _none_ | -| `SONAR_BRANCH_ANALYSIS_DISABLED` | Set to disable automatic [Pull Request Analysis](https://docs.sonarqube.org/latest/analysis/pull-request/) and [Branch Analysis](https://docs.sonarqube.org/latest/branches/overview/) | _none_ (enabled) | +| `SONAR_BRANCH_ANALYSIS_DISABLED` | Set to `true` to disable automatic [Pull Request Analysis](https://docs.sonarqube.org/latest/analysis/pull-request/) and [Branch Analysis](https://docs.sonarqube.org/latest/branches/overview/) | _none_ (enabled) | | `SONAR_GITLAB_ARGS` | Extra arguments to use with [Sonar GitLab plugin](https://github.com/gabrie-allaigre/sonar-gitlab-plugin/#plugins-properties) | `-Dsonar.gitlab.url=${CI_SERVER_URL} -Dsonar.gitlab.user_token=${SONAR_GITLAB_TOKEN} -Dsonar.gitlab.project_id=${CI_PROJECT_ID} -Dsonar.gitlab.commit_sha=${CI_COMMIT_SHA} -Dsonar.gitlab.ref_name=${CI_COMMIT_REF_NAME}` | -| `SONAR_AUTO_ON_DEV_DISABLED` | When set, SonarQube analysis becomes **manual** on development branches (automatic otherwise) | _none_ | +| `SONAR_AUTO_ON_DEV_DISABLED` | When set to `true`, SonarQube analysis becomes **manual** on development branches (automatic otherwise) | _none_ | #### Automatic Branch Analysis & Pull Request Analysis diff --git a/templates/gitlab-ci-sonar.yml b/templates/gitlab-ci-sonar.yml index bad23a61a35570887fdfb93a81ddf1d7625d44c0..4d5d5cf99807ea3dddebfa6c84aa80fac42bc934 100644 --- a/templates/gitlab-ci-sonar.yml +++ b/templates/gitlab-ci-sonar.yml @@ -119,7 +119,7 @@ stages: } function sonar_autodetect_mr() { - if [[ "$SONAR_BRANCH_ANALYSIS_DISABLED" ]] + if [[ "$SONAR_BRANCH_ANALYSIS_DISABLED" == "true" ]] then log_info "Branch Analysis and Merge Request Analysis are disabled" return @@ -278,7 +278,7 @@ stages: fi } - if [[ -z "$TEMPLATE_CHECK_UPDATE_DISABLED" ]]; then check_for_update sonar "1.3.2"; fi + if [[ "$TEMPLATE_CHECK_UPDATE_DISABLED" != "true" ]]; then check_for_update sonar "1.3.2"; fi unscope_variables # ENDSCRIPT @@ -316,7 +316,7 @@ sonar: # on production or integration: auto - if: '$CI_COMMIT_REF_NAME =~ $PROD_REF || $CI_COMMIT_REF_NAME =~ $INTEG_REF' # else (non-production, non-integration branches): manual if $SONAR_AUTO_ON_DEV_DISABLED - - if: $SONAR_AUTO_ON_DEV_DISABLED + - if: '$SONAR_AUTO_ON_DEV_DISABLED == "true"' when: manual allow_failure: true # else: auto & allow failure