falldamagestudio / UE-Jenkins-BuildSystem

Build Unreal Engine & games with Jenkins on GKE/GCE
MIT License
46 stars 11 forks source link

docker-agent via SSH fails on Win64: unexpected stream termination #36

Closed Kalmalyzer closed 3 years ago

Kalmalyzer commented 3 years ago

When the GCE plugin has created a Win64 machine, and logged into it via SSH, and launched the wrapper .bat script, and thereby launched a Docker container with the docker-agent, then there is an error on the agent side:

docker.exe : Jul 31, 2021 7:13:53 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
2021-07-31 21:14:00.244 CEST At C:\Runtime\Tools\Scripts\Invoke-External-PrintStdout.ps1:31 char:12
2021-07-31 21:14:00.244 CEST + $Stdin | & $LiteralPath $ArgumentList 2>&1 | Out-Host
2021-07-31 21:14:00.244 CEST + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-07-31 21:14:00.244 CEST + CategoryInfo : NotSpecified: (Jul 31, 2021 7:...itializeWorkDir:String) [], RemoteException
2021-07-31 21:14:00.244 CEST + FullyQualifiedErrorId : NativeCommandError
2021-07-31 21:14:00.244 CEST INFO: Using C:\J\remoting as a remoting work directory
2021-07-31 21:14:00.244 CEST Jul 31, 2021 7:13:53 PM org.jenkinsci.remoting.engine.WorkDirManager setupLogging
2021-07-31 21:14:00.244 CEST INFO: Both error and output logs will be printed to C:\J\remoting
2021-07-31 21:14:00.244 CEST Exception in thread "main" java.io.EOFException: unexpected stream termination
2021-07-31 21:14:00.244 CEST  at hudson.remoting.ChannelBuilder.negotiate(ChannelBuilder.java:415)
2021-07-31 21:14:00.244 CEST  at hudson.remoting.ChannelBuilder.build(ChannelBuilder.java:360)
2021-07-31 21:14:00.244 CEST  at hudson.remoting.Launcher.main(Launcher.java:762)
2021-07-31 21:14:00.244 CEST  at hudson.remoting.Launcher.runWithStdinStdout(Launcher.java:710)
2021-07-31 21:14:00.244 CEST  at hudson.remoting.Launcher.run(Launcher.java:396)
2021-07-31 21:14:00.244 CEST  at hudson.remoting.Launcher.main(Launcher.java:296)
2021-07-31 21:14:00.244 CEST <===[JENKINS REMOTING CAPACITY]===>rO0ABXNyABpodWRzb24ucmVtb3RpbmcuQ2FwYWJpbGl0eQAAAAAAAAABAgABSgAEbWFza3hwAAAAAAAAAf4=<===[HUDSON TRANSMISSION BEGINS]===>
2021-07-31 21:14:00.244 CEST docker.exe : Error response from daemon: No such container: jenkins-agent
2021-07-31 21:14:00.244 CEST At C:\Runtime\Tools\Scripts\Invoke-External-PrintStdout.ps1:31 char:12
2021-07-31 21:14:00.244 CEST + $Stdin | & $LiteralPath $ArgumentList 2>&1 | Out-Host
2021-07-31 21:14:00.244 CEST + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-07-31 21:14:00.244 CEST  + CategoryInfo : NotSpecified: (Error response ...: jenkins-agent:String) [], RemoteException
2021-07-31 21:14:00.244 CEST  + FullyQualifiedErrorId : NativeCommandError
2021-07-31 21:14:00.244 CEST
2021-07-31 21:14:00.244 CEST 1

Not sure where the problem resides. We're using a new OpenSSH (8.6.0.1-beta2), Docker is launched with -i, the agent is launched with -text. This was happening at least once during initial dev, until I realized that I had forgotten -i on the Docker commandline.

Kalmalyzer commented 3 years ago

Lots of stuff related to Powershell and the pipeline is line-oriented: https://stackoverflow.com/questions/58826280/can-i-tee-unbuffered-program-output-in-powershell

Kalmalyzer commented 3 years ago

Turns out that the Invoke-External-* scripts were not handling input correctly. https://github.com/falldamagestudio/UE-Jenkins-Images/commit/474094b32280e2ce7b60b5818f31270ad94a2a48 , https://github.com/falldamagestudio/UE-Jenkins-Images/commit/34ffee48d270ad85100bedf4e6c66d7a1cd5e5b8, https://github.com/falldamagestudio/UE-Jenkins-Images/commit/53901af59643da922f5b1d633daf827979190a7b fixed that.