我想将 SonarQube 代码分析器添加到我们的管道流程中,但在尝试将 Sonarqube 配置(下面的“sonarqube-check”部分的代码)插入到 GitLab 存储库的 gitlab-ci.yml 文件时出现此错误: “此 GitLab CI 配置无效:jobs:deploy_prod 配置包含未知密钥:sonarqube-check”
整个 gitlab-ci.yml 文件:
#CI/CD
stages:
- deploy
deploy_test:
stage: deploy
script:
#some code here
when: manual
only:
- develop
tags:
- commoncode
deploy_staging:
stage: deploy
script:
#some code here
when: manual
only:
- master
tags:
- commoncode
deploy_prod:
stage: deploy
script:
#some code here
only:
- master
tags:
- commoncode
sonarqube-check:
image:
name: sonarsource/sonar-scanner-cli:latest
entrypoint: [""]
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
script:
- sonar-scanner
allow_failure: true
only:
- master
你能帮我使 yml 变得有效吗?