I'm failing to use the Azure Devops Release management to deploy my Azure Functions.
Build
In the build pipeline, I've got two tasks:
dotnet publish
publich release artifact
This step succeeds
The artifact is published into /drop/a.zip
Release
In this step I have a Dev environment.
and a single task:
Azure Function App Deploy.
Credentials and which app to deploy to is specified.
There is a path specified to the release artifact like so:
I can even browse the path with the browse button in that image. and navigate to and pick the correct zip there.
But once this task runs. it all ends with a
##[error]Error: No package found with specified pattern: D:\a\r1\a\DotnetFunctions-CI\drop\a.zip
I am aware there are other questions here on SO bringing up the same question. however the answers I've seen there does not solve the issue here.
What am I missing?
I've had issue with the release pipeline not finding an artifact. What I've started doing is using the double wildcard search instead of the full path.
That is in my Deploy Azure App Service task inside the release pipeline.
My azure function works:
In Build :
Visual Studio Build Task :
Add following arguments in MSBuild section :
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\$(BuildConfiguration)\\"
here is my build and release:
Build Configuration:
Release :
Related
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
We have a .NET ASP Web form application. Currently we use TeamCity for the CI part. Deployment part is manual. We take the build artifact generated by TeamCity and deploy the artifact manually.
Now we will be using Azure DevOps for complete CICD process. During the POC we have been able to successfully build and deploy the application in IIS. I am new to the azure pipeline and doing POCs to learn it.
In TeamCity, against each build the generated build artifacts are available. So we can easily refer to any specific build and get the build artifact for that specific build. This is useful in case of rollback. We take the last successfully build artifacts and deploy the same in case of any error.
But in Azure is there any build artifacts repository where we can get the all the build artifacts for all the builds of that pipeline ? There is a section "Artifacts" but as per my knowledge this is for publishing as packages across feeds.
Now I have come across JFrog artifact repository https://jfrog.com/artifactory/. But no nothing about this. Need to go through.
Anyone can please let me know , in azure pipelines , where I can get all the build artifacts against all the builds in a pipeline. Is it available against each run in the pipeline or I need to configure it somehow ?
In any release failure , I need to rollback to the last successful deployed artifact version.
Thanks in advance for any guidance on this.
Azure Artifacts is feed source for packages like nuget etc.
And build/pipeline artifact you can find in your build here (of course if you published them):
Here you have documentation about publishing and downloading pipeline artifacts - newer and recommended approach and here about build artifacts
In short what you needs is add this step:
- task: PublishPipelineArtifact#0
displayName: 'Publish pipeline artifacts'
inputs:
targetPath: $(Build.ArtifactStagingDirectory)/
archiveFilePatterns: '**/*.zip'
Of course if your pipeline output is a nuegt package you can publish it to Azure Artifacts.
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
Trying to use a hosted build agent and an on-prem release agent.
Project is an ASP.Net MVC web app within a solution with other projects.
The build completes successful but there is nothing in the artifact folder so the release does nothing.
[ update 5/22/2018]
What I need to do is publish to some location relevant to the hosted agent, then in my on-prem release agent, be able to use a copy_files task to simply copy those files to a unc path.
[ update 5/23/2018]
Using these msbuild arguments on the build task, I was able to get a zipped folder containing the published files. The only problem now is that the files are in a deeply nested structure. So I either just need to unzip them on a release task, or prevent them from being zipped.
/t:My_MVCWeb_Project_Name /p:DeployOnBuild=true /p:WebPublishMethod=FileSystem /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\"
Build log
Build task (Hosted VS 2017 agent). The /t parameter is followed by a project_name.
Publish task of Build definition
Release definition, with just a copyfiles task (this runs on-prem)
You need to use the default MSBuild Arguments in Build step since you use ASP.NET build template:
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\"
Or you need to add a Copy Files task before Publish Build Artifacts
to copy the files you need to path $(build.artifactstagingdirectory):
I've got to a website and a webjob project in the same sln:
Sritt (The website)
Sritt.Webjob
In properties of Sritt theres a webjobs-list.json with the following setting:
"WebJobs": [
{
"filePath": "../Sritt.WebJob/Sritt.WebJob.csproj"
}
I've configured the by VSTS build like this (with the new buildsystem):
Solution: **\*.sln
MSBuild Args: /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.stagingDirectory)"
Building in VSTS gives me the following warning:
C:\a\1\s\packages\Microsoft.Web.WebJobs.Publish.1.0.9\tools\webjobs.console.targets(149,5): warning : WebJob schedule for SrittWebJob will not be created. WebJob schedules can only be created when the publish destination is an Azure Website [C:\a\1\s\Sritt.WebJob\Sritt.WebJob.csproj]
And the following error:
packageFile= Find-Files -SearchPattern C:\a\1\a\**\*.zip
packageFile= C:\a\1\a\Sritt.WebJob.zip C:\a\1\a\Sritt.zip
Found more than one file to deploy with search pattern 'C:\a\1\a\**\*.zip'. There can be only one.
How can I deploy both the website and the webjob? Do I need to split them into different solutions?
Seems you are using "Azure Web App Deployment" task to deploy the project. You don't need to split them into different solutions but you need to deploy them in separate tasks.
So you need to add one more "Azure Web App Deployment" task in you build definition. The setting is almost the same for these two tasks except the "Web Deploy Package" section:
One is "$(build.artifactstagingdirectory)\**\Sritt.zip" and another one is "$(build.artifactstagingdirectory)\**\Sritt.WebJob.zip".
The error is not related to the publishing of the WebJob, but to the publishing of the Azure Scheduler change. Generally, the Azure Schedule configuration from msbuild is known to have issues and is no longer recommended.
Instead, the suggested approach is to use the new WebJobs cron based schedule, which doesn't have those issues. See the docs for more details on setting this up (it's quite simple).