Pipeline artifacts in Azure Pipelines

Azure Pipelines

Note

Pipeline artifacts are the next generation of build artifacts in Azure Pipelines and are currently in preview. For the current artifacts, see Build artifacts.

Pipeline artifacts help you store build outputs and move intermediate files between stages in your pipelines. Artifacts are the files that you want your build to produce. They can be anything that your team needs to test or deploy your app.

You’ll see the most benefit from pipeline artifacts if you have a build that produces large build outputs. If you’re an existing Azure Pipelines user, pipeline artifacts are automatically enabled for you.

Publish a pipeline artifact

In build artifacts, it's common to first copy files to $(Build.ArtifactStagingDirectory) and then use the Publish Build Artifacts task to publish that directory. With pipeline artifacts, we recommend pointing the Publish Pipeline Artifacts tasks directly to the paths to be published. This saves your build the time of creating a copy of the files that you want to publish.

steps:
- task: PublishPipelineArtifact@0
  inputs:
    artifactName: 'artifactName'
    targetPath: 'src/MyWebApp/bin/Release/netcoreapp2.0/linux-x64/publish'

Download pipeline artifacts

If you're using pipeline artifacts to deliver artifacts into a release pipeline, you don’t need to add the task. Release pipelines will automatically inject the task into your stages. If you want more control over how files are placed on disk, you can manually add the Download Pipeline Artifact task yourself. You can also use the task to download artifacts from a different pipeline.

steps:
- task: DownloadPipelineArtifact@0
  inputs:
    artifactName: 'artifactName'
    targetPath: $(System.DefaultWorkingDirectory)

Using .artifactignore files

.artifactignore files use the identical file-globbing syntax of .gitignore to provide a version-controlled way to specify which files should not be added to a Pipeline Artifact from a particular folder.

Using an .artifactignore file, it is possible to omit the targetPath parameter entirely, if you want to create a Pipeline Artifact containing everything in and under the working directory, minus all of the ignored files and folders.

In other words, with an .artifactignore file like this:

**/*
!*.exe

This build task will archive up all of the .exe files and nothing else.

More details about how to use these files are available at Use the .artifactignore file or .gitignore Documentation.