Marc-Olivier Legris
Marc-Olivier Legris

Reputation: 101

How to show pipeline artifact in the artifacts section in Azure DevOps

Maybe there's a fundamental concept I don't understand but it seems to me that it should be obvious that an artifact published by a pipeline appears in the section called "ARTIFACTS" which is super-accessible directly from the main menu and hightlighted with its own magenta icon. But no... it doesn't. This baffles me. I like DevOps... everything else works so beautifully, why is this SO complicated to do? Anyway, sorry for venting.

Question : Is there any easy way to publish an artifact from a pipeline directly in the "Artifacts" section in Azure DevOps?

image-1 : Published pipeline artifact to artifact section

image-2 : What I was expecting in the publishing task

As of now I retreive the pipeline actifacts manually thru Memu > Pipelines > myPipeline > theDesiredRun > relatedItems > publishedItem > clicArtifactName > downloadWithBrowser. It's a working workaround but this procedure will be a pain to teach and document when onboarding new members in the team.

I googled it and it looks like you can acheive that by creating a feed, publishing to the feed, then subscribing to it. I didn't find any good guide to do it, I tried and failed :(

Is there an easier way to do it? Did I miss something obvious? Maybe I'm just not using the right task in the pipeline? If the only way is thru the feed thing, then does anybody knows a link to a clear explanation on how to do it?

Thank you

--mo

Upvotes: 5

Views: 2735

Answers (2)

Marc-Olivier Legris
Marc-Olivier Legris

Reputation: 101

After reading @MaxMorrow 's answer I now understand the Artifacts section in Azure DevOps is not designed for what I intended. But for those who are still looking to achieve what I was asking in my original question…

Here’s the workaround I put in place : Commit the build artifact to the repository.

I know it’s not an elegant solution but it fully answers my original requirements to make it easy to find and to download. It’s 1 click away from the main Repos menu in DevOps and it can also be downloaded by synchronising that repository folder on any machine and by any team member, as needed. (git)

HOW TO:

  • First, a task in the build pipeline writes the artifacts in $(Build.SourcesDirectory)\BuildArtifacts\myBuildArtifact_run$(Build.BuildNumber).zip

  • Then the next task is a command line script to commit to repos :

     echo This is the current working direcotry :  %cd%
    
     echo get worktree list
     git worktree list
    
     echo commit all changes
     git config user.email "[email protected]"
     git config user.name "Automatic Build"
     git checkout master
     git add --all
     git commit -m "pipeline : $(Build.DefinitionName)"
    
     echo push code to repo
     git -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" push origin master
    
  • Finally, you’ll find the committed artifact in your repository, under root > BuildArtifacts

Voilà !

Upvotes: 5

Max Morrow
Max Morrow

Reputation: 1336

So, there are two forms of artifacts within Azure DevOps:

  1. Build Artifacts: Artifacts that are built and published for consumption during releases.
  2. Azure Artifacts: Maven, npm, NuGet, and Python package feeds from public and private sources. These are designed to be consumed within your applications as shared modules. If you're familiar with .NET / dotnetcore. This would be where you publish custom NuGet packages.

The "Artifacts" tab on the left-hand menu is explicitly for custom packages, not build artifacts. You'll never be able to publish build artifacts there.

Upvotes: 3

Related Questions