1
votes

I'm trying to build my console application through Azure DevOps. So to this I'm following this tutorial.

The follow images, are from what I already did.

Build Solution Pipeline

Build Solution Pipeline / Publish

Build Solution Pipeline / Artifact

Deploy WebJob Pipeline

Deploy WebJob Pipeline / Variables

When I run the Build Solution the zip seems to work, because I see it.

But when I run the Deploy WebJob Pipeline I get ##[error]D:\a\1\s\***.zip not found.. I tried wwwroot/App_Data/jobs/, but still the same error.

What could I be doing wrong? What's the right way to set the zippedArtifactPath?

4
You're using a build pipeline to try to release. Use a release, not a build.Daniel Mann

4 Answers

3
votes

You're following the tutorial incorrectly. The tutorial is telling you to create a release. You're using a build pipeline to try to release. Although you can do that, you shouldn't.

You have two options:

  • If you want to keep using the visual designer, use a release. Look at the "Release" tab for this. Releases can be tied to build artifacts and will handle downloading the build artifact automatically.
  • If you want to use YAML, refer to the YAML documentation and set up a multi-stage pipeline to release.
1
votes

What could I be doing wrong?

Check your error messgae ##[error]D:\a\1\s\***.zip not found we can find in the second build pipeline, the PS tried to get the xx.zip in xxx\s folder while in first build pipeline you published the xx.zip to xxx\a folder.

The $(System.DefaultWorkingDirectory) for build pipeline is xx\s folder while that for release pipeline is xx\a folder. In first build pipeline we published the xx.zip to Build.ArtifactStagingDirectory which is a xx\a folder, so we can't access the xx.zip from xx\s folder in second build pipeline's PS script.

What's the right way to set the zippedArtifactPath?

It's not recommended to build and deploy one web app using two build pipelines. For normal logic, we should do this by using combination like build+release pipeline just like the Toturial and Daniel suggests above.

-1
votes

[your build artifact name]\webjobs_drop[your zipped files].zip

"your build artifact name" - you should get it from your release pipelines Artifacts stage from where you are selecting your build artifacts

-1
votes

We can use this variable $(Release.PrimaryArtifactSourceAlias) to get the artifact directory. In your powerShell script you can set path variable like:

$path = "$(System.DefaultWorkingDirectory)\$(Release.PrimaryArtifactSourceAlias)\webjobs_drop\[ZIP_File_Name].zip"