bbsimonbb
bbsimonbb

Reputation: 29020

Has this Azure pipeline generated an artifact?

I'm getting started with Azure pipelines (as you'll quickly figure out from the question) I have a v.basic build pipeline, with steps Nuget => Build solution => Run tests. The full yaml is...

# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/dotnet-core

trigger:
- develop

pool: ELCIA-AGENT-AZURE-LOCAL

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

steps:
- task: NuGetToolInstaller@1

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

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: DotNetCoreCLI@2
  displayName: "Run tests"
  inputs:
    command: test
    projects: "**/*[Tt]ests/*.csproj"
    arguments: --no-build -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover

The job completes, but has it done anything? The output from the build should be $(build.artifactStagingDirectory)\WebApp.zip. Can I check if this file exists? I have a release pipeline that takes this build pipeline as the source of its artifact. It's currently failing with the error "Error: No package found with specified pattern.
Check if the package mentioned in the task is published as an artifact in the build or a previous stage and downloaded in the current job." How do I know where the problem is? This screenshot shows how I specify my artifact in my release pipeline.

enter image description here

Upvotes: 1

Views: 464

Answers (1)

jessehouwing
jessehouwing

Reputation: 114967

No it hasn't generated an artifact. You need to add a Upload Pipeline Artifact task to explicitly upload (part of) the ArtifactStagingDirectory.

There are 2 types of tasks that can do this, the Upload/Download Pipeline Artifact are the modern ones. The upload/Download Build Artifact are the oldest ones. The newer ones tend to be faster.

By the way, the Release hub is also "old technology", you can actually write the release part of your pipeline in the YAML file as well using the stages keyword.

Upvotes: 2

Related Questions