I tried following this, but was not successful.
I have an ASP.NET Core App Service (Web App) in Azure DevOps repository and the release over that builds always fails with this error:
Error: No package found with specified pattern: D:\a\r1\a***.zip
I'm pretty new to CI for App Services and not sure if I'm missing a step in my YAML or CI Build?
stages:
- stage: SDL
jobs:
- job: SDLTools
pool:
name: Azure-Pipelines-EO-Windows2022-Office
steps:
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
condition: |
and(
eq(variables['Build.SourceBranchName'], 'main'),
ne(variables['Build.Reason'], 'PullRequest')
)
displayName: 'Component Detection'
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.BinariesDirectory)'
includeRootFolder: true
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
replaceExistingArchive: true
- task: AzureRmWebAppDeployment@4
inputs:
ConnectionType: 'AzureRM'
azureSubscription: 'Subscription'
appType: 'webApp'
WebAppName: 'MyWebAppName'
package: '$(System.DefaultWorkingDirectory)/*.zip'
- task: PublishBuildArtifacts@1
I see that the archive compleete
D:\a\_work\_tasks\ArchiveFiles_35346534345f\2.231.0\7zip\7z.exe a -tzip -mx=5 D:\a\_work\1\a\26395403.zip @D:\a\_work\_temp\v6pxdmipzc
But then fails during the deploy.
No package found with specified pattern: D:\a\_work\1\s\*.zip<br/>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
If you observe the path of the archive (D:\a\_work\1\a\26395403.zip
) and the path in the error message (D:\a\_work\1\s\*.zip
) when deployment fails, there is a difference after the part D:\a\_work\1\
.
That's because the $(Build.ArtifactStagingDirectory)
used while archiving the file is a different directory compared to $(System.DefaultWorkingDirectory)
used for picking up the zip while deploying the app.
So use the package
location in AzureRMWebAppDeployment@4
task as '$(Build.ArtifactStagingDirectory)/*.zip'
in order for the agent to find the archived file.
.
.
.
- task: AzureRmWebAppDeployment@4
inputs:
ConnectionType: 'AzureRM'
azureSubscription: 'Subscription'
appType: 'webApp'
WebAppName: 'MyWebAppName'
package: '$(Build.ArtifactStagingDirectory)/*.zip'