.net core devops管道yaml忽略未通过的测试DotNetCoreCLI@2任务
我有一条devops yaml管道在运行DotNetCoreCLI@2要恢复、构建和测试的任务 如果一个或多个测试失败,我希望管道继续并发布输出,为devops版本做好准备 最初,对于失败的测试,整个管道执行将报告“构建失败”。在构建管道yaml的顶部添加以下内容后:.net core devops管道yaml忽略未通过的测试DotNetCoreCLI@2任务,.net-core,azure-devops,yaml,azure-pipelines,.net Core,Azure Devops,Yaml,Azure Pipelines,我有一条devops yaml管道在运行DotNetCoreCLI@2要恢复、构建和测试的任务 如果一个或多个测试失败,我希望管道继续并发布输出,为devops版本做好准备 最初,对于失败的测试,整个管道执行将报告“构建失败”。在构建管道yaml的顶部添加以下内容后: jobs: - job: Build continueOnError: true 我现在得到“构建部分成功” 但是,当我检查pipeline execution summary页面时,我看到有0个工件: 即使测
jobs:
- job: Build
continueOnError: true
我现在得到“构建部分成功”
但是,当我检查pipeline execution summary页面时,我看到有0个工件:
即使测试失败,我如何使管道发布
为完整起见,完整的yaml如下所示
stages:
- stage: Build
jobs:
- job: Build
continueOnError: true
pool:
name: Hosted Windows 2019 with VS2019
demands:
- msbuild
- visualstudio
variables:
solution: '**/*.sln'
projects: '**/Interfaces.Avaloq.Presentation.AzureFunctions.csproj'
unitTestProjects: '**/*Testing.Unit*/*.csproj'
integrationTestProjects: '**/*Testing.Integration*/*.csproj'
buildPlatform: 'Any CPU'
buildConfiguration: 'Debug'
steps:
- script: |
- task: DotNetCoreCLI@2
displayName: Restore Functions
inputs:
command: restore
projects: '$(projects)'
feedsToUse: config
nugetConfigPath: nuget.config
- task: DotNetCoreCLI@2
displayName: Build Functions
inputs:
command: build
projects: '$(projects)'
arguments: '--configuration $(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: Restore Unit Tests
inputs:
command: restore
projects: '$(unitTestProjects)'
feedsToUse: config
nugetConfigPath: nuget.config
- task: DotNetCoreCLI@2
displayName: Build Unit Tests
inputs:
command: build
projects: '$(unitTestProjects)'
arguments: '--configuration $(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: Run Unit Tests
inputs:
command: 'test'
projects: '$(unitTestProjects)'
arguments: --filter Category!=ExcludeFromBVT
testRunTitle: 'Unit Tests'
feedsToUse: config
nugetConfigPath: nuget.config
- task: AzurePowerShell@4
inputs:
azureSubscription: 'Design Subscription (xxx)'
ScriptType: 'InlineScript'
Inline: |
Set-Location $env:AGENT_WORKFOLDER
Get-ChildItem -Recurse
azurePowerShellVersion: 'LatestVersion'
- task: DotNetCoreCLI@2
displayName: Publish
inputs:
command: publish
arguments: '--configuration $(buildConfiguration) --output $(build.artifactstagingdirectory)'
projects: '$(projects)'
publishWebProjects: false
zipAfterPublish: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: ArmTemplate'
inputs:
PathtoPublish: Interfaces.Avaloq.Deployment
ArtifactName: RGDeploy
如果测试失败,请在测试步骤级别添加
continueOnError:true
。在作业级别添加它将导致下一个(依赖)作业运行。请比较一下:
- 作业级别上的连续错误:
- 步骤级别上的continueOnError: