Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Copy Files vs Publish Artifact task in VSTS?

In my Copy Files task, I am copying the required files to the file share location from which I will be doing the deployment. What is the use of publishing artifact step? Or it is obsolete in my case. I am confused about the what values should be put in the boxes.

enter image description here

like image 910
tRuEsAtM Avatar asked Sep 25 '17 17:09

tRuEsAtM


People also ask

What is publish artifacts in Azure DevOps?

Artifact publish location. required. Choose whether to store the artifact in Azure Pipelines ( Container ), or to copy it to a file share ( FilePath ) that must be accessible from the build agent. To learn more, see Artifacts in Azure Pipelines. Default value: Container.

How do I publish artifacts to Azure artifacts?

You can publish your Artifacts at any stage of your pipeline using YAML or the classic editor. If you want to publish your Artifacts manually, you can use the Azure CLI to run the az pipelines runs artifact command. You will not be billed for storing your Pipeline Artifacts or Pipeline caching.

Is it possible to copy build artifact from pipeline into repo?

You could download the artifact and use the git command in command line task to push it to the repo, refer to the sample as below, it works for me.

Where does Azure DevOps publish artifacts?

Artifacts can be published at any stage of your pipeline. You can use YAML or the classic Azure DevOps editor to publish your packages. pathToPublish: the path of your artifact. This can be an absolute or a relative path.


1 Answers

  • If you need to copy files/artifacts to VSTS server, Publish Artifacts task is the only option (by selecting Server for Artifact Type option).
  • If you need to copy files/artifacts to a share path, both Publish Artifacts task and Copy Files task are ok. And Copy Files task is a little more flexible than Publish Artifacts task since you can specify which files to be copied to share path in Contents option.

And for your situation, you can use any of the tasks (Publish Artifacts task and Copy Files task). Since you only need to copy the contents under $(build.artifactstagingdirectory) to the share path \\my\share\$(Build.DefinitionName)\$(Build.BuildNumber), both the tasks can also achieve it.

  • If you use the Publish Artifacts task, settings as you specified in the picture is ok. It will copy the contents under $(build.artifactstagingdirectory) to \\my\share\$(Build.DefinitionName)\$(Build.BuildNumber)\drop.

  • If you use the Copy Files task, settings as be set as below. It will also the same result as the Publish Artifacts task.

    enter image description here

like image 102
Marina Liu Avatar answered Sep 17 '22 13:09

Marina Liu