5
votes

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?

2
do you mean hot to make is as "build/pipeline artifact" or Azure Artifacts like NuGet (azure.microsoft.com/en-us/services/devops/artifacts)?Shayki Abramczyk

2 Answers

3
votes

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.

0
votes

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.