huserben / TfsExtensions

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

Error running the trigger build task in build agent configured inside windows docker container #101

Closed leonjalfon1 closed 5 years ago

leonjalfon1 commented 5 years ago

I am trying to use the task in a build running on a agent configured inside a windows docker container. (the same build in a VM works great, so the problem is running the task inside a container) I am receiving the error below, any idea?

2018-10-23T09:33:37.9923172Z ##[section]Starting: Trigger [CLEAN_JOB] Build
2018-10-23T09:33:37.9933501Z ==============================================================================
2018-10-23T09:33:37.9933743Z Task         : Trigger Build
2018-10-23T09:33:37.9934171Z Description  : This tasks allows to trigger a new Build (add it to the queue) as part of a Build Definition. It contains as well some conditions that can be applied, for example if the last build of certain definition was successful or not.
2018-10-23T09:33:37.9934426Z Version      : 3.0.6
2018-10-23T09:33:37.9934576Z Author       : Benjamin Huser
2018-10-23T09:33:37.9934721Z Help         : 
2018-10-23T09:33:37.9935023Z ==============================================================================
2018-10-23T09:33:38.2942956Z fs.js:994
2018-10-23T09:33:38.2943577Z   binding.lstat(pathModule._makeLong(path), statValues);
2018-10-23T09:33:38.2943993Z           ^
2018-10-23T09:33:38.2944173Z 
2018-10-23T09:33:38.2944709Z Error: ENOENT: no such file or directory, lstat 'C:\ContainerMappedDirectories'
2018-10-23T09:33:38.2945130Z     at Error (native)
2018-10-23T09:33:38.2945396Z     at Object.fs.lstatSync (fs.js:994:11)
2018-10-23T09:33:38.2945707Z     at Object.realpathSync (fs.js:1676:21)
2018-10-23T09:33:38.2946130Z     at toRealPath (module.js:133:13)
2018-10-23T09:33:38.2946428Z     at Function.Module._findPath (module.js:181:22)
2018-10-23T09:33:38.2947159Z     at Function.Module._resolveFilename (module.js:467:25)
2018-10-23T09:33:38.2947474Z     at Function.Module._load (module.js:417:25)
2018-10-23T09:33:38.2947762Z     at Module.runMain (module.js:604:10)
2018-10-23T09:33:38.2948058Z     at run (bootstrap_node.js:390:7)
2018-10-23T09:33:38.2948395Z     at startup (bootstrap_node.js:150:9)
2018-10-23T09:33:38.3429319Z ##[error]Exit code 1 returned from process: file name 'C:\BuildAgent\externals\node\bin\node.exe', arguments '"C:\BuildAgent\_work\testing-agent-2\_tasks\TriggerBuild_32abcf98-0df6-4711-b2e4-66a405d3c1a6\3.0.6\index.js"'.
2018-10-23T09:33:38.3497061Z ##[debug]Microsoft.VisualStudio.Services.Agent.Util.ProcessExitCodeException: Exit code 1 returned from process: file name 'C:\BuildAgent\externals\node\bin\node.exe', arguments '"C:\BuildAgent\_work\testing-agent-2\_tasks\TriggerBuild_32abcf98-0df6-4711-b2e4-66a405d3c1a6\3.0.6\index.js"'.
   at Microsoft.VisualStudio.Services.Agent.Util.ProcessInvoker.<ExecuteAsync>d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Services.Agent.ProcessInvokerWrapper.<ExecuteAsync>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Services.Agent.Worker.Handlers.DefaultStepHost.<ExecuteAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Services.Agent.Worker.Handlers.NodeHandler.<RunAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Services.Agent.Worker.TaskRunner.<RunAsync>d__24.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Services.Agent.Worker.StepsRunner.<RunStepAsync>d__1.MoveNext()
2018-10-23T09:33:38.3505718Z ##[section]Finishing: Trigger [CLEAN_JOB] Build
huserben commented 5 years ago

Hi @leonjalfon1

thanks for your input.

By looking at the message it seems that it fails to find the node.exe that is (or should be) part of the agent. This means it's most likely an issue related to the docker image you're using and other node.js based tasks should/would fail as well. You could try to run another node.js task like "Archive Files" and see if we have the same issue just to be sure.

So I guess (please correct me if I'm wrong, just speculating here) the docker image doesn't contain all the necessary files. I quickly checked the docs if I could find something related to docker and there was a mention here, however it says specifically:

You can also install an agent on a Linux Docker container

So with this I'm not sure whether there is a bigger conceptual problem related to Windows containers or the docs are just not mentioning them.

Maybe you could verify whether the other task would fail as well and if this specific directory is really missing?

huserben commented 5 years ago

Hi @leonjalfon1

did you make any progress regarding this issue?