How to solve Build Failure in Jenkins - jenkins

I'm facing an issue in scheduling a job in JENKINS.
Below the build statement and error which i got in JENKINS, Can anyone please help me to resolve it?
Started by user shreeshankari
Running as SYSTEM
BuildingInstalling C:\Users\Srisankari\.jenkins\tools\hudson.model.JDK\jdk-11.0.14\jdk.exe
[jdk-11.0.14] $ C:\Users\Srisankari\.jenkins\tools\hudson.model.JDK\jdk-11.0.14\jdk.exe /s ADDLOCAL="ToolsFeature" REBOOT=ReallySuppress INSTALLDIR=C:\Users\Srisankari\.jenkins\tools\hudson.model.JDK\jdk-11.0.14 /L C:\Users\Srisankari\.jenkins\tools\hudson.model.JDK\install10470724292190900076log
Unknown error (0x2e4)
FATAL: Cannot run program "C:\Users\Srisankari\.jenkins\tools\hudson.model.JDK\jdk-11.0.14\jdk.exe" (in directory "C:\Users\Srisankari\.jenkins\tools\hudson.model.JDK\jdk-11.0.14"): CreateProcess error=740, The requested operation requires elevation
java.io.IOException: CreateProcess error=740, The requested operation requires elevation
at java.base/java.lang.ProcessImpl.create(Native Method)
at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:487)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:154)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
Caused: java.io.IOException: Cannot run program "C:\Users\Srisankari\.jenkins\tools\hudson.model.JDK\jdk-11.0.14\jdk.exe" (in directory "C:\Users\Srisankari\.jenkins\tools\hudson.model.JDK\jdk-11.0.14"): CreateProcess error=740, The requested operation requires elevation
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
at hudson.Proc$LocalProc.<init>(Proc.java:254)
at hudson.Proc$LocalProc.<init>(Proc.java:223)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:997)
at hudson.Launcher$ProcStarter.start(Launcher.java:509)
at hudson.Launcher$ProcStarter.join(Launcher.java:520)
at hudson.tools.JDKInstaller.install(JDKInstaller.java:283)
at hudson.tools.JDKInstaller.performInstallation(JDKInstaller.java:157)
at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:70)
at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:108)
at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:221)
at hudson.model.JDK.forNode(JDK.java:149)
at hudson.model.AbstractProject.getEnvironment(AbstractProject.java:341)
at hudson.model.Run.getEnvironment(Run.java:2430)
at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:952)
at hudson.model.AbstractBuild$AbstractBuildExecution.decideWorkspace(AbstractBuild.java:453)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:507)
at hudson.model.Run.execute(Run.java:1896)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44)
at hudson.model.ResourceController.execute(ResourceController.java:101)
at hudson.model.Executor.run(Executor.java:442)
Finished: FAILURE

According to your error message, you are trying to run jdk.exe /s ADDLOCAL="ToolsFeature" RE... but it requires elevated privileges to run. The simplest way around this issue is to run your Jenkins as a service with elevated privileges. The way to do this is outlined in this question.
On a different note, I'm not completely sure what is happening here but assuming that you are trying to install JDK. So it might make sense instead to install the JDK separately, and point Jenkins to it. This article has a good tutorial on it. Pay attention to point 3, which has the information you are looking for.

Related

py.test' is not recognized as an internal or external command, operable program or batch file while executing through command prompt

I need your support in order to resolve the below issue. I highly appreciate it if could help here.
I have checked the related post, there was one similar issue but that is during installation. In my case, I have successfully installed the py.test, and I was using it was working as well. Post Jenkins installation I am facing the issue. I have passed the command line in the shell script and tried to execute the Job through Jenkins it is failed. To cross-check, I have verified in the command prompt it throws " py.test' is not recognized as an internal or external command, operable program or batch file". Can you please let me what all checks need to be done to rectify the issue?
Analysis from my end:
Checked in the system variables, there I can see python has been declared.
Regards,
Shiva
I have a work-around solution for that. If you uninstall jenkins from your PC and install&start jenkins from CMD with java -jar jenkins.war, it will resolve the problem. Now it can find and execute batch commands.

Why jib dockerBuild plugin fails to connect

I was trying to build the docker image for a project I'm working onto.
It's based on jhipster, after configuring the project it tells me to run the following maven command:
./mvnw -ntp -Pprod verify jib:dockerBuild
Unfortunately it doesn't seem to work, it returns me this errors:
[WARNING] The credential helper (docker-credential-pass) has nothing for server URL: registry.hub.docker.com
...
[WARNING] The credential helper (docker-credential-pass) has nothing for server URL: index.docker.io
[WARNING]
And finally fails with:
[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:2.4.0:dockerBuild (default-cli) on project booking: (null exception message): NullPointerException -> [Help 1]
Recently I worked on a google cloud project, and I edited the ~/.docker/config.json configuration file. I had to remove google's configuration entries to sort out another problem. Could that be the origin of the problem I'm facing now?
I've tried to do docker logout and docker login without success.
Some considerations
I don't know if editing manually the configuration caused the error, in fact I'm pretty sure to have deleted only google-related entries, but nothing referring to docker.* or similar.
To solve this issue, avoid to edit manually the docker configuration file. In fact I think that it should be avoided whenever possible, to avoid configuration problems of any sort.
Instead, just follow what the error message is trying to tell you: docker is not able to access those urls. Excluding network problems (which you can troubleshoot with ping registry-1.docker.io for example), it should be an authentication problem.
How to fix
I've found out that running those commands fixed it:
docker login registry.hub.docker.com
docker login registry-1.docker.io
I don't know if registry-1.docker.io is just a mirror of the other first server, which the plugin tries to access after the first unsuccessful connection. You can try to loging to registry.hub.docker.com and re-launch the command to see if it sufficient. In case it's not, login to the second one and then it will work.
I ran jib via Gradle:
./gradlew jibDockerBuild
and got a similar error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':jibDockerBuild'.
> com.google.cloud.tools.jib.plugins.common.BuildStepsExecutionException: Build to Docker daemon failed, perhaps you should make sure your credentials for 'registry-1.docker.io/library/openjdk' are set up correctly. See https://github.com/GoogleContainerTools/jib/blob/master/docs/faq.md#what-should-i-do-when-the-registry-responds-with-unauthorized for help
What ended up solving this error for me, bizarrely enough, was to log out of Docker Desktop.
I later also tried funder7's solution while logged in to Docker Desktop, and that also worked.

Problem with Jenkins running Robot Framework script

I am trying to automate the execution of Robot Framework using Jenkins.
But when I run Jenkins I am receiving the error "Permission denied". You can see bellow the error's print screen.
Despite several attenpts Im not able to identify where this restriction is.
I have already include the Jenkins user as SUDO user, but the error is still there.
I also applied o CHMOD 777 /home/eduardo/.local/bin/robot but did not solve.
Can someone please tell me how I can identify where this restriction (Permission denied) is.
Thank in advance.

PsExec is not recognized as an internal or external command

I have a job that needs to run a script on a remote computer. I'm doing so by using psexec via "Execute windows batch command":
C:\PsExec.exe \\computername -u username -p password -accepteula c:\xxx.exe
When I run the job I get the following error:
c:\PsExec.exe is not recognized as an internal or external command
** PsExec.exe is located under c:\
Any ideas?
First Define psexec.exe path in environment varaiable "PATH" or else place psexec.exe file in C:\Windows\System32\
And to Download Psexec.exe file
https://download.sysinternals.com/files/PSTools.zip
One possible explanation is the version of PsExec.exe: 32bits or 64bits.
If you have the 32 one on a 64bits machine, that command would not be recognized indeed. PsExec64.exe would.
I can see the age of this question and my answer may not be relevant to this topic since I was technically trying to solve a different problem, but maybe this will help other people who are stuck.
c:\PsExec.exe is not recognized as an internal or external command
I was trying to disable the Maintenance Configurator with PSExec (my problem is the never ending maintenance bug) and kept running into the same error as the OP BUT I got PSexec64 to run this command:
C:\PsExec64.exe -s schtasks /change /tn >"\Microsoft\Windows\TaskScheduler\Maintenance Configurator" /DISABLE
BY checking the "Run this program as an administrator" option under the Compatibility settings for "PsExec64.exe"
Don't know if this has solved my problem yet, but I think the OP would have been able to run his process if he had done this. Dear OP did you ever solve that?

Jenkins creating a view in ClearCase

I'm working on an automatic build using Jenkins and ClearCase and I have a problem.
I wrote a batch script to create a view in ClearCase using the cleartool command mkview.
When I execute the script by clicking on it, everything works, the view is created in ClearCase. But when I launch the script via Jenkins, I have the following errors :
C:\Program Files\Jenkins\workspace\JenkinsLecon1>
"C:\Program Files\IBM\RationalSDLC\ClearCase\bin\cleartool.exe"
mkview -sna -tag AUTOBUILD_VIEW_TEST1_CFW_INFRA_V5.10_Dev -str CFW_INFRA_V5.10_Dev#\projects -host sasla15001 -hpath d:\ClearCase_Storage\views\DOM3\268875\ -gpath \\sasla15001\ccstg_d\views\DOM3\268875\ CFW_INFRA_V5.10_Dev
Selected Server Storage Location "sasla15001_ccstg_d_views".
cleartool: Error: unable to set access control list for \\sasla15001\ccstg_d\views\AUTORITE+NT\SYSTEM\CFW_INFRA_V5.10_Dev.22.vws: Accès refusé.
cleartool: Error: protection on \\sasla15001\ccstg_d\views\AUTORITE+NT\SYSTEM\CFW_INFRA_V5.10_Dev.22.vws is out-of-synch with identity.sd and groups.sd
cleartool: Error: Failed to set identity on view: Permission denied
cleartool: Error: unable to set access control list for \\sasla15001\ccstg_d\views\AUTORITE+NT\SYSTEM\CFW_INFRA_V5.10_Dev.22.vws: Accès refusé.
cleartool: Error: \\sasla15001\ccstg_d\views\AUTORITE+NT\SYSTEM\CFW_INFRA_V5.10_Dev.22.vws:
Permission denied
cleartool: Error: Unable to create view "\\sasla15001\ccstg_d\views\AUTORITE+NT\SYSTEM\CFW_INFRA_V5.10_Dev.22.vws".
I pretty sure that the error come from an access right problem.
But I did not find an mkview option like -user or something like that to user my clearcase user account.
I hop that someone had the same problem and solve it or just someone who can help me!
For those who have the same problem, the solution is start Jenkins as administrator.
To do this :
1) open a prompt command as administrator
start/accessories/
Then right click on prompt command and choose start as
2) go to Jenkins directory
cd /D C:\Program Files\Jenkins
3) start Jenkins Server
java -jar jenkins.war --httpPort=8081 not 8080
wait until the sever is running this line will appear INFO:Jenkins is fully up and running
now the Jenkins server is running as administrator
4)open your web browser and go to
http ://localhost:8081
5) create your job!!!
to know where is the workspace just create a new batch script add the command line
cd
save and build the job. Next go to the console and just read the path
See for instance the Error: unable to set access control list for : Access is denied
The cause of this problem relates to restrictive permissions on either the view share or directory to which the view is being created.
Make sure who (i.e. which account) is executing those commands when run by Jenkins (is it the local system account?). As the OP Bastien mentions, running with elevated privileges is key.
Make also sure of the CLEARCASE_PRIMARY_GROUP environment variable value at the time of the Jenkins job.
It must be set to the group of the vob you want to access (or one of its secondary group).

Resources