Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-20560

Custom-tools plugin breaks path for android-emulator

      Created for the original issue in JENKINS-19506

      I run customtools-plugin together with android-emulator-plugin, and when jenkins launches tasks for android-emulator, they are launched without the default PATH varable.
      This means that the shell scripts that start the emulator can't find common tools as dirname, file and so on.

      Workaround is to add a custom tool that defines default paths too, but thats site-wide and when some nodes have other PATH's than other, i can only add the directories that exists on all nodes.

          [JENKINS-20560] Custom-tools plugin breaks path for android-emulator

          Alexander Silgidjian added a comment - - edited

          I am experiencing an issue that also seems to be caused by this bug.
          Once I enable custom tools, I am not able to run Xvnc:

          Starting xvnc
          [smoke] $ vncserver :37
          /usr/bin/env: perl: No such file or directory
          Starting xvnc
          [smoke] $ vncserver :38
          /usr/bin/env: perl: No such file or directory
          Starting xvnc
          [smoke] $ vncserver :39
          /usr/bin/env: perl: No such file or directory
          Starting xvnc
          [smoke] $ vncserver :40
          /usr/bin/env: perl: No such file or directory
          
          FATAL: Failed to run 'vncserver :40' (exit code 127), blacklisting display #40; consider checking the "Clean up before start" option
          java.io.IOException: Failed to run 'vncserver :40' (exit code 127), blacklisting display #40; consider checking the "Clean up before start" option
          	at hudson.plugins.xvnc.Xvnc.doSetUp(Xvnc.java:100)
          	at hudson.plugins.xvnc.Xvnc.doSetUp(Xvnc.java:98)
          	at hudson.plugins.xvnc.Xvnc.doSetUp(Xvnc.java:98)
          	at hudson.plugins.xvnc.Xvnc.doSetUp(Xvnc.java:98)
          	at hudson.plugins.xvnc.Xvnc.setUp(Xvnc.java:73)
          	at hudson.model.Build$BuildExecution.doRun(Build.java:154)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:584)
          	at hudson.model.Run.execute(Run.java:1575)
          	at hudson.matrix.MatrixRun.run(MatrixRun.java:146)
          	at hudson.model.ResourceController.execute(ResourceController.java:88)
          	at hudson.model.Executor.run(Executor.java:237)
          

          The issue is solved, when I remove custom tool installation from the job.

          I am using a snapshot build of custom-tools, because I needed a fix for JENKINS-19506.

          Alexander Silgidjian added a comment - - edited I am experiencing an issue that also seems to be caused by this bug. Once I enable custom tools, I am not able to run Xvnc: Starting xvnc [smoke] $ vncserver :37 /usr/bin/env: perl: No such file or directory Starting xvnc [smoke] $ vncserver :38 /usr/bin/env: perl: No such file or directory Starting xvnc [smoke] $ vncserver :39 /usr/bin/env: perl: No such file or directory Starting xvnc [smoke] $ vncserver :40 /usr/bin/env: perl: No such file or directory FATAL: Failed to run 'vncserver :40' (exit code 127), blacklisting display #40; consider checking the "Clean up before start" option java.io.IOException: Failed to run 'vncserver :40' (exit code 127), blacklisting display #40; consider checking the "Clean up before start" option at hudson.plugins.xvnc.Xvnc.doSetUp(Xvnc.java:100) at hudson.plugins.xvnc.Xvnc.doSetUp(Xvnc.java:98) at hudson.plugins.xvnc.Xvnc.doSetUp(Xvnc.java:98) at hudson.plugins.xvnc.Xvnc.doSetUp(Xvnc.java:98) at hudson.plugins.xvnc.Xvnc.setUp(Xvnc.java:73) at hudson.model.Build$BuildExecution.doRun(Build.java:154) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:584) at hudson.model.Run.execute(Run.java:1575) at hudson.matrix.MatrixRun.run(MatrixRun.java:146) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:237) The issue is solved, when I remove custom tool installation from the job. I am using a snapshot build of custom-tools, because I needed a fix for JENKINS-19506 .

          Oleg Nenashev added a comment -

          I confirm the issue. Hope to resolve it soon

          Oleg Nenashev added a comment - I confirm the issue. Hope to resolve it soon

          Oleg Nenashev added a comment -

          The draft fix is ready: https://github.com/jenkinsci/customtools-plugin/pull/13
          This fix changes order of paths in ProcStarter. It may cause regressions in the case of multiple wrappers exporting same binaries from different folders (not good in any case), but it should work for other cases.

          Oleg Nenashev added a comment - The draft fix is ready: https://github.com/jenkinsci/customtools-plugin/pull/13 This fix changes order of paths in ProcStarter. It may cause regressions in the case of multiple wrappers exporting same binaries from different folders (not good in any case), but it should work for other cases.

          Anton Lundin added a comment -

          Not that good.

          Started by user anonymous
          Building in workspace /home/anton/Downloads/jenkins-dot/workspace/test2
          FATAL: Null value not allowed as an environment variable: PATH+
          java.lang.IllegalArgumentException: Null value not allowed as an environment variable: PATH+
          	at hudson.EnvVars.put(EnvVars.java:356)
          	at com.cloudbees.jenkins.plugins.customtools.CustomToolInstallWrapper$2.launch(CustomToolInstallWrapper.java:230)
          	at hudson.Launcher$ProcStarter.start(Launcher.java:353)
          	at hudson.Launcher$ProcStarter.join(Launcher.java:360)
          	at hudson.plugins.android_emulator.util.Utils.runAndroidTool(Utils.java:420)
          	at hudson.plugins.android_emulator.util.Utils.runAndroidTool(Utils.java:398)
          	at hudson.plugins.android_emulator.SdkInstaller.isPlatformInstalled(SdkInstaller.java:320)
          	at hudson.plugins.android_emulator.SdkInstaller.installPlatform(SdkInstaller.java:267)
          	at hudson.plugins.android_emulator.SdkInstaller.installPlatform(SdkInstaller.java:252)
          	at hudson.plugins.android_emulator.SdkInstaller.installDependencies(SdkInstaller.java:239)
          	at hudson.plugins.android_emulator.AndroidEmulator.setUp(AndroidEmulator.java:253)
          	at hudson.model.Build$BuildExecution.doRun(Build.java:154)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:566)
          	at hudson.model.Run.execute(Run.java:1679)
          	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
          	at hudson.model.ResourceController.execute(ResourceController.java:88)
          	at hudson.model.Executor.run(Executor.java:230)
          

          Anton Lundin added a comment - Not that good. Started by user anonymous Building in workspace /home/anton/Downloads/jenkins-dot/workspace/test2 FATAL: Null value not allowed as an environment variable: PATH+ java.lang.IllegalArgumentException: Null value not allowed as an environment variable: PATH+ at hudson.EnvVars.put(EnvVars.java:356) at com.cloudbees.jenkins.plugins.customtools.CustomToolInstallWrapper$2.launch(CustomToolInstallWrapper.java:230) at hudson.Launcher$ProcStarter.start(Launcher.java:353) at hudson.Launcher$ProcStarter.join(Launcher.java:360) at hudson.plugins.android_emulator.util.Utils.runAndroidTool(Utils.java:420) at hudson.plugins.android_emulator.util.Utils.runAndroidTool(Utils.java:398) at hudson.plugins.android_emulator.SdkInstaller.isPlatformInstalled(SdkInstaller.java:320) at hudson.plugins.android_emulator.SdkInstaller.installPlatform(SdkInstaller.java:267) at hudson.plugins.android_emulator.SdkInstaller.installPlatform(SdkInstaller.java:252) at hudson.plugins.android_emulator.SdkInstaller.installDependencies(SdkInstaller.java:239) at hudson.plugins.android_emulator.AndroidEmulator.setUp(AndroidEmulator.java:253) at hudson.model.Build$BuildExecution.doRun(Build.java:154) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:566) at hudson.model.Run.execute(Run.java:1679) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:230)

          Oleg Nenashev added a comment -

          Have you got it in the case of empty tools list?

          Oleg Nenashev added a comment - Have you got it in the case of empty tools list?

          Anton Lundin added a comment - - edited

          Yepp. Empty tools list works for non-android-emulator jobs, but it blows up for the android-emulator one.

          If i add a tool to the android-emulator job it works as expected.

          Anton Lundin added a comment - - edited Yepp. Empty tools list works for non-android-emulator jobs, but it blows up for the android-emulator one. If i add a tool to the android-emulator job it works as expected.

          Oleg Nenashev added a comment - - edited

          A patch has been added to PR. I've added Unit test for this issue, but could you re-test it?
          Thanks in advance, Oleg

          Oleg Nenashev added a comment - - edited A patch has been added to PR. I've added Unit test for this issue, but could you re-test it? Thanks in advance, Oleg

          Anton Lundin added a comment -

          Now it works like a charm.

          Good work!

          Anton Lundin added a comment - Now it works like a charm. Good work!

          Oleg Nenashev added a comment -

          Thank you too for the testing,
          I'll add some tests and release a public version by the weekend.

          Oleg Nenashev added a comment - Thank you too for the testing, I'll add some tests and release a public version by the weekend.

          I also confirm that the patch is working.
          Thanks!

          Alexander Silgidjian added a comment - I also confirm that the patch is working. Thanks!

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          src/main/java/com/cloudbees/jenkins/plugins/customtools/CustomToolInstallWrapper.java
          src/main/java/com/synopsys/arc/jenkinsci/plugins/customtools/PathsList.java
          http://jenkins-ci.org/commit/customtools-plugin/1ed68b4a65642113f4a61da08aa5f2e4da5d5b4b
          Log:
          [FIXED JENKINS-20560] - Custom-tools should not override global paths inside nested launchers

          I've also refactored retrieval of paths list.
          Related to: https://issues.jenkins-ci.org/browse/JENKINS-20560

          Signed-off-by: Oleg Nenashev <nenashev@synopsys.com>

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: src/main/java/com/cloudbees/jenkins/plugins/customtools/CustomToolInstallWrapper.java src/main/java/com/synopsys/arc/jenkinsci/plugins/customtools/PathsList.java http://jenkins-ci.org/commit/customtools-plugin/1ed68b4a65642113f4a61da08aa5f2e4da5d5b4b Log: [FIXED JENKINS-20560] - Custom-tools should not override global paths inside nested launchers I've also refactored retrieval of paths list. Related to: https://issues.jenkins-ci.org/browse/JENKINS-20560 Signed-off-by: Oleg Nenashev <nenashev@synopsys.com>

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          src/main/java/com/cloudbees/jenkins/plugins/customtools/CustomToolInstallWrapper.java
          src/main/java/com/synopsys/arc/jenkinsci/plugins/customtools/PathsList.java
          src/test/java/com/cloudbees/jenkins/plugins/customtools/CustomToolInstallWrapperTest.java
          http://jenkins-ci.org/commit/customtools-plugin/84cac80f50b70aa1f31ba23b1a169e4a69ce7425
          Log:
          JENKINS-20560 - Don't try to override empty paths
          Caused by the initial fix of https://issues.jenkins-ci.org/browse/JENKINS-20560

          Signed-off-by: Oleg Nenashev <nenashev@synopsys.com>

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: src/main/java/com/cloudbees/jenkins/plugins/customtools/CustomToolInstallWrapper.java src/main/java/com/synopsys/arc/jenkinsci/plugins/customtools/PathsList.java src/test/java/com/cloudbees/jenkins/plugins/customtools/CustomToolInstallWrapperTest.java http://jenkins-ci.org/commit/customtools-plugin/84cac80f50b70aa1f31ba23b1a169e4a69ce7425 Log: JENKINS-20560 - Don't try to override empty paths Caused by the initial fix of https://issues.jenkins-ci.org/browse/JENKINS-20560 Signed-off-by: Oleg Nenashev <nenashev@synopsys.com>

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          src/main/java/com/cloudbees/jenkins/plugins/customtools/CustomToolInstallWrapper.java
          src/main/java/com/synopsys/arc/jenkinsci/plugins/customtools/PathsList.java
          src/test/java/com/cloudbees/jenkins/plugins/customtools/CustomToolInstallWrapperTest.java
          http://jenkins-ci.org/commit/customtools-plugin/6c81ebbc162d9ccfaba9750d977a68c9f5dacc0e
          Log:
          Merge pull request #13 from synopsys-arc-oss/JENKINS_20560_FIX

          [FIXED JENKINS-20560] - Custom-tools should not override global paths in...

          Compare: https://github.com/jenkinsci/customtools-plugin/compare/5d9a150ffd10...6c81ebbc162d

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: src/main/java/com/cloudbees/jenkins/plugins/customtools/CustomToolInstallWrapper.java src/main/java/com/synopsys/arc/jenkinsci/plugins/customtools/PathsList.java src/test/java/com/cloudbees/jenkins/plugins/customtools/CustomToolInstallWrapperTest.java http://jenkins-ci.org/commit/customtools-plugin/6c81ebbc162d9ccfaba9750d977a68c9f5dacc0e Log: Merge pull request #13 from synopsys-arc-oss/JENKINS_20560_FIX [FIXED JENKINS-20560] - Custom-tools should not override global paths in... Compare: https://github.com/jenkinsci/customtools-plugin/compare/5d9a150ffd10...6c81ebbc162d

            oleg_nenashev Oleg Nenashev
            oleg_nenashev Oleg Nenashev
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: