【发布时间】:2022-12-09 13:50:38
【问题描述】:
我有一个发布输出的 azure devops 管道,
pool:
vmImage: 'windows-latest'
steps:
- script: |
dotnet restore
dotnet build --configuration Release
- task: DotNetCoreCLI@2
inputs:
command: publish
arguments: '--configuration Release --output publish_output'
projects: 'MyProject/*.csproj'
publishWebProjects: false
modifyOutputPath: false
zipAfterPublish: false
- task: ArchiveFiles@2
displayName: "Archive files"
inputs:
rootFolderOrFile: "$(System.DefaultWorkingDirectory)/publish_output"
includeRootFolder: false
archiveFile: "$(System.DefaultWorkingDirectory)/myapp.zip"
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(System.DefaultWorkingDirectory)/myapp.zip'
artifactName: 'myapp'
这有效。
另一个发布管道应该使用构建生成的工件,
trigger:
- main
variables:
azureSubscription: MySubscription
appName: myAppName
vmImageName: 'ubuntu-latest'
steps:
- task: DownloadBuildArtifacts@1
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'myapp'
downloadPath: '$(Build.ArtifactsDirectory)'
- task: AzureFunctionApp@1 # Add this at the end of your file
inputs:
azureSubscription: $(azureSubscription)
appType: functionApp # default is functionApp
appName: $(appName)
package: $(Build.ArtifactsDirectory)/**/*.zip
但这在 DownloadBuildArtifacts 任务中已经失败并出现错误:
##[error]Artifact myapp was not found for build xy.
我可以在日志中看到工件放置在某个文件夹中,
Upload 'D:\a\1\s\myapp.zip' to file container: '#/29596927/myapp'
但是没有信息 DownloadBuildArtifacts 任务在哪个位置搜索工件(至少我没有找到它,即使在管道运行中启用了分析)。我应该替换“Build.ArtifactsDirectory”还是其他地方有问题?
【问题讨论】:
标签: devops pipeline azure-artifacts