Reputation: 11
I have an azure pipeline with one of the task running the performance test and output the result in json file. I want to copy the Json file in another task where I am calling .Net unit test code to compare the key-value with expected json file. I am able to copy the file into some folder may it be custom folder
like TargetFolder: '$(Build.BinariesDirectory)/testfolder'
or in $(Build.BinariesDirectory)
. The file gets copied sussessfully.
But I am not able to read the file from the location where it gets copied for my next unit test task.
Is it possible to do ?
Upvotes: 0
Views: 960
Reputation: 15998
Yes, you can read files in any task of your build. As example:
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'
The result:
Upvotes: 1