Forum Discussion
Miraj32444
Jan 02, 2023Copper Contributor
Azure CI/CD pipeline using Yaml
I am creating a CI/CD pipeline using YAML to deploy the app to the Azure App Service. In the build process, my artifact is built and published but in deployment, I get an error called:
##[error]Error: No package found with specified pattern: D:\a\1\**\*.zip<br/>
My YAML pipeline code is given below
trigger:
- none
stages:
- stage: BuildApplication
jobs:
- job: Build
pool:
vmImage: 'windows-latest'
variables:
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
solution: '**/RoundTheCode.AzureTestProject.sln'
project: '**/RoundTheCode.AzureTestProject.csproj'
steps:
#Nuget installer
- task: NuGetToolInstaller@1
name: 'NugetToolInstaller' #name -> act as an id
displayName: 'Nuget tool installer'
#Restore package
- task: NuGetCommand@2
name: 'NugetRestore'
displayName: 'Nuget restore packages'
inputs:
command: 'restore'
#dereference variable -> $(key)
restoreSolution: '$(solution)'
feedsToUse: 'select'
#Run test
- task: DotNetCoreCLI@2
name: 'Tests'
displayName: 'Run tests'
inputs:
command: 'test'
projects: '$(solution)'
arguments: '--configuration $(BuildConfiguration)'
#publish project
- task: DotNetCoreCLI@2
name: 'Publish'
displayName: 'Publish'
inputs:
command: 'publish'
publishWebProjects: false
projects: '$(project)'
arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
zipAfterPublish: false
#publish pipeline artifact to Az pipeline
- task: PublishPipelineArtifact@1
name: 'PublishPipelineArtifact'
displayName: 'Publish pipeline artifact'
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifact: 'CI'
publishLocation: 'pipeline'
- stage: DeployToDev
dependsOn: "BuildApplication"
jobs:
- job: DeployDev
pool:
vmImage: 'windows-latest'
steps:
#download pipeline artifacts
- task: DownloadPipelineArtifact@2
name: 'DownloadPipeLineArtifact'
displayName: 'Download pipeline artifact'
inputs:
buildType: 'current'
artifactName: 'CI'
#itemPattern: ''
targetPath: '$(Pipeline.Workspace)'
# - download: current
# artifact: CI
#deploy to azure app service
- task: AzureRmWebAppDeployment@4
name: 'AzureRmWebAppDeployment'
displayName: 'Deploy to Azure Web App'
inputs:
ConnectionType: 'AzureRM'
azureSubscription: 'Azure for Students (d8026e85-c3a9-4a33-acb5-88d88c4daf6c)'
appType: 'webApp'
WebAppName: 'az-cd'
packageForLinux: '$(Pipeline.Workspace)/**/*.zip'
1 Reply
Sort By
- Miraj32444Copper Contributor
it's happens because of the directory structure of pipeline artifact, the directory would be '$(Pipeline.Workspace)/CI/'
'