huserben / TfsExtensions

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

Cannot read property 'name' of undefined In Wait For Build(s) to finish #154

Closed georgelviv closed 2 years ago

georgelviv commented 3 years ago

There is an error that appears in Wait For Build(s) to finish (version 2.0.10) task ##[error]Cannot read property 'name' of undefined

As in Trigger Build (version 3.1.7) we receive the next output

Storing triggered build id's in variable 'TriggeredBuildIds'
Following value is already stored in the variable: '$(TriggeredBuildIds)'
New Value of variable: 'NaN,2610321'

As a result, we have a variable TriggeredBuildIdsEnvironmentVariableName with a value '$(TriggeredBuildIds)' (this is also a question why this variable has such value), and it tries to parseInt this string to number, which will result into NaN. Could you please check in condition if the previous value is a valid number. Thanks!

https://github.com/huserben/TfsExtensions/blob/2063cca4ec96e2b7d5fb028451ad2a6b9010006e/BuildTasks/triggerbuildtask/triggerbuildtaskV3/taskrunner.ts#L137

huserben commented 3 years ago

Hi @georgelviv

Thanks for opening this issue.

So just for me to see whether I'm following correctly:

If that's the case, I'm wondering why the variable has that existing value? Is this set somehow by a previous task? Do you have any special setup that would explain how this is getting written into the variable?

georgelviv commented 3 years ago

Hi @huserben Thanks for your reply

Actually, it happens very rarely, but still happens, as the previous task, we have next one, Task : Trigger Build

I'll try to echo this env variable, and I'll reply u

huserben commented 3 years ago

Hi @georgelviv

Yeah that would be good. Sadly those things that happen very infrequently are also the hardest to fix until we know what's causing them. Of course if it's really getting too big of a problem for you we could do the workaround you suggested, but ideally I'd like to get to the bottom of this :-)

Thanks for letting me know

georgelviv commented 3 years ago

Is this possible if triggered pipeline is finished before waiting step, and https://github.com/huserben/TfsExtensions/blob/2063cca4ec96e2b7d5fb028451ad2a6b9010006e/BuildTasks/triggerbuildtask/triggerbuildtaskV3/taskrunner.ts#L88

and this function returns null?

huserben commented 3 years ago

Hi @georgelviv

No that shouldn't happen, the build with the given id will return some information, independently of whether it has finished or not.

huserben commented 2 years ago

Closed due to inactivity