【发布时间】:2022-11-03 00:52:17
【问题描述】:
我在 Azure DevOps 中有一个构建管道,其工作步骤在管道执行时被跳过。结果,没有创建工件,因此后续发布管道失败。这是我管道的 yaml(为了保护我的公司而匿名):
parameters:
- name: buildConfig
displayName: Build Configuration to Use
default: Debug
values:
- Debug
- Release
trigger:
branches:
include:
- '*'
exclude:
- 'main'
variables:
buildConfiguration: ${{ parameters.buildConfig }}
# Azure Resource Manager connection created during pipeline creation
azureSubscription: 'MyAzureSubscription'
# Function app name
functionAppName: 'MyFunction'
# Agent VM image name
vmImageName: 'windows-latest'
# Working Directory
workingDirectory: '$(System.DefaultWorkingDirectory)/MySolution'
testingDirectory: '$(System.DefaultWorkingDirectory)/MySolution.UnitTests'
stages:
- stage: Build
displayName: Build Stage
jobs:
- job: Build
displayName: Build
pool:
vmImage: $(vmImageName)
steps:
- task: UseDotNet@2
displayName: Setup Net Core 3.1.x
inputs:
packageType: 'sdk'
version: '3.1.x'
- task: DotNetCoreCLI@2
displayName: Restore Nuget Packages
inputs:
command: restore
projects: '**/*.csproj'
feedsToUse: 'select'
vstsFeed: 'xxxxxx'
includeNuGetOrg: true
- task: DotNetCoreCLI@2
displayName: Build the Assembly
inputs:
command: 'build'
projects: $(workingDirectory)/*.csproj
arguments: '--output $(System.DefaultWorkingDirectory)/publish_output --configuration $(BuildConfiguration)'
- task: DotNetCoreCLI@2
displayName: Run Unit Tests
inputs:
command: 'test'
projects: $(testingDirectory)/*.csproj
enabled: false
- task: ArchiveFiles@2
displayName: 'Archive files'
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)/publish_output'
includeRootFolder: false
archiveType: zip
archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
replaceExistingArchive: true
- publish: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
artifact: drop
正如您在这张图片中看到的,当管道运行时,管道的大部分任务都被跳过(或者 yaml 解析器无法识别):
因此,当我的发布管道运行时,它以完美的教科书方式定义,如下所示:
我(自然)得到这个错误:
2022-11-01T23:54:31.6148895Z ##[section]Starting: Deploy Azure Function App
2022-11-01T23:54:31.7167183Z ==============================================================================
2022-11-01T23:54:31.7168124Z Task : Azure Functions
2022-11-01T23:54:31.7168797Z Description : Update a function app with .NET, Python, JavaScript, PowerShell, Java based web applications
2022-11-01T23:54:31.7169159Z Version : 1.211.1
2022-11-01T23:54:31.7169691Z Author : Microsoft Corporation
2022-11-01T23:54:31.7170251Z Help : https://aka.ms/azurefunctiontroubleshooting
2022-11-01T23:54:31.7170636Z ==============================================================================
2022-11-01T23:54:35.3856852Z Got service connection details for Azure App Service:'MyFunctionApp'
2022-11-01T23:54:35.7752025Z ##[error]Error: No package found with specified pattern: D:\a\r1\a\**\*.zip<br/>Check if the package mentioned in the task is published as an artifact in the build or a previous stage and downloaded in the current job.
2022-11-01T23:54:35.7842428Z ##[section]Finishing: Deploy Azure Function App
我究竟做错了什么?我的 YAML 语法是否无效,即使我使用在线 YAML linter 成功验证了它?此外,我几乎逐字地从工作管道中复制了这个 YAML。有什么建议么?
【问题讨论】:
标签: c# asp.net-core azure-devops yaml azure-pipelines