我们在 Azure DevOps 中构建了管道,其中包含两个作业,这些作业从同一个存储库(角度前端和 java 后端)构建两个项目。非常缩写的构建管道看起来像这样。此构建管道也用于 PR 的构建验证策略。
trigger:
- develop
jobs:
- job: Backend
steps:
...
- task: SonarCloudPrepare@1
displayName: "Prepare analysis on SonarCloud"
inputs:
SonarCloud: OurProject
organization: ourorg
scannerMode: Other
extraProperties: |
sonar.exclusions=**/jalo/**,**/constants/**,**/*Standalone.java,**/_ui-src/**
sonar.projectKey=backendproj
sonar.projectName=xxxBackend
- task: Gradle@2
inputs:
sonarQubeRunAnalysis: true
- task: SonarCloudPublish@1
- job: Frontend
steps:
...
- task: SonarSource.sonarcloud.14d9cde6-c1da-4d55-aa01-2965cd301255.SonarCloudPrepare@1
displayName: "Prepare analysis on SonarCloud"
inputs:
SonarCloud: OurProj
organization: ourorg
scannerMode: CLI
configMode: manual
cliProjectKey: FrontendKey
cliProjectName: xxxFrontend
cliSources: "somepath"
extraProperties: |
sonar.exclusions=**/src/webApplicationInjector.js,**/node_modules/*
...
- task: SonarSource.sonarcloud.ce096e50-6155-4de8-8800-4221aaeed4a1.SonarCloudAnalyze@1
displayName: "Run Code Analysis"
- task: SonarSource.sonarcloud.38b27399-a642-40af-bb7d-9971f69712e8.SonarCloudPublish@1
displayName: "Publish Quality Gate Result"
打开 PR 运行的构建时,我们会看到以下状态:
但是当我们打开 PR 时,我们会看到:
当点击“质量门通过”时,它链接到 Frontpage Sonarcloud 项目,在这种情况下是成功的。
是否有可能两个工作都以相同的名称发布其状态,即“SonarCloud/质量门”,因此只有最后一个完成最后被政策检查?