如何从作业1到作业2的Azure管道访问更新的文件 [英] How to access updated files from job 1 to job 2 azure pipeline

查看:61
本文介绍了如何从作业1到作业2的Azure管道访问更新的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Xunit azure存储库有1个azure构建管道,该管道有2个工作, 第一个作业运行.cs文件,该文件将更新json文件(customerdata.json).有什么方法可以在第二个作业中读取此文件并发送SQS消息.这可能是个老问题,但是我是新的Azure管道,因此不确定如何为此编写yaml. 另外,我正在使用自托管代理池.

I have 1 azure build pipeline for my Xunit azure repository, which is having 2 jobs, First job runs .cs file which will update an json file (customerdata.json) . Is there any way to read this file in second job and send SQS message. This might be old question but I'm new azure pipeline, so not sure about how to write yaml for this. Also I am using self host agent pool.

推荐答案

您可以通过在job 1末尾发布构建工件(task: PublishBuildArtifacts)并在job 2开头下载构建工件(<task: DownloadBuildArtifacts).

You can achieve that by publishing the build artifacts (task: PublishBuildArtifacts) at the end of the job 1 and downloading them at the beginning of job 2 (task: DownloadBuildArtifacts).

[...]
- job: 
  steps:
    [...]
    - task: PublishBuildArtifacts@1
      inputs:
        PathtoPublish: '$(Agent.BuildDirectory)/s/path-to/customerdata.json'
        ArtifactName: 'customerdata'
        publishLocation: 'Container'
- job:
  steps:
    - task: DownloadBuildArtifacts@0
      inputs:
        buildType: 'current'
        downloadType: 'single'
        artifactName: 'customerdata'
        downloadPath: '$(System.ArtifactsDirectory)' #Path where to download the artifact
    [...]

这篇关于如何从作业1到作业2的Azure管道访问更新的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆