docker - 组合 DockerCompose@0 任务以在 Azure 管道中运行特定服务
问题描述
我有以下 azure-pipeline 来为 2 个单元测试项目运行两个 docker compose 任务。
- task: DockerCompose@0
displayName: 'Run Application Unit Tests'
inputs:
containerregistrytype: 'Azure Container Registry'
azureSubscription: $(azureSubscription)
azureContainerRegistry: $(azureContainerRegistry)
dockerComposeFile: '**/docker-compose.yml'
action: 'Run a specific service'
serviceName: 'application.tests'
detached: false
- task: DockerCompose@0
displayName: 'Run Infrastructure Unit Tests'
inputs:
containerregistrytype: 'Azure Container Registry'
azureSubscription: $(azureSubscription)
azureContainerRegistry: $(azureContainerRegistry)
dockerComposeFile: '**/docker-compose.yml'
action: 'Run a specific service'
serviceName: 'infrastructure.tests'
detached: false
- task: PublishTestResults@2
displayName: 'Publish test results'
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: '/opt/vsts/work/_temp/*.trx'
mergeTestResults: true
failTaskOnFailedTests: true
- task: PublishCodeCoverageResults@1
displayName: 'Publish coverage report'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '/opt/vsts/work/_temp/*.cobertura.xml'
这很好用,并且结合了测试和代码覆盖结果。但是我必须在单独的任务中定义管道中的每个单元测试项目。
有没有办法在单个 azure-pipeline 任务中运行所有项目的测试?
这两个项目都在同一个解决方案 (.NET Core) 中。我知道我可以在一个项目中进行测试,但希望保持关注点分离。
解决方案
推荐阅读
- javascript - 在 Angular 中,一个组件如何拥有多个 HTML 模板?
- deep-learning - 训练时 PyTorch 崩溃:可能的图像解码错误、张量值、损坏的图像。(运行时错误)
- python - 在 Bash 中执行 python 脚本时出现错误字符
- python - Python - 用循环编写多个文件的函数
- sql-server - 在 SQL Server 和 Entity Framework 中比较相同的表数据并排除行
- python - 如何从beautifulsoup输出python中读取链接
- python - 如何将流媒体更改为空闲?
- pyspark - 在 dropMalformed 模式下读取 csv 文件并在结果数据框中记录计数的问题
- solidity - 通过合约将代币从地址A发送到地址B
- kubernetes - 在 Kubernetes 中运行的 Prometheus 从服务器返回 Empty 回复并且权限被拒绝