0
votes

I have separate yaml pipelines for CI and CD in Azure DevOps Services. CI pipeline will publish an artifact to a file share location. \fileshare\project

enter image description here

enter image description here

And in the CD pipeline I am using the CI pipeline as resource so that I can deploy the artifact produced from the CI pipeline.

resources:
  pipelines:
  - pipeline: POC_pipeline # identifier for the pipeline resource
    source: CI-pipeline_YAML # source pipeline definition name

My question is how can I download this artifact and what's the pre-defined variable name to get the path of the published artifact from CI-pipeline.

I tried using but it doesn't download anything, this only works when I push the artifact to Azure DevOps.

steps:
    - download: POC_pipeline
1

1 Answers

1
votes

It seems download task cannot download artifacts that published to a file share. I can reproduce the same issue. You can report this problem(Click Report a problem and choose Azure devops) to Microsoft development team.

As workaround, you can use Download Fileshare Artifacts task to download fileshare artifacts.

- task: DownloadFileshareArtifacts@1
      inputs:
        filesharePath:  '\fileshare\project'
        artifactName: artifactName
        downloadPath: $(Build.ArtifactStagingDirectory)

The artifacts will be downloaded to folder specified in downloadPath. In above example you will find the artifacts in $(Build.ArtifactStagingDirectory)/artifactName (ie. C:\agent\_work\2\a\artifactName)

Check here to find more predefined variables.

You can also use Download Pipeline Artifacts task to download the fileshare artifacts. You need to specify the source as specific, and other project, pipeline,runVersion attributes. See below:

 - task: DownloadPipelineArtifact@2
      inputs:
        source: specific
        project: yourProjectName
        pipeline: CI-pipeline_YAML
        runVersion: latest
        path: $(Build.ArtifactStagingDirectory)

The artifacts will be downloaded to folder specified in path.

Noted: you need to run your pipeline on self-hosted agents which can access the file share.(It will fail with error `Unable to read directory \fileshare\project" on cloud agents).