DotNetCoreCLI @ 2タスクを実行して復元、ビルド、テストするdevopsyamlパイプラインがあります。
1つ以上のテストが失敗した場合、パイプラインを続行して、devopsリリースの準備ができた出力を公開したいと思います。
最初に、失敗したテストの場合、パイプラインの実行全体で「ビルドに失敗しました」と報告されます。ビルドパイプラインyamlの先頭に以下を追加した後:
jobs:
- job: Build
continueOnError: true
「BuildPartiallySucceeded」が表示されます。
ただし、パイプライン実行の概要ページを確認すると、アーティファクトが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
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加