huserben / TfsExtensions

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

Getting build ids for descendant builds #105

Closed chambersDon closed 5 years ago

chambersDon commented 5 years ago

I have Build-A, that triggers Build-B which triggers Build-C. How can Build A get the buildID from Build C?

Currently, in Build A I inspect TriggeredBuildIds but it only has one value - the id for Build B. Is this to be be expected?

Here is my scenario and I am open to other ways to accomplish this.

  1. Build-C builds my huge solution.
  2. Build-B calls C for the build and then deploys a subset of what was built.
  3. Build-A call B to deploy a dependency, and then needs to deploy a different subset of Build-C

Build-C creates nuget packages that are named with a version that includes the build id. Somehow I need to get that version number back to Build-A.

Any ideas?

huserben commented 5 years ago

Hi @chambersDon

so currently it is really only supported to get the id's of the build that were triggered within a certain build, not any "descendant" ones. However I think technically one can get the parameters of a certain build, so the tasks could be extended so all the triggered builds are fetched.

I can see whether this is feasible within the next few days. If it's urgent for you, you could always try to script something yourself.

Let me know whether you need something immediately so I could point you in the right directions how to manage it or whether you can live some time without this so I can see what it would mean to extend the task.

chambersDon commented 5 years ago

I am working on a different approach. I see how to pass variable to your extension, but is there a way to have variable pass the other way? Maybe a return value?

huserben commented 5 years ago

The task itself is just returning whether it was was successful or not, so the build system can interpret that. Everything else could just be stored within a variable of the build so later it could be reused by later tasks (e.g. scripts etc.)

huserben commented 5 years ago

Closed due to inactivity. Please reopen in case the functionality or additional help is needed