Azure-devops-docs: confused trying to get artifact from a build

Created on 8 Dec 2018  Â·  13Comments  Â·  Source: MicrosoftDocs/azure-devops-docs

i am trying to figure out how to just like, get an artifact from a build (or is it a pipeline?) into my hands, and i am very confused as to how to do this.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

devopprod

Most helpful comment

okay, i wanted to get the binary my pipeline was building, so i was specifying the file i wanted published. which meant when i tried to use this task, it was failing because you can only publish directories, and not files.

i should note that it's pretty unclear what this task does, Publish could mean anything here, when i tried this task it was because "all the other tasks didn't work, lets try this one, maybe this is what i want?"

everything works now, thanks

All 13 comments

@zvory sorry you feel this way. What do you have so far?

As this doc says, if the files you want to download are in a folder named say some_folder, add this to the steps of your azure-pipelines.yml file:

steps:
- task: PublishPipelineArtifact@0
  inputs:
    artifactName: 'artifactName'
    targetPath: 'some_folder'

okay, i wanted to get the binary my pipeline was building, so i was specifying the file i wanted published. which meant when i tried to use this task, it was failing because you can only publish directories, and not files.

i should note that it's pretty unclear what this task does, Publish could mean anything here, when i tried this task it was because "all the other tasks didn't work, lets try this one, maybe this is what i want?"

everything works now, thanks

I was stuck on this also; I thought targetPath was the full path to a single file that I wanted to publish with the name artifactName. It would be useful if the docs said the targetPath is the name of the full directory to archive and publish.

Edit Apparently you are supposed to be able to publish individual files per https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/publish-pipeline-artifact?view=vsts

Path to the folder or file you want to publish. The path must be a fully-qualified path or a valid path relative to the root directory of your repository.

@zbjornson sorry for the delayed response, been out for vacation. Re-reading, I see that the docs now have this description: "Path to the folder or file you want to publish. The path must be a fully-qualified path or a valid path relative to the root directory of your repository. Typically, you'll specify $(Build.ArtifactStagingDirectory). See Artifacts in Azure Pipelines." Did that help, or are there further clarifications we should make? Or, were there other docs/reference places that didn't have this information?

Also, yes, you should be able to publish individual files. Were you able to get that working?

Finally, @elbatk we should stop recommending $(Build.ArtifactStagingDirectory). Pipeline Artifacts are designed to skip the copy step that used to be required with Build Artifacts (where you copied everything to a staging directory then published that directory). That said, that would suggest that targetPath should take an array of paths. @mitchdenny does the current task support taking multiple paths and combining them into an artifact?

We are currently making a change to Pipeline Artifacts which will allow you to specify the path to an individual file. In addition we support an .artifactignore (documentation). Its basically the same format as a .gitignore file and allows you to specify which files from the target path you want to upload.

By default we upload everything (except the .git folder), but with this you can prune what gets uploaded. I often do something like this:

!**/*
justthe
dirsthat
icareabout

We'll have a think about allowing you to specify multiple specific files to upload in the YAML definition itself. In theory it would be like an inline .artifactignore file where the !**/* is implied. Thanks for the feedback!

Note for @elbatk - I had a heck of a time finding the doc reference above. I think we should link to it from the Publish Pipeline Artifact and Universal Package task documentation. For some reason it isn't showing up in search results.

Where are the artifacts actually published? I just used the Publish Pipeline Artifact successfully on the first try. But there is no indication of where it ends up. If I go to the Artifacts tab of my Azure DevOps there is nothing there. I'm just prompted to connect to a feed. But I have no idea what that means.

But I have no idea what that means.

I mean, I know what the different types of feeds (Nuget, etc.) are, but none of them are relevant for the task I have at hand which is to publish and make available a file from my build.

I'm coming from CircleCI where the publish task is very similar, but in the build output there is a very clear link to the artifacts from the build. I don't see a similar type of link in the DevOps build.

Hi @mgwelch , sorry for the confusion here, it's good feedback for us though. Build Artifacts, Pipeline Artifacts, and Symbols aren't stored in "Azure Artifacts", that Artifacts tab is for consuming and publishing packages like NuGet, npm, Python, Maven, and Universal. Mitch can correct me if I'm wrong, but I believe Pipeline Artifacts are stored within the build itself, you can see how to see Build Artifacts here.

Yeah, the overloaded use of Artifacts is very confusing. I assumed there was a distinction between the two and did finally find the link. Thanks.

Very Odd. I found two links. The (now) very obvious Artifacts button on the top of the build page. That link contains all of the output I wanted.

But in the build summary progression I see an entry named: "Build artifacts published" with an artifact with the name I gave it. But clicking on that artifact brings up this file:

{"$id":"1","innerException":null,"message":"Artifact Documentation%20File was not found for build 2.","typeName":"Microsoft.TeamFoundation.Build.WebApi.ArtifactNotFoundException, Microsoft.TeamFoundation.Build2.WebApi","typeKey":"ArtifactNotFoundException","errorCode":0,"eventId":3000}

So I think my issue is resolved but the link in the summary progression is either broken or indicating some other issue

Hmm I'll get that looked at, thank you!

Was this page helpful?
0 / 5 - 0 ratings