How to specify build variables from a particular artifact?

Viewed 410

I am trying to use Predefined Build Variables in my Release Pipeline with CI Trigger enabled. My release pipeline has multiple Artifacts coming in from Multiple separate Build Pipelines.

When I use the variable $(Build.BuildNumber), it targets the variable to a specific artifact all the time. I would really like it to use the one from the Build Pipeline that is triggering the deployment. But if that is not possible, can I at least specify which Artifact-set it should use the Build variables from?

1 Answers

You would probably do this with a combination of information. You would first need to get the trigger artifact alias using a pre-defined release variable: Release.TriggeringArtifact.Alias

Then you want to pull details about a specific artifacts build number, you can reference it using a pre-defined release variable (replacing with the alias from the first variable): Release.Artifacts.{alias}.BuildNumber

The build number or the commit identifier.

  • Azure Pipelines example: 20170112.1
  • Jenkins/TeamCity example: 20170112.1
  • TFVC example: Changeset 3 Git example: 38629c964
  • GitHub example: 38629c964
Related