ערוך

שתף באמצעות


Trigger one pipeline after another (classic)

Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019

Large products have several components that are dependent on each other. These components are often independently built. When an upstream component (a library, for example) changes, the downstream dependencies have to be rebuilt and revalidated.

In situations like these, add a pipeline trigger to run your pipeline upon the successful completion of the triggering pipeline.

Add a build completion trigger

In the classic editor, pipeline triggers are called build completion triggers. You can select any other build in the same project to be the triggering pipeline.

After you add a build completion trigger, select the triggering build. If the triggering build is sourced from a Git repo, you can also specify branch filters. If you want to use wildcard characters, then type the branch specification (for example, features/modules/*) and then press Enter.

Note

Keep in mind that in some cases, a single multi-job build could meet your needs. However, a build completion trigger is useful if your requirements include different configuration settings, options, or a different team to own the dependent pipeline.

Download artifacts from the triggering build

In many cases, you'll want to download artifacts from the triggering build. To do this:

  1. Edit your build pipeline.

  2. Add the Download Build Artifacts task to one of your jobs under Tasks.

  3. For Download artifacts produced by, select Specific build.

  4. Select the team Project that contains the triggering build pipeline.

  5. Select the triggering Build pipeline.

  6. Select When appropriate, download artifacts from the triggering build.

  7. Even though you specified that you want to download artifacts from the triggering build, you must still select a value for Build. The option you choose here determines which build will be the source of the artifacts whenever your triggered build is run because of any other reason than BuildCompletion (e.g. Manual, IndividualCI, Schedule, and so on).

  8. Specify the Artifact name and make sure it matches the name of the artifact published by the triggering build.

  9. Specify the Destination directory to which you want to download the artifacts. For example: $(Build.BinariesDirectory)

    A screenshot displaying how to download artifacts from a triggering build in a Classic pipeline.

  • Download artifacts produced by: Specific build.
  • Project: select your project from the dropdown menu.
  • Build pipeline: select your pipeline from the dropdown menu.
  • Check When appropriate, download artifacts from the triggering build.
  • Build version to download: select a build version.
  • Download type: Specific artifact.
  • Artifact name: select your artifact from the dropdown menu.
  • Destination directory: path on the agent machine where the artifacts will be downloaded.