Forum Discussion

Miraj32444's avatar
Miraj32444
Copper Contributor
Jan 02, 2023

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
stageBuildApplication
  jobs:
    - jobBuild
      pool
        vmImage'windows-latest'
      
      variables:
        buildPlatform'Any CPU'
        buildConfiguration'Release'
        solution'**/RoundTheCode.AzureTestProject.sln'
        project'**/RoundTheCode.AzureTestProject.csproj'

      steps:
        #Nuget installer
        - taskNuGetToolInstaller@1
          name'NugetToolInstaller' #name -> act as an id
          displayName'Nuget tool installer'
          
        #Restore package
        - taskNuGetCommand@2
          name'NugetRestore'
          displayName'Nuget restore packages'
          inputs:
            command'restore'
            #dereference variable -> $(key)
            restoreSolution'$(solution)'
            feedsToUse'select'
            
        #Run test
        - taskDotNetCoreCLI@2
          name'Tests'
          displayName'Run tests'
          inputs:
            command'test'
            projects'$(solution)'
            arguments'--configuration $(BuildConfiguration)'
            
        #publish project
        - taskDotNetCoreCLI@2
          name'Publish'
          displayName'Publish'
          inputs:
            command'publish'
            publishWebProjectsfalse
            projects'$(project)'
            arguments'--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
            zipAfterPublishfalse
            
        #publish pipeline artifact to Az pipeline 
        - taskPublishPipelineArtifact@1
          name'PublishPipelineArtifact'
          displayName'Publish pipeline artifact'
          inputs:
            targetPath'$(Build.ArtifactStagingDirectory)'
            artifact'CI'
            publishLocation'pipeline'

stageDeployToDev
  dependsOn"BuildApplication"
  jobs
    - jobDeployDev
      pool:
        vmImage'windows-latest'
      
      steps:
        #download pipeline artifacts
        - taskDownloadPipelineArtifact@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
        - taskAzureRmWebAppDeployment@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

  • Miraj32444's avatar
    Miraj32444
    Copper Contributor

    it's happens because of the directory structure of pipeline artifact, the directory would be '$(Pipeline.Workspace)/CI/'

    '

Resources