Azure Release Pipeline failed to download the template file from the given path - azure-data-factory

I'm creating a release pipeline and it should be picking up the ARM Templates from my built artifacts but it keeps giving the below error. I'm not sure what I'm doing wrong here
The way this has been configured is:
1. Artifact is picked up from my build pipeline:
2. Build pipeline has successfully created the artifact:
3. Artifacts are selected here
Any help would be much appreciated
EDIT:
Have changed my CI pipeline to use PublishBuildArtifacts but not getting an error about 2MB limit:

I reproduced your issue when i used the task PublishPipelineArtifact#1 to publish aritfact in build pipeline.The same warning poped up when i selected Override template parameters. Then i changed the task to PublishBuildArtifacts#1 and it worked.
RESULT
You can refer to this doc to understand the two types of publish artifact task:
PublishBuildArtifacts
Publish Pipeline Artifacts
Here are suggestions to check:
1 check the type of publish artifact task in your build pipeline.
2 check your template that should follow Syntax and expressions in ARM templates

Managed to do using PublishBuildArtifacts and linked ARM templates to overcome the 2MB issue: learn.microsoft.com/en-us/azure/data-factory/….

Related

Error while deploying release pipeline in Azure Devops

I am trying to deploy an existing .Net Core application using Azure Devops by creating Build and release pipelines. The build pipeline worked fine, but I get the below error when running the release pipeline (under Deploy Azure App Service).
Error: No package found with specified pattern: D:\a\r1\a***.zipCheck 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.
What should be done to fix this?
This error is because the build task is not configured. You can try to put the below YAML code at the last to make it work.
- task: PublishBuildArtifacts#1

Deploy a preexisting artifact in a Azure DevOps Multi-Stage pipeline

In Azure DevOps classic pipelines you can have a build pipeline for creating the artifact and a release pipeline for deploying it. This means that whatever stored prexisting artifact could be deployed simply launching the release pipeline and selecting the artifact´s version (typical usage: rolling back the current deployed artifact to a previous version)
How this can be achieved in Multi-Stage pipeline? Any way of launching only the deployment stage selecting the artifact to be deployed?
Regards
How this can be achieved in Multi-Stage pipeline? Any way of launching only the deployment stage selecting the artifact to be deployed?
Indeed, this is very convenient to choose prexisting artifact based on actual demands, but what you want does not supported in Multi-Stage pipeline until now.
This request already reported to the MS product team:
Select artifacts in YAML release pipeline
This feature have been added in the last sprint:
Pipeline resource version picker in the create run dialogue
However, as I test, it seems this feature has not been deployed in all regions:
If it not deployed in your region, you could try to use the task Download Pipeline Artifacts task with the runId input:
- task: DownloadPipelineArtifact#2
inputs:
source: 'specific'
artifact: 'drop'
path: $(Build.SourcesDirectory)/bin
project: 'AndroidBuild'
pipeline: 12
runVersion: 'specific'
runId: $(buildid)
Then use pass queue variable buildid when we queue the build:
Hope this helps.
This can be done by having two pipelines. one pipeline for your build where your pipeline produces an artifact and create another pipeline for your release stages. In the release pipeline, you can set the resources to point to another build or pipeline. where you can consume your previously produced artifact(including older build version) to deployment stages.
See:
YAML Resources
Your release YAML pipeline can specify what resources it needs. You can specify an existing build or another pipeline.
resources:
pipelines:
- pipeline: SmartHotel-resource # identifier for the resource (used in pipeline resource variables)
source: SmartHotel-CI # name of the pipeline that produces an artifact
However, Keeping them separate just leads to move overhead and maintenance.

Azure Devops Multi-Stage Yaml Pipeline - "Could not find any file matching the template file pattern"

I am converting a classic Build and Release Pipeline to a Multi-Stage Yaml pipeline in Azure Devops.
I keep getting a "Could not find any file matching the template file pattern" error from my Multi-Stage-Pipeline in the Release Part.
Build Part
Release part
In the build part you published the artifact to the pipeline workspace, so you should reference this path in the release part. Use $(Pipeline.Workspace) instead of $(Build.ArtifactStagingDirectory) in the csmFile and csmParameterFile. That should solve the issue and is the cleanest solution without an extra download artifact step.
My bad - needed to download artifact first

.NET Core WebJob Console App CI/CD using Azure DevOps Pipelines

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?
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.
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.
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"
[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

Why is this Azure DevOps pipeline release failing?

This is an ASP.NET Core 3.0 project that builds with no errors, but when it triggers the pipeline to release to Azure App Service, it fails with the following error:
2019-11-10T23:09:23.8008460Z ##[error]Error: No package found with specified pattern: D:\a\r1\a***.zip
What needs to be done to fix the release pipeline? The pipeline release is pulling the latest build as its artifact.
Assumptions
The following info assumes that you are appropriately publishing your build artifact from your Build pipeline, and that you have added the correct build artifact into you release pipeline.
In your release pipeline you have specified a build artifact in the Artifacts area
When adding your build artifact to your release pipeline, you chose to give it an alias of Build Artifact. This means that at the very lease (with default settings) your .zip file will be in some sub-directory of $(system.DefaultWorkingDirectory)/Build Artifact/
A new unique folder in the agent is created for every release pipeline when you initiate a release, and the artifacts are downloaded into that folder. The $(System.DefaultWorkingDirectory) variable maps to this folder.
To ensure the uniqueness of every artifact download, each artifact source linked to a release pipeline is automatically provided with a specific download location known as the source alias. This location can be accessed through the variable:
$(System.DefaultWorkingDirectory)\[source alias]
This uniqueness also ensures that, if you later rename a linked artifact source in its original location (for example, rename a build pipeline in Azure Pipelines or a project in Jenkins), you don't need to edit the task properties because the download location defined in the agent does not change.
The source alias is, by default, the name of the source selected when you linked the artifact source, prefixed with an underscore; depending on the type of the artifact source this will be the name of the build pipeline, job, project, or repository. You can edit the source alias from the artifacts tab of a release pipeline; for example, when you change the name of the build pipeline and you want to use a source alias that reflects the name of the build pipeline.
(from some of the abundant documentation
Instead of searching for your package using ***.zip (which isn't proper wildcard syntax) use Build Artifact/**/*.zip
** is for recursively searching into directories
(I don't know what folder)
* is for searching a part of a given level of the path
any file/folder that
starts with (SomeFile.*)
ends with (*File.zip)
and i think contains (*meFi*)
The pipeline YAML was missing the following tasks. Not sure why this isn't included in the ASP.NET Core template, very confusing for developers new to Azure DevOps.
- task: DotNetCoreCLI#2
inputs:
command: 'publish'
publishWebProjects: true
- task: CopyFiles#2
inputs:
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts#1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
When adding an Artifact of Source type "Build", select "Default version" as "Latest from the build pipeline default branch with tags", as follows: