Uredi

Deli z drugimi prek


PublishPipelineArtifact@1 - Publish Pipeline Artifacts v1 task

Use this task to publish (upload) a file or directory as a named artifact for the current run.

Use this task to publish (upload) a file or directory as a named artifact for the current run.

Important

This task is supported on Azure DevOps Services only. If you use it on Azure DevOps Server, you'll receive an error message similar to Pipeline Artifact Task is not supported in on-premises. Please use Build Artifact Task instead. Use Publish Build Artifacts if you're using Azure DevOps Server or TFS 2018.

Syntax

# Publish Pipeline Artifacts v1
# Publish (upload) a file or directory as a named artifact for the current run.
- task: PublishPipelineArtifact@1
  inputs:
    targetPath: '$(Pipeline.Workspace)' # string. Alias: path. Required. File or directory path. Default: $(Pipeline.Workspace).
    #artifact: # string. Alias: artifactName. Artifact name. 
    publishLocation: 'pipeline' # 'pipeline' | 'filepath'. Alias: artifactType. Required. Artifact publish location. Default: pipeline.
    #fileSharePath: # string. Required when artifactType = filepath. File share path. 
    #parallel: false # boolean. Optional. Use when artifactType = filepath. Parallel copy. Default: false.
    #parallelCount: '8' # string. Optional. Use when artifactType = filepath && parallel = true. Parallel count. Default: 8.
    #properties: # string. Custom properties.
# Publish Pipeline Artifacts v1
# Publish (upload) a file or directory as a named artifact for the current run.
- task: PublishPipelineArtifact@1
  inputs:
    targetPath: '$(Pipeline.Workspace)' # string. Alias: path. Required. File or directory path. Default: $(Pipeline.Workspace).
    #artifact: # string. Alias: artifactName. Artifact name. 
    publishLocation: 'pipeline' # 'pipeline' | 'filepath'. Alias: artifactType. Required. Artifact publish location. Default: pipeline.
    #fileSharePath: # string. Required when artifactType = filepath. File share path. 
    #parallel: false # boolean. Optional. Use when artifactType = filepath. Parallel copy. Default: false.
    #parallelCount: '8' # string. Optional. Use when artifactType = filepath && parallel = true. Parallel count. Default: 8.

Inputs

targetPath - File or directory path
Input alias: path. string. Required. Default value: $(Pipeline.Workspace).

Specifies the path of the file or directory to publish. Can be absolute or relative to the default working directory. Can include variables, but wildcards are not supported. See Artifacts in Azure Pipelines for more information.


artifact - Artifact name
Input alias: artifactName. string.

Specifies the name of the artifact to publish. It can be any name you choose, for example drop. If not set, the default is a unique ID scoped to the job.

Important

Artifact name cannot contain \, /, ", :, <, >, |, *, or ?.


publishLocation - Artifact publish location
Input alias: artifactType. string. Required. Allowed values: pipeline (Azure Pipelines), filepath (A file share). Default value: pipeline.

Specifies whether to store the artifact in Azure Pipelines or to copy it to a file share that must be accessible from the pipeline agent.


fileSharePath - File share path
string. Required when artifactType = filepath.

Specifies the file share where the artifact files are copied. This can include variables, for example \\my\\share\\$(Build.DefinitionName)\\$(Build.BuildNumber). Publishing artifacts from a Linux or macOS agent to a file share is not supported, for example \\server\folderName.


parallel - Parallel copy
boolean. Optional. Use when artifactType = filepath. Default value: false.

Specifies whether to copy files in parallel using multiple threads for greater potential throughput. If this setting is not enabled, one thread will be used.


parallelCount - Parallel count
string. Optional. Use when artifactType = filepath && parallel = true. Default value: 8.

Specifies the degree of parallelism, or the number of threads used, to perform the copy. The value must be between 1 and 128.


properties - Custom properties
string.

Specifies the custom properties to associate with the artifact. Use a valid JSON string with the prefix user- on all keys.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Remarks

Publishing is not supported in classic release pipelines.

Note

Publish Pipeline Artifacts is not supported in on-premises. Please use Publish Build Artifacts if you're using Azure DevOps Server or TFS 2018. If you use it on Azure DevOps Server, you'll receive an error message similar to Pipeline Artifact Task is not supported in on-premises. Please use Build Artifact Task instead..

The publish and download keywords are shortcuts for the PublishPipelineArtifact@1 and DownloadPipelineArtifact@2 tasks. See steps.publish and steps.download for more details.

Tip

You can use the .artifactignore file to control which files will be published.

I'm having issues with publishing my artifacts. How can I view the detailed logs?

To enable detailed logs for your pipeline:

  1. Edit your pipeline and select Variables
  2. Add a new variable with the name System.Debug and value true
  3. Save

Which variables are available to me?

A: $(Build.SourcesDirectory) and $(Agent.BuildDirectory) are just few of the variables you can use in your pipeline. Variables are available as expressions or scripts.

See Define variables, predefined variables, and Classic release and artifacts variables to learn about the different types of variables.

The task allows me to publish artifacts in deployment job in yaml pipeline, but I am not able to use it in downstream pipeline?

A: Deployment jobs do not have the context of source branches and are hence not appropriate for publishing artifacts. They have been primarily designed to consume artifacts. A workaround would be to isolate that logic into a separate job (with dependencies on your deployment jobs).

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 2.199.0 or greater
Task category Utility
Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 2.199 or greater
Task category Utility
Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 2.159.2 or greater
Task category Utility

See also