0
votes

By referencing another pipeline in a YAML pipeline's resources all artifacts published by the referenced pipeline get automatically downloaded. I'm not sure how to stop this behavior and download only the needed artifacts. Adding a download task for only the needed artifacts does not stop the initial download of the full set of artifacts.

1

1 Answers

1
votes

So what you need is disabling default behavior as

Artifacts are only downloaded automatically in deployment jobs. In a regular build job, you need to explicitly use the download step keyword or Download Pipeline Artifact task.

To stop artifacts from being downloaded automatically, add a download step and set its value to none:

steps:
- download: none

and then add additional step to download specific artifact.

Here is an example:


resources:
  pipelines:
  - pipeline: MultipleArtifact
    project: 'DevOps Manual'
    source: 'kmadof.devops-manual (64)'

jobs:
- job: Build
  pool:
    vmImage: 'ubuntu-latest'
  steps:
  - script: echo Hello, world!
    displayName: 'Run a one-line script'

  - script: |
      echo Add other tasks to build, test, and deploy your project.
      echo See https://aka.ms/yaml
    displayName: 'Run a multi-line script'

  # Track deployments on the environment.
- deployment: DeployWeb
  displayName: deploy Web App
  pool:
    vmImage: 'Ubuntu-16.04'
  # Creates an environment if it doesn't exist.
  environment: 'smarthotel-dev'
  strategy:
    # Default deployment strategy, more coming...
    runOnce:
      deploy:
        steps:
        - download: none
        - download: MultipleArtifact
          artifact: art-1
        - checkout: self 
        - script: echo my first deployment

enter image description here