We have a azure Yaml pipeline which builds a test app and stores this with dependencies in a zip file.
The final command in the process is
- powershell: Get-ChildItem -Path '$(Build.ArtifactStagingDirectory)' -recurse
to confirm the zip has been located and where it is stored, in this case we see location of:
Directory: D:\a\1\a\Output
and file details of
-a---- 12/12/2024 11:40 AM 36585678 RegressionTestSuite.zip
So that all looks good but now come my questions:
Thanks in advance for any advice/help
Kev
Will this file persist?
How do I execute this in a totally sperate Yaml file as part of a release pipeline?
TL;DR: Publish and download pipeline artifacts
You can download artifacts from earlier stages in your pipeline or from another pipeline. You can also publish your artifact to a file share or make it available as a pipeline artifact.
In the pipeline that builds the test app add the following task:
steps:
- task: PublishPipelineArtifact@1
inputs:
targetPath: $(Build.ArtifactStagingDirectory)
artifactName: myApp
You can confirm the artifact is published correctly in the portal:
You can download the artifacts in the same pipeline like this:
steps:
- task: DownloadPipelineArtifact@2
inputs:
artifact: myApp
Or, as an alternative, download a specific artifact from a specific build:
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download Pipeline Artifact'
inputs:
buildType: specific
project: 'xxxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx'
definition: 79
buildVersionToDownload: specific
pipelineId: 597
artifactName: myApp
See the documentation for more details.
Finally, to set how long to keep artifacts see Set retention policies for builds, releases, and tests.