【发布时间】:2021-05-10 04:44:52
【问题描述】:
我在 Azure DevOps 中创建了一个管道,用于构建 Angular 应用程序并在其上运行一些测试。我将管道分为两个作业,构建和测试。构建作业成功完成。即使 Build 作业已经完成,Test 作业也会再次从 Git 中签出代码。测试作业需要在构建作业中创建的文件才能像 npm 包一样成功运行。
这是我的 YAML 文件:
trigger:
- develop
variables:
npm_config_cache: $(Pipeline.Workspace)/.npm
system.debug: false
stages:
- stage: Client
pool:
name: Windows
jobs:
- job: Build
displayName: Build Angular
steps:
- template: templates/angularprodbuild.yml
- job: Test
displayName: Run Unit and Cypress Tests
dependsOn: Build
steps:
- template: templates/angularlinttest.yml
- template: templates/angularunittest.yml
- template: templates/cypresstest.yml
我的代理池是在阶段级别声明的,因此两个作业将使用同一个代理。我还在 Test 作业中添加了一个 dependsOn 以确保使用相同的代理。检查日志后,实际上使用了相同的代理。
如何让测试作业使用在构建作业中创建的文件而不再次签出代码?如果有帮助,我正在使用 Angular 11 和 Azure DevOps Server 2020。
【问题讨论】:
标签: azure-devops azure-pipelines