Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity Headless Build using Jenkins fails, but only sometimes

Discussion in 'Editor & General Support' started by Chris-Crafty, May 24, 2017.

  1. Chris-Crafty

    Chris-Crafty

    Joined:
    May 7, 2013
    Posts:
    27
    Hey there! I have a setup where two of my office computers are building the same project using Jenkins (one for Linux, one for Windows), then upload it to one computer, where the steam client uploads the builds, creates a changelog and so on. Anyways, for some time I've been having trouble with my Windows build, it just fails for no apparent reason (the error message doesn't make any sense to me), then when rebuilding the exact same project without any changes, the build runs through. I've been trying to figure out what is going on by comparing logs of a successful and a failed build, but they seem arbitrarily different to me, so maybe somebody from the community can help me.

    I call Unity from my Jenkins as follows:
    Code (groovy):
    1. bat "\"${unityHome}\\Editor\\Unity.exe\" -logFile \"${WORKSPACE}\\logfile.txt\" -projectPath \"${WORKSPACE}\\sternenschweif\" -quit -batchmode -executeMethod BuildCraftyProject.PerformWindowsDevBuild \"-targetdir ${OUTPUTDIR}\\build\""
    PerformWindowsDevBuild looks roughly like this:
    Code (csharp):
    1.  
    2.         BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions();
    3.         buildPlayerOptions.scenes = scenes;
    4.         buildPlayerOptions.locationPathName = target_dir;
    5.         buildPlayerOptions.target = build_target;
    6.         buildPlayerOptions.options = build_options;
    7.         string res = BuildPipeline.BuildPlayer( buildPlayerOptions );
    8.  
    9.         if( res.Length > 0 ) {
    10.             throw new System.Exception( "BuildPlayer failure: " + res );
    11.         }
    12.  
    And one time I get a failure, building 10 Minutes later witht he exact same parameters and data in the project folder gets me a success. I've attached both logs as they arrived in Jenkins for comparison. Any help or even a pointer towards useful documentation regarding this would be highly appreciated, thank you!
     

    Attached Files: