huserben / TfsExtensions

Extensions for TFS 2015+ such as custom Widgets (require TFS 2017) and Build Tasks
MIT License
44 stars 22 forks source link

Trigger Build pass source branch #151

Closed greengumby closed 3 years ago

greengumby commented 3 years ago

Hi,

Are you able to pass the source branch name through to the triggered build as a variable?

Maybe it does not need to be the branch. I guess it could be build Id

Essentially I have two build pipelines that create artifacts and somehow I need to tell a third pipeline the trigger which builds to pull the artifacts from to use in the DownloadPipelineArtifacts artifacts

Pipeline 1 -> Trigger Pipeline2 (Pipeline1 BuildId) -> Trigger Pipeline 3 (Pipeline1 BuildId, Pipeline2 BuildId)

Thanks

huserben commented 3 years ago

HI @greengumby

yes that should be possible, you have to define the variable (e.g. Build1ID in Pipeline2) and make it settable at queue time. Then you can pass this variable in Pipeline 1 via the Build Parameters option: Build1ID: $(Build.BuildId)

that should do the trick. Of course the same goes for the trigger from pipeline 2 to pipeline 3 - you have to create 2 variables and they have to be settable at queue time (depending on whether you use Azure DevOps or a newer version of TFS, this might be called "settable by user" now :-)).

Could you try that out and let me know whether it worked or not?

greengumby commented 3 years ago

Worked a treat!

Thanks

huserben commented 3 years ago

Awesome!

Please don't hesitate to open up another issue if you are facing a problem, have a feature request or any kind of question.