简体   繁体   中英

How to share a file between two builds of same pipeline in Azure Devops?

I've recently started using Azure DevOps & I want to store a .json file generated during one nightly scheduled build run somewhere so that when the nightly scheduled build runs next time for the same pipeline, I should be able to use that stored json file in this current build run. I've tried Publish and Download Pipeline Artifacts task but it ask me to specify the specific build from where the artifacts should be downloaded which in my case is not possible to specify as there are multiple Individual CI builds that happens throughout the day between those nightly scheduled build.

You could use a pipeline tag to identify the right build:

  1. At the end of the nightly scheduled build, make it tag itself as "nightly" eg with a powershell task calling build.addbuildtag
  2. The next nightly build can identify the previous one by this tag and download the artefact it needs:
    - task: DownloadPipelineArtifact@2
      inputs:
        source: 'specific'
        project: 'FabrikamFiber'
        pipeline: 12
        runVersion: 'latest'
        tags: 'nightly'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM