huserben / TfsExtensions

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

Triggering builds from release ##[error]Path must be a string #116

Closed realrubberduckdev closed 4 years ago

realrubberduckdev commented 4 years ago

Triggering a build from a release stage on Azure DevOps throws the following error. Does anyone know of a fix or workaround?

2019-10-30T11:42:52.6079862Z SYSTEMVSSCONNECTION exists true
2019-10-30T11:42:52.6287969Z Searching for definitions that named [Build_job_name]
2019-10-30T11:42:53.1911366Z 1 Build found with the name [Build_job_name]
2019-10-30T11:42:53.1940087Z Single Trigger...
2019-10-30T11:42:53.2132840Z ==== ERROR Occurred ====
2019-10-30T11:42:53.2194111Z ##[error]Path must be a string. Received undefined
2019-10-30T11:42:53.2210477Z Message: Path must be a string. Received undefined
2019-10-30T11:42:53.2237606Z Stack: TypeError: Path must be a string. Received undefined
2019-10-30T11:42:53.2237702Z     at assertPath (path.js:7:11)
2019-10-30T11:42:53.2237772Z     at Object.join (path.js:468:7)
2019-10-30T11:42:53.2237843Z     at createLinks (C:\LocationOfAgent\vsts-agent-win-x64-2.155.1\_work\_tasks\TriggerAnotherBuildXPlat_92cda420-aa43-11e6-915e-d77172ce108a\1.0.0\triggerAnotherBuild.js:406:33)
2019-10-30T11:42:53.2237919Z     at C:\LocationOfAgent\vsts-agent-win-x64-2.155.1\_work\_tasks\TriggerAnotherBuildXPlat_92cda420-aa43-11e6-915e-d77172ce108a\1.0.0\triggerAnotherBuild.js:389:20
2019-10-30T11:42:53.2238010Z     at _fulfilled (C:\LocationOfAgent\vsts-agent-win-x64-2.155.1\_work\_tasks\TriggerAnotherBuildXPlat_92cda420-aa43-11e6-915e-d77172ce108a\1.0.0\node_modules\q\q.js:854:54)
2019-10-30T11:42:53.2238084Z     at self.promiseDispatch.done (C:\LocationOfAgent\vsts-agent-win-x64-2.155.1\_work\_tasks\TriggerAnotherBuildXPlat_92cda420-aa43-11e6-915e-d77172ce108a\1.0.0\node_modules\q\q.js:883:30)
2019-10-30T11:42:53.2238204Z     at Promise.promise.promiseDispatch (C:\LocationOfAgent\vsts-agent-win-x64-2.155.1\_work\_tasks\TriggerAnotherBuildXPlat_92cda420-aa43-11e6-915e-d77172ce108a\1.0.0\node_modules\q\q.js:816:13)
2019-10-30T11:42:53.2238290Z     at C:\LocationOfAgent\vsts-agent-win-x64-2.155.1\_work\_tasks\TriggerAnotherBuildXPlat_92cda420-aa43-11e6-915e-d77172ce108a\1.0.0\node_modules\q\q.js:624:44
2019-10-30T11:42:53.2238361Z     at runSingle (C:\LocationOfAgent\vsts-agent-win-x64-2.155.1\_work\_tasks\TriggerAnotherBuildXPlat_92cda420-aa43-11e6-915e-d77172ce108a\1.0.0\node_modules\q\q.js:137:13)
2019-10-30T11:42:53.2238429Z     at flush (C:\LocationOfAgent\vsts-agent-win-x64-2.155.1\_work\_tasks\TriggerAnotherBuildXPlat_92cda420-aa43-11e6-915e-d77172ce108a\1.0.0\node_modules\q\q.js:125:13)
realrubberduckdev commented 4 years ago

Found this workaround which works for me. Might help others hitting this issue. antony-wintech's description on GitHub issue.

I just added a Powershell step with the following lines inline:

Write-Host "##vso[task.setvariable variable=BUILD_SOURCESDIRECTORY;]$(System.DefaultWorkingDirectory)"
Write-Host "Set environment variable BUILD_SOURCESDIRECTORY to ($env:BUILD_SOURCESDIRECTORY)"
huserben commented 4 years ago

Hi @realrubberduckdev

thanks for reporting this and sorry for the (very) late answer. Also thanks for letting others know on how you solved your problem, this is very much appreciated.

To the issue itself, could it be that you are using the built-in way of triggering builds based on other builds or are you really using the Trigger Build Task from the Marketplace.

I'm asking because the log doesn't look familiar to me and my extension (for example I don't use any file called triggerAnotherBuild.js) - Just in case whether I have to follow up more on this or not.

realrubberduckdev commented 4 years ago

Hi @huserben You are right! I have opened an issue on the wrong codebase. Apologies. Closing this.