Must-share information (formatted with Markdown):
- which versions are you using (SonarQube Server / Community Build, Scanner, Plugin, and any relevant extension)
- how is SonarQube deployed: zip, Docker, Helm
- what are you trying to achieve
- what have you tried so far to achieve this
Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!
sonar-scan:
stage: scan
tags:
- 203-test
image: 192.168.10.207:10001/public/sonar-scanner-cli:5
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"
GIT_DEPTH: "0"
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
script:
- cd ./xxl-job-admin
- |
cat > sonar-project.properties <<EOF
sonar.projectKey=${CI_PROJECT_PATH_SLUG}
sonar.projectName=${CI_PROJECT_NAME}
sonar.projectVersion=${CI_COMMIT_SHORT_SHA}
sonar.sources=src
sonar.java.binaries=target/classes
sonar.host.url=${SONAR_HOST_URL}
sonar.token=${SONAR_TOKEN}
# 👇 多分支必须显式
sonar.branch.name=${CI_COMMIT_BRANCH}
sonar.qualitygate.wait=true
sonar.exclusions=**/*.js,**/*.jsx,**/*.ts,**/*.tsx,**/*.css,**/*.scss
EOF
- sonar-scanner -X
- echo ${CI_PROJECT_PATH_SLUG} - ${CI_PROJECT_NAME} - ${CI_COMMIT_SHORT_SHA} - ${CI_COMMIT_BRANCH