0

I have 2 stages: build & deploy

In the build stage, my publish task looks like:

   - task: PublishPipelineArtifact@1
     inputs:
       targetPath: $(Build.ArtifactStagingDirectory)/funcabc-1.1.0.zip
       artifactName: functionapp

After running the build stage, I can see the artifact in the Azure Pipeline portal/UI. In the completed pipeline run, I click on Artifacts | Published. The file appears. Good so far!

My deployment job/steps are in a different stage. I deploy with something like:

  - task: AzureFunctionApp@1
    inputs:
      azureSubscription: 'valid_srv_conn
      appType: functionApp
      appName: funcabc
      package: $(Pipeline.Workspace)/functionapp/funcabc-1.1.0.zip

I have tried many combinations for the path to package:. The deploy stage is unable to find funcabc-1.1.0.zip.

For troubleshooting, I am running:

  - pwsh: |
      Get-ChildItem -Path $(Pipeline.Workspace) -Filter *.zip -Recurse | Select-Object FullName
      Get-ChildItem -Path "./" -Filter *.zip -Recurse | Select-Object FullName

The troubleshooting script shows 0 file results.

How do I access a published .zip file from a downstream stage?

BillQ
  • 71
  • 1
  • 7

2 Answers2

0

How do I access a published .zip file from a downstream stage?

You need to add the Download Pipeline Artifacts task in different stages(deploy stage).

For example:

- task: DownloadPipelineArtifact@2
  inputs:
    buildType: 'current'
    artifactName: 'functionapp'
    targetPath: '$(Pipeline.Workspace)'

Then the artifacts in build stage can be used in the deploy stage.

For more detailed info, you can refer to this doc: Publish and download pipeline Artifacts

Kevin Lu-MSFT
  • 20,786
  • 3
  • 19
  • 28
0

I discovered the answer to How do I access the files in later stages?

I simply changed for a generic job: to a deploy: job:.

Originally, the -task: AzureFunctionApp@1 step was throwing error "##[error]Error: No package found with specified pattern: /home/vsts/work/1/s/functionapp/funcabc-1.1.0.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"

Originally, my job: was setup like this:

jobs:
- job: deploy_func
  steps:
    -task: AzureFunctionApp@1

I change the jobs: type to strategy: deploy:

jobs:
- job: deploy_func
  strategy:
    runOnce:
      deploy:
        steps:
         -task: AzureFunctionApp@1
BillQ
  • 71
  • 1
  • 7