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 'trim' of undefined #65

Closed ghost closed 6 years ago

ghost commented 6 years ago

When running a triggered build I get the following error

image

I think it may have something to do with our builds having spaces in their names.

huserben commented 6 years ago

Hi

could you please post the full log of the Task. Ideally you set the system.debug variable to true before, so I can see in detail whats happening.

However the spaces should not be an issue.

ybadragon commented 6 years ago

Hi sorry when I posted that original issue I was in the wrong account but here are is the log for that task.

TriggeredBuildLog.txt

ybadragon commented 6 years ago

Another thing that is interesting (I can make a new issue is necessary) is that even though I've told it to fail the build when the tasks fail, it still continues with the build in this instance. This could be a side effect of the error I receive since it's failing before the tasks are fired?

huserben commented 6 years ago

Hi

thanks for the logs. It shows that at least the build seems to be triggered - I'll need to check in more detail what exactly is wrong and try to recreate the problem locally. The ony "special" thing I can see are the "-" in the name of the build definition, I will see whether this is problematic.

What exactly do you mean with "told it to fail when the task fails"?

huserben commented 6 years ago

Ah figured it out, the problem is your Build Parameter. You specify just "release". However the correct syntax includes the name of the parameter and then, separate by a colon the value. You need to specify first the name of the variable you want to set, as you can see it in the Variables Tab of the build you want to trigger. Then the value can be set after a : VariableIWantToSet: WhateverValue

So for example "BuildConfiguration: Release"

If you change this it should work - Could you please give it a try?

However I will work on fetching this and output a proper error, so it's more clear what cause this issue.

ybadragon commented 6 years ago

Ok so I modified what you asked and that did fix the issue, thank you.

As for the other question, under AdvancedConfiguration section there is the following checkbox.

image

When I was getting the 'trim' error the build would continue, I would expect the build to fail right then. I have also already checked the phase after this task and they are set to only continue if all previous phases have succeded

image

This is what the process looks like I would expect the "Phase 1" to just fail immediately, but maybe it doesn't work how I thought it does.

image

huserben commented 6 years ago

This option is failing the Task in case the build you triggered has failed. So this has nothing todo with how to proceed after the Task has failed (refer as well to the documentation "Wait for Completion of Triggered Builds" in the Task Overview.

What happens is that the Task is failing "properly" (it is in the failed state as the red "X" indication marks it in your screenshot). How/Why it's then proceeding I cannot tell, but from the Task perspective it seems to be ok, as it is failed. The rest is TFS/VSTS configuration and out of my hands, as I don't have any experience with the Phases. But looking at the configuration I would as well expect that it fails immediately.

The only thing I could see is if the Phases do run in parallel. I think you can specifiy parallelism and as well make the phases depend on each other if needed. Maybe that's something to look at.

ybadragon commented 6 years ago

Ok I will look into that, thanks for your help!

huserben commented 6 years ago

No problem. I just now updated the task so it will print out a more meaningful message in case wrongly specified parameters are setup.

Thank you for your input and please don't hestitate to open another issue if you find a problem, you have a change request or simply a question.