I have a pipeline for building and deploying an angular app. It builds successfully but fails during deployment with the error:
##[error]Error:
No package found with specified pattern: /home/vsts/work/1/s/**/*.zip
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.
I added debug script to see the pipeline workspace and i can see the zip file in the drop folder as it was meant to be. But in the debug stage, it is not referencing that location and i get the error i stated above.
`/home/vsts/work/1:
TestResults
a
b
drop
s
/home/vsts/work/1/TestResults:
/home/vsts/work/1/a:
/home/vsts/work/1/b:
/home/vsts/work/1/drop:
249.zip
/home/vsts/work/1/s:`
My pipeline is below:
`trigger:
- main
resources:
- repo: self
variables:
azureSubscription: 'VMS ARM SC NRG'
webAppName: 'vms-dev-webclient'
vmImageName: 'ubuntu-latest'
dev-url:
stages:
- stage: Build
displayName: Build Angular App
jobs:
- job: Build
displayName: Build Angular App
pool:
vmImage: $(vmImageName)
steps:
- task: NodeTool@0
displayName: 'Install Node.js'
inputs:
versionSpec: '22.x'
- script: npm install
displayName: Install npm packages
- script: npm run build --if-present
displayName: Build Angular project
- task: ArchiveFiles@2
displayName: 'Archive Build Output'
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)/dist'
includeRootFolder: false
archiveType: zip
archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
replaceExistingArchive: true
- publish: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
artifact: drop
displayName: Publish Build Artifact
- stage: Deploy_Development
displayName: Deploy to Development
dependsOn: Build
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
jobs:
- deployment: Deploy
displayName: Deploy to Development
environment: Development
pool:
vmImage: $(vmImageName)
strategy:
runOnce:
deploy:
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download Build Artifacts'
inputs:
artifactName: 'drop'
downloadPath: '$(Pipeline.Workspace)/drop'
- script: ls -R $(Pipeline.Workspace)
displayName: 'Debug: List Pipeline Workspace'
- task: AzureWebApp@1
displayName: 'Deploy to Development'
inputs:
azureSubscription: $(azureSubscription)
appName: $(webAppName)
#packageForLinux: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip'
packageForLinux: '/home/vsts/work/1/drop/$(Build.BuildId).zip'
deploymentMethod: 'zipDeploy'
startUpCommand: 'pm2 serve /home/site/wwwroot/dist/vms-project-web --spa --no-daemon'
- task: CmdLine@2
displayName: Confirm Deployment
inputs:
script: 'curl -sSf $(dev-url) > /dev/null'
failOnStderr: true`
I need any help I can get.
I tried hard coding the path: packageForLinux: '/home/vsts/work/1/drop/$(Build.BuildId).zip'
and its still the same error.
I have a pipeline for building and deploying an angular app. It builds successfully but fails during deployment with the error:
##[error]Error:
No package found with specified pattern: /home/vsts/work/1/s/**/*.zip
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.
I added debug script to see the pipeline workspace and i can see the zip file in the drop folder as it was meant to be. But in the debug stage, it is not referencing that location and i get the error i stated above.
`/home/vsts/work/1:
TestResults
a
b
drop
s
/home/vsts/work/1/TestResults:
/home/vsts/work/1/a:
/home/vsts/work/1/b:
/home/vsts/work/1/drop:
249.zip
/home/vsts/work/1/s:`
My pipeline is below:
`trigger:
- main
resources:
- repo: self
variables:
azureSubscription: 'VMS ARM SC NRG'
webAppName: 'vms-dev-webclient'
vmImageName: 'ubuntu-latest'
dev-url: https://vms-dev-webclientt.azurewebsites
stages:
- stage: Build
displayName: Build Angular App
jobs:
- job: Build
displayName: Build Angular App
pool:
vmImage: $(vmImageName)
steps:
- task: NodeTool@0
displayName: 'Install Node.js'
inputs:
versionSpec: '22.x'
- script: npm install
displayName: Install npm packages
- script: npm run build --if-present
displayName: Build Angular project
- task: ArchiveFiles@2
displayName: 'Archive Build Output'
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)/dist'
includeRootFolder: false
archiveType: zip
archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
replaceExistingArchive: true
- publish: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
artifact: drop
displayName: Publish Build Artifact
- stage: Deploy_Development
displayName: Deploy to Development
dependsOn: Build
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
jobs:
- deployment: Deploy
displayName: Deploy to Development
environment: Development
pool:
vmImage: $(vmImageName)
strategy:
runOnce:
deploy:
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download Build Artifacts'
inputs:
artifactName: 'drop'
downloadPath: '$(Pipeline.Workspace)/drop'
- script: ls -R $(Pipeline.Workspace)
displayName: 'Debug: List Pipeline Workspace'
- task: AzureWebApp@1
displayName: 'Deploy to Development'
inputs:
azureSubscription: $(azureSubscription)
appName: $(webAppName)
#packageForLinux: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip'
packageForLinux: '/home/vsts/work/1/drop/$(Build.BuildId).zip'
deploymentMethod: 'zipDeploy'
startUpCommand: 'pm2 serve /home/site/wwwroot/dist/vms-project-web --spa --no-daemon'
- task: CmdLine@2
displayName: Confirm Deployment
inputs:
script: 'curl -sSf $(dev-url) > /dev/null'
failOnStderr: true`
I need any help I can get.
I tried hard coding the path: packageForLinux: '/home/vsts/work/1/drop/$(Build.BuildId).zip'
and its still the same error.
4 Answers
Reset to default 2Why do you use an unexisting parameter of AzureWebApp@1 task? Whatever you set to the packageForLinux
, the build always try to find by $(System.DefaultWorkingDirectory)/**/*.zip
pattern.
If you download to the $(Pipeline.Workspace)/drop
then use the same folder package:$(Pipeline.Workspace)/drop/$(Build.BuildId).zip
or package:$(Pipeline.Workspace)/**/*.zip
Try to use package:
instead of packageForLinux:
https://learn.microsoft/en-us/azure/devops/pipelines/tasks/reference/azure-web-app-v1?view=azure-pipelines
package: '$(System.DefaultWorkingDirectory)/**/*.zip' # string. Required. Package or folder. Default: $(System.DefaultWorkingDirectory)/**/*.zip.
You hardcoded path which could be changed. Instead of '/home/vsts/work/1/drop/$(Build.BuildId).zip'
try '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip'
, since you declared that your artifact should be downloaded here
- task: DownloadPipelineArtifact@2
displayName: 'Download Build Artifacts'
inputs:
artifactName: 'drop'
downloadPath: '$(Pipeline.Workspace)/drop'
Whin a YAML pipeline, if there are build jobs publish artifacts before the deployment jobs, or the current YAML pipeline has pipeline resources which publish artifacts, in the deployment jobs of current YAML pipeline, it will automatically add the download
task to download all artifacts from current run and the associated pipeline resources.
- Artifacts from the current run are downloaded to
$(Pipeline.Workspace)/<artifact name>
. - Artifacts from the associated pipeline resource are downloaded to
$(Pipeline.Workspace)/<pipeline resource identifier>/<artifact name>
.
In the deployment jobs, if you want to change the downloading path of the artifacts, you should:
- Disable the automatic
download
task (- download: none
). - Use the Download Pipeline Artifacts task (currently latest version is
DownloadPipelineArtifact@2
) to download the artifacts to the specified paths you want.
Note: If you do not disable the automatic download
task, the extra download tasks generate and cause the same artifacts be downloaded twice.
For your case, since the artifact is from the current pipeline run, and you set the downloading path of artifacts to be same as the default downloading path of the automatic download
task in the deployment job, you can remove the DownloadPipelineArtifact@2
task and just use the automatic download
task like as below.
. . .
stages:
- stage: Build
displayName: Build Angular App
jobs:
- job: Build
. . .
- stage: Deploy_Development
displayName: Deploy to Development
dependsOn: Build
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
jobs:
- deployment: Deploy
. . .
strategy:
runOnce:
deploy:
steps:
- script: ls -R $(Pipeline.Workspace)
displayName: 'Debug: List Pipeline Workspace'
- task: AzureWebApp@1
displayName: 'Deploy to Development'
inputs:
azureSubscription: $(azureSubscription)
appType: webAppLinux
appName: $(webAppName)
package: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip'
deploymentMethod: 'zipDeploy'
startUpCommand: 'pm2 serve /home/site/wwwroot/dist/vms-project-web --spa --no-daemon'
. . .