Jenkins slave build with JDK not previously installed

Asked

Viewed 454 times

5

I have a Jenkins server that orchestrates my build. Overall, it performs lighter builds, but I need the slave to build GWT projects by SSD. I have some freedom with that slave, but he is a resource borrowed from another company.

By the way, in this machine that the other company has kindly given, there is a Jenkins server on which the product of this other company is built. And I wouldn’t want to bother with any change of JDK without having control that the change will be completely Sandboxed not to affect the product of others.

JDK builds options available:

opções de JDK disponíveis, 7u65, 6u45, 8u25, 8u91

I set up Jenkins to build with Jdk8u91 as per the image:

opção JDK8u91 selecionada

Getting the following error message:

Installing PATH/TO/SLAVE/tools/Hudson.model.JDK/Jdk_8u91/jdk.exe
[Jdk_8u91] $ PATH/TO/SLAVE/tools/Hudson.model.JDK/Jdk_8u91/jdk.exe /s ADDLOCAL="Toolsfeature" REBOOT=Reallysuppress INSTALLDIR=PATH TO SLAVE tools Hudson.model.JDK Jdk_8u91 /L PATH TO SLAVE tools Hudson.model.JDK install21157619502298069log log
ERROR: SEVERE ERROR occurs
org.jenkinsci.lib.envinject.Envinjectexception: java.io.Ioexception: Cannot run program "PATH/TO/SLAVE/tools/Hudson.model.JDK/Jdk_8u91/jdk.exe" (in directory "PATH TO SLAVE Hudson.model.JDK Jdk_8u91"): Createprocess error=740, The requested operation requires elevation
at org.jenkinsci.plugins.envinject.service.EnvInjectVariableGetter.getBuildVariables(Envinjectvariablegetter.java:91)
[... lines omitted because they appear to be irrelevant ...]
Caused by: java.io.Ioexception: Cannot run program "PATH/TO/SLAVE/Hudson.model.JDK/Jdk_8u91/jdk.exe" (in directory "PATH TO SLAVE tools Hudson.model.JDK Jdk_8u91"): Createprocess error=740, The requested operation requires elevation
at java.lang.Processbuilder.start(Unknown Source)
[... lines omitted because they appear to be irrelevant ...]
Caused by: java.io.Ioexception: Createprocess error=740, Requested operation requires upgrade
at java.lang.Processimpl.create(Native Method)
[... lines omitted because they appear to be irrelevant ...]

I accessed the server slave and run the installation command line manually at the prompt with administrator permissions:

PATH/TO/SLAVE/tools/hudson.model.JDK/JDK_8u91/jdk.exe /s ADDLOCAL="ToolsFeature" REBOOT=ReallySuppress INSTALLDIR=PATH\TO\SLAVE\tools\hudson.model.JDK\JDK_8u91 /L PATH\TO\SLAVE\tools\hudson.model.JDK\install2115761959202298069log

However, when trying to build again, I got exactly the same error message. As if Jenkins hadn’t identified the existence of the newly installed JDK.

When trying to select Jdk8u25, Jenkins thought it was installed because it did not try to run the installer, but it is actually having an inconsistency in the system because the executable is not in the desired place:

[project-gwt] $ OTHER JENKINS tools Hudson.model.JDK Jdk_8u25 jdk1.8.0_25/bin/java -cp PATH/TO/SLAVE/maven31-agent.jar;PATH TO SLAVE tools Hudson.tasks.Maven_maveninstallation MVN_311 boot plexus-classworlds-2.5.1.jar;PATH TO SLAVE tools Hudson.tasks.Maven_maveninstallation MVN_311/conf/logging Jenkins.maven3.agent.Maven31main PATH/TO/SLAVE/tools/Hudson.tasks.Maven_maveninstallation/MVN_311 PATH TO USER Appdata Locallow Sun Java Deployment cache 6.0 3 893ffc3-1f519d29 PATH/TO/SLAVE/maven31-Interceptor.jar PATH/TO/SLAVE/maven3-Interceptor-Commons.jar 51822
ERROR: Failed to parse Poms
java.io.Ioexception: Cannot run program "OTHER JENKINS tools Hudson.model.JDK Jdk_8u25 jdk1.8.0_25/bin/java" (in directory "PATH TO SLAVE Workspace Geosales_portal portal"): Createprocess error=2, The system cannot find the specified file
at java.lang.Processbuilder.start(Unknown Source)
[... lines omitted because they appear to be irrelevant ...]


  • How to install JDK via Jenkins on slave without needing high access?
  • Or else, how to get around this situation, install so Sandboxed the JDK and be able to indicate to Jenkins that?

About fixing the GWT project to make the build fast... we’re working on it. There are 109 classes dealing with asynchronous GWT requests, made by passing HashMap and receiving List or List<HashMap> as an answer. Yes, it was done raw originally. But the legacy work is too big to fix, we are working since last year between one customization and another to decrease the time that GWT is processing the oracle typing things, or using specific classes for the required purpose.

But this is not feasible to fix in the short term...

  • Is the slave running as a Windows service there on the other side? Maybe this gives a light (I don’t try to answer I don’t have any Windows machines here to try to replicate the problem, haha): https://community.smartbear.com/t5/TestComplete-General-Discussions/Jenkins-execution-gt-The-requested-operation-requires-elevationtd-p/144347

  • @nunks.lol is not service, jnlp makes sense? That name came to mind

  • @nunks.lol, my VPN is not working. Monday I try to explore these options

  • 1

    makes sense, jnlp is extension of Java Web Start, those services in which you download an applet... In this link q pasted one of the possible exits is to run the agent JNLP as a service in remote Windows.

2 answers

3

I am still struggling to try to solve in a more elegant way. I considered the reply from @nunks.lol elegant, putting the service and everything else, but as the server is Windows I just could not do much.

After getting tired of solving elegantly, I decided to try options in Main. So, I found this link here that talks about configure JDK on Jenkins and I noticed an important detail:

JDK can also be installed by intimating Jenkins to do the task. The check box install Automatically needs to be checked in this case.

In free translation:

JDK can also be installed by subpoenaing Jenkins to perform the task. The check box "install Automatically" needs to be checked in this case

Well, I had already managed to manually install the desired JDK. So, what if I wanted to simply avoid automatic installation?

Well, I ran the manual installation:

PATH/TO/SLAVE/tools/hudson.model.JDK/JDK_8u151/jdk.exe /s ADDLOCAL="ToolsFeature" REBOOT=ReallySuppress INSTALLDIR=PATH\TO\SLAVE\tools\hudson.model.JDK\JDK_8u151 /L PATH\TO\SLAVE\tools\hudson.model.JDK\install2115761959202298069log

And in Jenkins' JDK configuration, I added JDK JDK_8u151_SLAVE with the check in "install Automatically" desiccated. Stayed like this:

Janela exibindo o JDK_8u151_SLAVE sem instalação automática

So in the build of job that needed to use the slave, selected to run with this JDK:

Configuração do job

With this, Jenkins did not attempt to install over the installed JDK, using the already installed.

2

I decided to register here a reply, from of this Q&A and of documentation from the Testcomplete tool, specifying settings needed to run on Jenkins Windows installations.

What got me to that article was the crux of the error message in the question:

Caused by: java.io.Ioexception: Createprocess error=740, Requested operation requires upgrade

In English, for future cross-reference:

java.io.Ioexception: Createprocess error=740, The requested Operation requires Elevation.

This type of message occurs when it is necessary that the executing user has Administrator permissions, or at least higher permissions than those of an ordinary user, and by comments you seem to be using slave via JNLP: mode in which the remote server opens a Jenkins master page and downloads an agent applet, useful for situations in which the master cannot open connection directly. The JNLP agent must be manually accessed and executed once on the remote machine and then installed as a service so that manual procedure is no longer required, as per JNLP slave mode documentation.

Thus, due to the error message presented, it is very possible that your slave agent is not running as a service on remote Windows, with no administrator permissions.

What causes me certain strangeness is that it requires elevation to run a JDK, something that I thought could be run by any user:

ERROR: SEVERE ERROR occurs org.jenkinsci.lib.envinject.Envinjectexception: java.io.Ioexception: Cannot run program "PATH/TO/SLAVE/tools/Hudson.model.JDK/Jdk_8u91/jdk.exe" (in directory "PATH TO SLAVE Hudson.model.JDK Jdk_8u91"): Createprocess error=740, A requested operation requires at lift org.jenkinsci.plugins.envinject.service.EnvInjectVariableGetter.getBuildVariables(Envinjectvariablegetter.java:91)

Is the slave’s JDK set to open network ports only accessible to privileged users when climbing? This would explain analogous error message on Linux, but I’m not particularly versed in Windows security features.

In time, it may be good to consult the jenkins' documentation to check if some other slave configuration mode is not more advantageous to you.

Another link that can help (I’m sorry if it’s something very basic, as I said I don’t know much about Windows and I don’t have the machine here to test this setup) is this article on Windows services, explaining how to register the execution of services, how to link them to specific users and how to give you interactive access to the user interface. If your build Jenkins needs to execute commands in the GUI, such as interacting with mouse and keyboard, you may need to enable this latter property, and the error message received may result from this lack of permission, as quoted in the link at the beginning of this "reply", in the Testcomplete documentation.

  • Day of testing the solution...

  • @Jeffersonquesado hahah, good luck!

  • I could not put as service u.u I did not know how to use "sc" to do this

  • I got it in an alternate way that I’m not proud of, but I will insist more on your solution yet

  • I will try to insist more on the option of services... Meanwhile, running a manually installed JDK broke the branch: https://answall.com/a/252849/64969 until someone unintentionally selects the option that installs the JDK automatically, which overwrites what I manually installed =)

  • Cool! I had not realized that this execution dealt with the installation of JDK, then really need to be admin. What if you give a custom name and path to the JDK you manually installed, something out of the standards used by Jenkins, to prevent an automatic installation from overwriting the whole thing? From the link you posted in your reply, it looks like Jenkins is okay with anything.

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.