簡體   English   中英

是否可以復制一個任務的 output 文件並從 Azure 管道中的下一個任務訪問?

[英]Is it possible to copy output file of one task to be and access from next task in the Azure pipeline?

我有一個 azure 管道,其中一個任務運行性能測試,output 結果在 json 文件中。 我想在我調用的另一個任務中復制 Json 文件。Net 單元測試代碼將鍵值與預期的 json 文件進行比較。 我能夠將文件復制到某個文件夾中可能是自定義文件夾
TargetFolder: '$(Build.BinariesDirectory)/testfolder'或在$(Build.BinariesDirectory)中。 該文件被成功復制。

但是我無法從為我的下一個單元測試任務復制文件的位置讀取文件。

有可能嗎?

是的,您可以在構建的任何任務中讀取文件。 例如:

pool:
  name: Azure Pipelines

steps:
- script: |
   @echo off   
   echo Write your commands here> test.txt   
   echo Hello world>> test.txt   
  displayName: 'Command Line Script'

- task: CopyFiles@2
  displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
  inputs:
    SourceFolder: .
    TargetFolder: '$(Build.ArtifactStagingDirectory)'

- script: 'type $(Build.ArtifactStagingDirectory)\test.txt'
  displayName: 'Command Line Script'

結果:

在此處輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM