Search code examples
c#.net-coreazure-devopsazure-pipelinesazure-artifacts

Trying to get build output artifacts from Azure CI/CD


I must be getting old - or something else.... but I can't wrap my head around what I'm trying to do here.

I have a fairly simple .NET Core command line utility, code is hosted in Azure Devops Git repo, and I've set up continuous integration in Azure Devops with a build pipeline. This works like a charm - new checking comes in, code gets compiled and unit tests get run - great.

But the next step seems to elude me. I'm coming from tools like CruiseControl or Atlassian Bamboo, and there we used to have a separate "Test" build - one that would be triggered manually, do the same thing (build the code, run the tests) and then package up the build output into an "artifact" of some sort - a ZIP file, an MSI installer - whatever.

I was trying to accomplish the same thing in Azure Devops - but I can't seem to see the forest for the trees....

There's the "Artifacts" section - so naturally, I thought it would be a breeze to add another step to my build pipeline and get my results as needed. But no matter what I do, what I try - "Archive Files", "Published Build Artifacts" or whatever else I've stumbled across, I just cannot seem to get my build result into a form so that I can download it from Azure Devops once the build is completed.

What on earth do I need to do?? I was expecting to be able to go into the "Artifacts" and somehow pick my build and get my output - as a ZIP or whatever - but that doesn't seem to be the case. "Artifacts" asked for feeds - like NuGet or Maven feeds, if I understood correctly - but that's not what I'm after here....

Where's that one amazingly well written blog post or tutorial that can explain how to set this up?

My build YAML so far looks like this:

# .NET Desktop

trigger:
- none

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

and then I tried the "archive files" step:

# Archive files - compress files into .7z, .tar.gz, or .zip
- task: ArchiveFiles@2
  inputs:
    rootFolderOrFile: '$(Build.BinariesDirectory)' 
    includeRootFolder: false
    archiveType: 'zip'
    archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip' 
    replaceExistingArchive: true 
    verbose: 1

and also the "published pipeline artifacts":

- task: PublishPipelineArtifact@1
  inputs:
    targetPath: '$(Pipeline.Workspace)'
    artifact: 'BfhInfoPackage'
    publishLocation: 'pipeline'

but in neither case, I'm finding any "results" being shown anywhere for me to download or fetch ....


Solution

  • Have you taken a look at the published folder?

    Pipeline Build Summary

    It took me a while to find this location when I first came across azure pipelines.