8

I have a file which I have created manually on my local computer. I need it in several Azure DevOps pipelines.

I want to use it as an "Artifact".

I know how to publish artifacts from within an Azure DevOps Pipeline, but this specific file I just want to upload from my computer. How can I do it?

hey
  • 2,643
  • 7
  • 29
  • 50
  • do you mean hot to make is as "build/pipeline artifact" or Azure Artifacts like NuGet (https://azure.microsoft.com/en-us/services/devops/artifacts/)? – Shayki Abramczyk Jun 25 '20 at 06:27

2 Answers2

9

How to manually publish a file to Azure Artifacts?

As we know, the essence of Artifact is the storage of a shared file. We can roughly get this information from the Publish build artifacts task:

enter image description here

But the default value of Artifact publish location is Azure Pipelines:

enter image description here

This is a shared place set up on Azure.

Update:

Thanks hey sharing:

We could upload from local to the shared place with AZ command line, like:

az artifacts universal publish --organization https://dev.azure.com/example/ --feed my_feed --name my-artifact-name --version 0.0.1 --description "Test Description" --path

Now let us return to the first sentence we started with "the essence of Artifact is the storage of a shared file", so we could create a shared place/folder to save the file. It is now seen as "Artifact". Then we just need make sure other pipelines could access this shared place/folder.

For example, we could create a folder on the server where our private agent is located, then we just need to copy your file to that folder. Now, we could use it when we build the pipeline with private agent. Obviously this is not limited to local folders, we can also create a network folder, only need to ensure that other pipelines can access it.

Hope this helps.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135
  • 3
    Thanks; that's great. I've followed up with my colleague on this, who then said, I can upload from local to the shared place with `az artifacts universal publish --organization https://dev.azure.com/example/ --feed my_feed --name my-artifact-name --version 0.0.1 --description "Test Description" --path .` . This worked. Shall we update the answer? – hey Jun 26 '20 at 00:19
  • 1
    @hey, Of course. I have updated my answer with your solution, you can check if there are any updates and modifications? If yes, please directly modify my answer for free. Thank you for helping us build a better Azure DevOps. – Leo Liu Jun 26 '20 at 00:57
  • 2
    Note `--path` must refer to a directory - a file will not work and will fail without telling you why. – Marc Nov 06 '20 at 09:44
0

You have to push it through your package manager like NuGet, npm or anything else. But I guess better option would be commit and push this single file to specific repo (if this file is specific to single project) or common repo like "Utilities" (if you gonna reuse it across many projects) and then download this repo (or just file) in your pipeline.