Azure Devops第二管道消耗另一条管道的工件被困在工作中
我们正在为Web .NET应用程序运行一组管道。触发管道(构建)正在馈送另一个管道(释放)。第二个,触发的管道被卡在作业上正在等待
。我们使用的是Azure DevOps的云版本,只有1个由Azure托管的代理。
构建管道(部分)是以下
trigger:
branches:
include:
- main
pr:
- main
variables:
solution: '**/*.sln'
NUGET_PACKAGES: $(Pipeline.Workspace)/.nuget/packages
group: 'Global - BuildSet'
stages:
- stage: build
displayName: Build
pool:
vmImage: $(vmImageName)
jobs:
- job: Build
displayName: Build
steps:
- task: NuGetToolInstaller@1
displayName: 'NuGet tool installer'
- task: Cache@2
displayName: Cache
inputs:
key: 'nuget | "$(Agent.OS)" | **/packages.lock.json,!**/bin/**,!**/obj/**'
path: '$(NUGET_PACKAGES)'
cacheHitVar: 'CACHE_RESTORED'
- task: NuGetCommand@2
displayName: 'NuGet restore'
condition: ne(variables.CACHE_RESTORED, true)
inputs:
command: 'restore'
restoreSolution: '$(solution)'
-...
- publish: $(Build.artifactstagingdirectory)
artifact: $(ArtifactName)
版本管道是以下
trigger: none
pr: none
resources:
pipelines:
- pipeline: 'bak-ak'
source: 'BAK - Build'
trigger:
branches:
- main
parameters:
- name: 'stages'
type: object
default:
- stage: development
dependsOn:
- stage: staging
variableGroup:
- group: 'Staging - BAK'
- group: 'Staging - BuildSet'
dependsOn: 'development'
variables:
solution: '**/*.sln'
NUGET_PACKAGES: $(Pipeline.Workspace)/.nuget/packages
group: 'Global - BuildSet'
stages:
- ${{each stage in parameters.stages}}:
- stage: ${{ stage.stage }}
variables:
- group: '${{ stage.stage }} - BAK'
- group: '${{ stage.stage }} - BuildSet'
dependsOn: ${{ stage.dependsOn }}
displayName: Release
pool:
vmImage: $(vmImageName)
jobs:
- deployment: ${{ stage.stage }}
displayName: ${{ stage.stage }}
environment: ${{ stage.stage }}
strategy:
runOnce:
deploy:
steps:
- download: 'BAK-Release'
artifact: $(ArtifactName)
- task: ExtractFiles@1
displayName: 'Extract files'
inputs:
destinationFolder: '$(Agent.BuildDirectory)/$(ArtifactName)'
archiveFilePatterns: '$(Agent.BuildDirectory)/$(ArtifactName)/**/*.zip'
cleanDestinationFolder: false
-...
- task: AzureWebApp@1
displayName: 'Deploy Azure App Service'
inputs:
azureSubscription: '$(AzureServiceConnection)'
appType: 'webApp'
appName: '$(WebAppName)'
package: '$(Agent.BuildDirectory)/$(ArtifactName)'
两个YML文件在同一git项目下,同一文件夹,同一Azure DevOps项目。发行管道背后的想法是由从构建管道成功构建并部署到N环境的成功触发的。每个环境的变量在库下,并且发行管线可以访问这些变量组。发行管线以正确的名称显示了当前两个不同阶段的阶段。我能够从发行管道中下载日志,并且可以看到所有变量已正确替换。不幸的是,我无法从发行管道中粘贴日志,因为它包含敏感信息。
构建管道从 deploymentConfiguration/build-azure-pipelines.yml
并且该版本管道从 deploymentConfiguration/Release-azure-pipelines.yml
构建和释放管道都设置为主要分支我正在使用的当前分支(不是Main)。 构建管道分支 释放管道分支
我已经创建了一个PR到Main,当我推上分支时,构建管道触发了一个构建,并且在完成后,释放管道开始,但在2之后悬挂2秒。
任何人都知道什么问题并且管道被卡住了吗?此时我没有想法。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在设置中发现了问题。
在第二个管道中定义资源时,会触发自动下载伪像。这意味着
发布管道
不需要步骤不仅要与发布资源相同,因此,在我的情况下,它应该是
bak-ak 。参考:
I found the problem with my setup.
When the resource is defined in the second pipeline, an auto download artifact is triggered. That means that the
release pipeline
does not need the stepNot only that, the download string must be the same name as the release resource, in my case it should have been
bak-ak
. Ref:在这里是REST API:构建 - 获取构建日志,您可以使用此API获取每个构建任务日志。
您是否在本地测试了Nuget配置?
Here is the Rest API: Builds - Get Build Logs, you could use this API to get every build task log.
Have you tested your nuget config locally?