Unreal Engine 4.18 and Jenkins, sometimes fails

Hi guys,

I am using the Jenkins implementation from Skymaps (GitHub - skymapgames/jenkins-ue4: Automated Unreal Engine 4 Project Builds) with some small additions to make it work on my computer (and on 4.18) but the strangest thing happens sometime.

The build fails but a “manual build request” will succeed. Sometimes the automatic build succeeds and sometimes a workspace deletion and build will fail when the next time it won’t. All in the same project and same code.

The problem always arised on Step 3 which is the following command on my system

"C:\Program Files\Epic Games\UE_4.18\Engine\Build\BatchFiles\RunUAT.bat" BuildCookRun -project="C:\Source\demoworkflow\TestingGrounds.uproject" -noP4 -platform=Win64 -clientconfig=Development -cook -allmaps -build -stage -pak -archive -archivedirectory="C:\Builds\demoworkflow"

and always with the same errors

14:46:19   LogInit: Warning: Incompatible or missing module: UE4Editor-TestingGrounds.dll
14:46:19 Took 1.4699086s to run UE4Editor-Cmd.exe, ExitCode=1
14:46:19 Cook failed. Deleting cooked data.
14:46:19 ERROR: Cook failed.
14:46:19        (see C:\Program Files\Epic Games\UE_4.18\Engine\Programs\AutomationTool\Saved\Logs\UAT_Log.txt for full exception trace)
14:46:19 AutomationTool exiting with ExitCode=25 (Error_UnknownCookFailure)
14:46:19 BUILD FAILED
14:46:19 Build step 'Execute Windows batch command' marked build as failure
14:46:19 Finished: FAILURE

The UAT_LOG.txt reports the following error

ExceptionUtils.PrintExceptionInfo: ERROR: Cook failed.
ExceptionUtils.PrintExceptionInfo:        (see C:\Program Files\Epic Games\UE_4.18\Engine\Programs\AutomationTool\Saved\Logs\UAT_Log.txt for full exception trace)
ExceptionUtils.PrintExceptionInfo: 
ExceptionUtils.PrintExceptionInfo: CommandletException: Editor terminated with exit code 1 while running Cook for C:\Source\demoworkflow\TestingGrounds.uproject; see log C:\Program Files\Epic Games\UE_4.18\Engine\Programs\AutomationTool\Saved\Logs\Cook-2017.12.07-15.09.29.txt
ExceptionUtils.PrintExceptionInfo:    at AutomationTool.CommandUtils.RunCommandlet(FileReference ProjectName, String UE4Exe, String Commandlet, String Parameters) in C:\Program Files\Epic Games\UE_4.18\Engine\Source\Programs\AutomationTool\AutomationUtils\CommandletUtils.cs:line 372
ExceptionUtils.PrintExceptionInfo:    at AutomationTool.CommandUtils.CookCommandlet(FileReference ProjectName, String UE4Exe, String[] Maps, String[] Dirs, String InternationalizationPreset, String[] CulturesToCook, String TargetPlatform, String Parameters) in C:\Program Files\Epic Games\UE_4.18\Engine\Source\Programs\AutomationTool\AutomationUtils\CommandletUtils.cs:line 94
ExceptionUtils.PrintExceptionInfo:    at Project.Cook(ProjectParams Params) in C:\Program Files\Epic Games\UE_4.18\Engine\Source\Programs\AutomationTool\Scripts\CookCommand.Automation.cs:line 255
ExceptionUtils.PrintExceptionInfo: Wrapped by AutomationException: Cook failed.
ExceptionUtils.PrintExceptionInfo:    at Project.Cook(ProjectParams Params) in C:\Program Files\Epic Games\UE_4.18\Engine\Source\Programs\AutomationTool\Scripts\CookCommand.Automation.cs:line 272
ExceptionUtils.PrintExceptionInfo:    at BuildCookRun.DoBuildCookRun(ProjectParams Params) in C:\Program Files\Epic Games\UE_4.18\Engine\Source\Programs\AutomationTool\Scripts\BuildCookRun.Automation.cs:line 209
ExceptionUtils.PrintExceptionInfo:    at BuildCookRun.ExecuteBuild() in C:\Program Files\Epic Games\UE_4.18\Engine\Source\Programs\AutomationTool\Scripts\BuildCookRun.Automation.cs:line 41
ExceptionUtils.PrintExceptionInfo:    at AutomationTool.BuildCommand.Execute() in C:\Program Files\Epic Games\UE_4.18\Engine\Source\Programs\AutomationTool\AutomationUtils\BuildCommand.cs:line 100
ExceptionUtils.PrintExceptionInfo:    at AutomationTool.Automation.Execute(List`1 CommandsToExecute, Dictionary`2 Commands) in C:\Program Files\Epic Games\UE_4.18\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:line 558
ExceptionUtils.PrintExceptionInfo:    at AutomationTool.Automation.Process(String[] Arguments) in C:\Program Files\Epic Games\UE_4.18\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:line 528
ExceptionUtils.PrintExceptionInfo:    at AutomationTool.Program.MainProc(Object Param) in C:\Program Files\Epic Games\UE_4.18\Engine\Source\Programs\AutomationTool\Program.cs:line 132
ExceptionUtils.PrintExceptionInfo:    at AutomationTool.InternalUtils.RunSingleInstance(Func`2 Main, Object Param) in C:\Program Files\Epic Games\UE_4.18\Engine\Source\Programs\AutomationTool\AutomationUtils\Utils.cs:line 708
ExceptionUtils.PrintExceptionInfo:    at AutomationTool.Program.Main() in C:\Program Files\Epic Games\UE_4.18\Engine\Source\Programs\AutomationTool\Program.cs:line 62
ExceptionUtils.PrintExceptionInfo: ==============================================================================
Program.Main: AutomationTool exiting with ExitCode=25 (Error_UnknownCookFailure)

And the cook file

LogInit: Warning: Incompatible or missing module: UE4Editor-TestingGrounds.dll
LogExit: Preparing to exit.
LogModuleManager: Shutting down and abandoning module AnimationModifiers (36)
LogModuleManager: Shutting down and abandoning module PropertyEditor (35)
LogModuleManager: Shutting down and abandoning module AudioEditor (32)
LogModuleManager: Shutting down and abandoning module TextureCompressor (30)
LogModuleManager: Shutting down and abandoning module ShaderCore (28)
LogModuleManager: Shutting down and abandoning module Landscape (26)
LogModuleManager: Shutting down and abandoning module SlateRHIRenderer (24)
LogModuleManager: Shutting down and abandoning module OpenGLDrv (22)
LogModuleManager: Shutting down and abandoning module D3D11RHI (20)
LogModuleManager: Shutting down and abandoning module AnimGraphRuntime (18)
LogModuleManager: Shutting down and abandoning module Renderer (16)
LogModuleManager: Shutting down and abandoning module Engine (14)
LogModuleManager: Shutting down and abandoning module CoreUObject (12)
LogModuleManager: Shutting down and abandoning module NetworkFile (10)
LogModuleManager: Shutting down and abandoning module CookedIterativeFile (8)
LogModuleManager: Shutting down and abandoning module StreamingFile (6)
LogModuleManager: Shutting down and abandoning module SandboxFile (4)
LogModuleManager: Shutting down and abandoning module PakFile (2)
LogExit: Exiting.
Log file closed, 12/07/17 15:09:28

So it just seems that the DLL is the big problem but why does it sometimes generate and sometimes don’t? The only remotely extra maybe informative line I can find is

15:09:28   LogModuleManager: Warning: Module file ../../../../../../Source/demoworkflow/Binaries/Win64/UE4Editor-TestingGrounds-4053.dll is missing. This is likely a stale module that must be recompiled.

Am I missing some argument somewhere? Why does the same build sometimes fail and sometimes don’t? I’ve even selected the drastic method to always clear the full workspace (which means that the GIT command will take >5 minutes) but not even this solves this problem.

The Step2_CompileScripts.bat has also been editted to

"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" "C:\Source\demoworkflow\TestingGrounds.sln" /t:build /p:Configuration="Development Editor";Platform=Win64;verbosity=diagnostic