0

I am using Build Pipeline: VSTS and Repo: VSTS

I am trying to create VSTS build pipelines for two branches Dev and UAT. I can achieve it by creating two different pipelines but since both has almost similar steps so I wanted to have only one pipeline and depending on condition I can omit some steps. But I am not able to figure out how to pass the variable value(branch which triggered the build) before queueing the build in VSTS.

Background: I tried to get both branch source, setted triggers on both branch and use Build.SourceBranchName variable but it is giving value the top level(Project) value instead of branch name. I have structure like below

Project - Dev - QA

The agenda is to trigger the build pipeline on checkin, sanity checks an publish the artifacts as per the environment(Dev,QA). I am not going for CD right now (will be handled manually because of some constraints).

The solution might sound very awkward but I am a newbie and I want to learn it.

I have checked some people have explained through API but any way to do through UI?

VSTS use API to set build parameters at queue time

Any help would be highly appreciated. enter image description hereenter image description here

riQQ
  • 9,878
  • 7
  • 49
  • 66

1 Answers1

0

To add a variable that you can pass the value when you queue the build you need to go to variables tab, then add your variable and check the checkbox Settable at queue time.

enter image description here

Now when will queue a build you can change the default value. enter image description here

Shayki Abramczyk
  • 36,824
  • 16
  • 89
  • 114
  • Thanks for the answer. But I hope you are not talking about manual queue. Can you please tell me how to set a value of variable when code is commited. Build needs to get triggered when somebody commits code in the branch. – Saurabh Bhasin Oct 08 '18 at 16:24