azure-pipelines - use files from stage 1 in stage 2 in azure-pipeline
问题描述
I have a single pipeline in azure containing two stages: one for building and one for testing:
trigger:
- main
stages:
- stage: 'Checkout'
jobs:
- job: 'x86'
timeoutInMinutes: 60
pool: <mypool>
steps:
- checkout: self
lfs: true
- stage: 'CompileAndTest'
jobs:
- job: 'UnitTests'
timeoutInMinutes: 60
pool: <mypool>
steps:
- task: MSBuild@1
inputs:
solution: '$(Build.SourcesDirectory)/MyAssembly.csproj'
platform: 'x86'
configuration: 'Debug'
When executing that pipeline, stage Checkout
will first checkout the code to $(Build.SourceSirectory)
, which in my case resolved to D:\agents\build\_work\3\s
.
Afterwards the stage CompileAndTest
compiles the code. However MSBuild states
error MSB1009: project not found, project 'D:\agents\build\_work\4\s\MyAssembly.csproj'
So the variable Build.SourceDirectory
resolves to different locations between the two stages.
My pool only has a single agent, so I'm sure both jobs run on the same agent.
解决方案
Would recommend using the PublishBuildArtifacts task
Would look like:
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'drop'
The reference your folder via the $(Pipeline.Workspace)
built in variable
推荐阅读
- javascript - MongoDB按来源和目的地查找
- node.js - 试图让我的 Discord 机器人响应“我不是婴儿潮一代 >:(”但它不会响应。我该如何修复代码?
- reactjs - React hooks:如何只实例化一次实例变量
- c# - 允许每个程序集注册一次 AutoMapper 配置文件
- amazon-web-services - Prometheus:区分应用程序指标
- micropython - 如何摆脱一个while True网络循环?
- postgresql - 在新服务器中导入 postgreSQL 数据库时出现问题
- google-data-studio - 附加分区表格并混合到同一个 Google Data Studio 数据源中?
- python - 正则表达式:匹配 char + new line before (new line new line)
- python - 在 Python 中使用 Map-Reduce 实现 ARIMA 或 Holt Winter