Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Resolved Weird bug when building with batchmode in Jenkins

Discussion in 'Editor & General Support' started by AxelHu20, Aug 13, 2020.

  1. AxelHu20

    AxelHu20

    Joined:
    Apr 30, 2020
    Posts:
    6
    System : win10-ver2004
    Unity : 2020.1f1/2019.4
    Jenkins : 2.222.1

    I use Jenkins to do some CI job for my project, the Jenkins will run a powershell script, and the powershell script will run unity in batchmode and execute a static method to build the project.

    The problem is, if I run the script manually, everything works fine, but if I run from Jenkins, the build will fail.

    The build log shows Unity can't find JDK path, but I set JDK path manually, and it works fine when building manually.

    I successfully reproduce this with an empty new project, so the problem is not inside my project.

    I know it's probably a Jenkins problem(bug or wrong config), but I don't understand why it stops unity from getting the correct path(in Windows registry).
     
  2. AxelHu20

    AxelHu20

    Joined:
    Apr 30, 2020
    Posts:
    6
    Fixed.

    On windows, Jenkins by default will run as SYSTEM user, so it don't know HKEY_CURRENT_USER registry for other user who is using Unity.

    Solution : run Jenkins with non SYSTEM user(change setting in system service), start unity once and set preference for that user. Or run Jenkins directly with the user that is using Unity.