Редактиране

Споделяне чрез


CopyPublishBuildArtifacts@1 - Copy and Publish Build Artifacts v1 task

Use this task to copy build artifacts to a staging folder and then publish them to the server or a file share. Files are copied to the $(Build.ArtifactStagingDirectory) staging folder and then published.

Important

This task is deprecated. We recommend that you use Pipeline Artifacts and the Copy Files task and the Publish Build Artifacts task instead.

Syntax

# Copy and Publish Build Artifacts v1
# CopyPublishBuildArtifacts@1 is deprecated. Use the Copy Files task and the Publish Build Artifacts task instead.
- task: CopyPublishBuildArtifacts@1
  inputs:
    #CopyRoot: # string. Copy Root. 
    Contents: # string. Required. Contents. 
    ArtifactName: # string. Required. Artifact Name. 
    ArtifactType: # 'Container' | 'FilePath'. Required. Artifact Type. 
    #TargetPath: '\\my\share\$(Build.DefinitionName)\$(Build.BuildNumber)' # string. Optional. Use when ArtifactType = FilePath. Path. Default: \\my\share\$(Build.DefinitionName)\$(Build.BuildNumber).

Inputs

CopyRoot - Copy Root
string.

The folder that contains the files you want to copy. If the folder is empty, the task copies files from the root folder of the repo as though $(Build.SourcesDirectory) was specified.

If your build produces artifacts outside of the sources directory, specify $(Agent.BuildDirectory) to copy files from the build agent working directory.


Contents - Contents
string. Required.

Specifies pattern filters (one on each line) that you want to apply to the list of files to be copied. For example:

  • ** copies all files in the root folder.
  • **\* copies all files in the root folder and all files in all sub-folders.
  • **\bin copies files in any sub-folder named bin.

ArtifactName - Artifact Name
string. Required.

Specifies the name of the artifact to create.


ArtifactType - Artifact Type
string. Required. Allowed values: Container (Server), FilePath (File share).

Specifies whether to store the artifact on TFS/Team Services or to copy it to a file share that must be accessible from the build agent.


TargetPath - Path
string. Optional. Use when ArtifactType = FilePath. Default value: \\my\share\$(Build.DefinitionName)\$(Build.BuildNumber).

The UNC file path location where the artifact is copied. It must be accessible from the build agent.


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

Important

This task is deprecated. We recommend that you use Pipeline Artifacts and the Copy Files task and the Publish Build Artifacts task instead.

This step didn't produce the outcome I was expecting. How can I fix it?

This task has a couple of known issues:

  • Some minimatch patterns don't work.
  • It eliminates the most common root path for all paths matched.

You can avoid these issues by instead using the Copy Files task and the Publish Build Artifacts task.

Requirements

Requirement Description
Pipeline types YAML, Classic build
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 1.83.0 or greater
Task category Utility