gitlab-sonar-scanner
gitlab-sonar-scanner copied to clipboard
Unexpected external job to the pipeline
Hi all, when i run sonarqube analysis on master branch i see, at the end of the pipeline, an unexpected job.
How i can remove it?
This not happens when use another branch, also with publishing enabled.
This is my yaml gitlab file
.quality_variables: &quality_variables
SONAR_URL: https://xxxxxxxxxxxxxx
.quality_template: &quality_template
stage: quality
image: ciricihq/gitlab-sonar-scanner
<<: *runner
dependencies:
- npm:test
cache: {}
before_script:
- echo "sonar.login=${SONAR_TOKEN}" >> sonar-project.properties
script:
- |
gitlab-sonar-scanner \
-Dsonar.gitlab.project_id=$CI_PROJECT_ID \
-Dsonar.gitlab.user_token=$GITLAB_TOKEN \
-Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA \
-Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME
except:
variables:
- $SKIP_QUALITY == "true"
quality:preview:
<<: *quality_template
variables:
<<: *quality_variables
SONAR_ANALYSIS_MODE: "preview"
only:
refs:
- /^epic\/*/
- /^hotfix\/*/
- /^feature\/*/
- test
quality:publish:
<<: *quality_template
variables:
<<: *quality_variables
SONAR_ANALYSIS_MODE: "publish"
only:
refs:
- master
Regards
I have the same issue, but adding the "quality" stage as "external".
@Zero-2 Can you understand and solve your issue?

sonarqube:
image: ciricihq/gitlab-sonar-scanner:latest
stage: Quality
variables:
SONAR_URL: "http://abc.xyz/"
SONAR_ANALYSIS_MODE: "publish"
script:
- gitlab-sonar-scanner
-Dsonar.host.url=${SONAR_URL}
-Dsonar.projectKey=${CI_PROJECT_NAME}
-Dsonar.projectName=${CI_PROJECT_NAME}
-Dsonar.projectVersion=${CI_COMMIT_TAG}
-Dsonar.links.homepage=${CI_PROJECT_URL}
-Dsonar.links.ci=${CI_PROJECT_URL}/pipelines
-Dsonar.links.scm=${CI_REPOSITORY_URL}
-Dsonar.projectBaseDir=$(pwd)
-Dsonar.sources=app
-Dsonar.sourceEncoding=UTF-8
-Dsonar.exclusions=app/Console/**,app/Exceptions/**
-Dsonar.gitlab.project_id=${CI_PROJECT_ID}
-Dsonar.gitlab.commit_sha=${CI_COMMIT_SHA}
-Dsonar.gitlab.ref_name=${CI_COMMIT_REF_NAME}
-Dsonar.php.tests.reportPath=${REPORT_PATH}/logfile.xml
-Dsonar.php.coverage.reportPaths=${REPORT_PATH}/coverage.xml
except:
- /^hotfix.*$/i
allow_failure: true
@Zero-2 I found a way around this problem.
Do not enter the property SONAR_ANALYSIS_MODE
(~preview
~ now is issues
nor publish
)
PS: However this does not send the review for SonarQube =(

sonarqube:
image: ciricihq/gitlab-sonar-scanner:latest
stage: Quality
variables:
SONAR_URL: "http://abc.xyz/"
script:
- ...