I have been trying to run SonarQube in jenkins for my Xamarin project. I was able to build the project successfully using jenkins.
My SonarScanner is installed like here,
I am getting following error, when i tried to run the sonar scanner through my builder.
> [app] $ dotnet /Users/zumry/.jenkins/tools/hudson.plugins.sonar.MsBuildSQRunnerInstallation/sonar-scanner/SonarScanner.MSBuild.dll begin /k:appid /n:xamarin_app /v:1.0 /d:sonar.host.url=http://localhost:9000 ******** sonar.login=admin sonar.password=admin
> FATAL: Cannot run program "dotnet" (in directory "/Users/zumry/.jenkins/workspace/app"): error=2, No such file or directory
java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
Caused: java.io.IOException: Cannot run program "dotnet" (in directory "/Users/zumry/.jenkins/workspace/app"): error=2, No such file or directory
Related
Jenkins building a simple hello world app fails with this command
Caused by: hudson.plugins.git.GitException: Command "git init /Users/jenkins/workspace/helloworld" returned status code 1:
stdout:
stderr: xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2430)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2360)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2356)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1916)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:988)
... 11 more
[Pipeline] }
[Pipeline] // node
[Pipeline] }
Cloning repository https://github.com/xxx/demo_qmake_hello_world.git
> git init /Users/jenkins/workspace/helloworld # timeout=10
[Pipeline] // stage
[Pipeline] End of Pipeline
ERROR: Error cloning remote repo 'origin'
Finished: FAILURE
Obviously the Jenkins java SSH connection does not find git on my mac.
But why? Yes the execution context seems to be different, not the same PATH...But adding the PATH to the node's ENV did not work. Other people had the same issues, and only got this answer, but it just does not work.
Update
There is an option on the node to specify Git Tool location. I added it like this.
Git seems to be found now. But now the permissions are unsufficient.
Caused by: java.io.IOException: Cannot run program "/usr/local/git/bin" (in directory "/Users/jenkins/workspace/helloworld"): error=13, Permission denied
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at hudson.Proc$LocalProc.<init>(Proc.java:252)
at hudson.Proc$LocalProc.<init>(Proc.java:221)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:936)
at hudson.Launcher$ProcStarter.start(Launcher.java:454)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2423)
... 15 more
Caused by: java.io.IOException: error=13, Permission denied
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 20 more
With ls -la /usr/local/git/bin I have checked the ownership.
git belonged to root, but I have changed it to jenkins.
Still this seems not enough, still get the permission error...
-rwxr-xr-x 1 jenkins wheel 5941024 Nov 8 2017 git
Update 2
The correct path in the Node's tools is /usr/local/git/bin/git. That was the problem.
which git - is the command to find git location on mac
I am trying to setup jenkins on docker in my windows machine. Everything was going smooth until I configured the maven goal in Jenkins. It looks like maven is overlooking the Jenkins_home path configured while starting the docker. I used the following command during startup
docker run -p 8080:8080 -p 50000:50000 -v //D/jenkins:/var/jenkins_home Jenkins
I also tried the following
docker run -p 8080:8080 -p 50000:50000 -v jenkins_home://D/jenkins_workspace jenkins
but I keep getting the error
[crazywebapp_dev] $ mvn clean install
FATAL: command execution failed java.io.IOException: error=2, No such
file or directory at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.(UNIXProcess.java:247) at
java.lang.ProcessImpl.start(ProcessImpl.java:134) at
java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) Caused:
java.io.IOException: Cannot run program "mvn" (in directory
"/var/jenkins_home/workspace/crazywebapp_dev"): error=2, No such file
or directory at
java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) at
hudson.Proc$LocalProc.(Proc.java:249)
I believe it has got to do something with maven because the Jenkins workspace is getting created in my D: drive and the code is checked out successfully from bit bucket and the workspace contents shows up in Jenkins. I have also noticed that even though the workspace is created in my D: drive, Jenkins_home still shows up as /var/Jenkins_home in the Jenkins config page. Please help me figure this out.
I have also noticed that even though the workspace is created in my
D: drive, Jenkins_home still shows up as /var/Jenkins_home in the
Jenkins config page. Please help me figure this out.
From the containers perspective, there is no D: drive, the jenkins_home will always be /var/jenkins_home inside the container.
The syntax -v //D/jenkins:/var/jenkins_home means mount D:\jenkins onto /var/jenkins_home inside the container. This will effectively just replace or backup the containers jenkins home in the jenkins folder.
The syntax -v jenkins_home://D/jenkins_workspace is not useful. It means "create" a /D/jenkins_workspace directory inside the container and use a named volume called jenkins_home to backup this folder. This is not useful.
The main problem that you have, is that maven is not installed inside the jenkins container. Thus jenkins clearly can't find it. You need to configure maven to be installed. You can do that in jenkins, by going to:
Manage Jenkins > Configure System > Maven section and then configure it to install maven automatically.
I'm trying to build Apache NiFi after cloning it from https://github.com/apache/nifi and it keeps failing on the tests on the nifi-standard-processors project. I opened up the output file in the surefire-reports directory and there's the below error that it can't run program "cmd" in directory /var/test, because no such file or directory exists. The first time I ran the install it didn't exist, but I created it and I still get the error message. I do a sanity check every time to make sure the directory still does exist. Does anyone have any idea what might be causing this issue? I'm only taking a very few steps to do this. They are posted below. I'm logged on as root on a CentOS Linux VM. Thanks in advance for any help.
Steps:
cd /tmp
git clone https://github.com/apache/nifi
cd nifi
mvn clean install
[main] ERROR org.apache.nifi.processors.standard.ExecuteProcess - ExecuteProcess[id=a8d6b3a3-befa-4b74-a962-330bd021ec7b] Failed to create process due to java.io.IOException: Cannot run program "cmd" (in directory "/var/test"): error=2, No such file or directory: java.io.IOException: Cannot run program "cmd" (in directory "/var/test"): error=2, No such file or directory
I believe this is due to a recent commit "solving" this ticket[1]. I actually already reopened[2] it due to failures on TravisCI and the contributor is currently working on a fix.
In order to build now, you can tell maven to "skip tests" by running the command with the proper flag: mvn clean install -Dmaven.test.skip=true
[1] https://issues.apache.org/jira/browse/NIFI-2905
[2] https://issues.apache.org/jira/browse/NIFI-2905?focusedCommentId=15603258&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15603258
I am using Jenkings in Linux_Machine_1. It have around 20 jobs(successfully running jobs)
I copied .jenkins folder to Linux_Machine_2. I started Jenkins in Linux_Machine_2.
I tried to run one of the jobs and I am getting below error:
Started by user anonymous
Building in workspace /home/portaldev/.jenkins/workspace/Trunk_Build
[Trunk_Build] $ /usr/local/bin/bash -xe /tmp/hudson1846171411013031358.sh
FATAL: command execution failed
java.io.IOException: Cannot run program "/usr/local/bin/bash" (in directory "/home/portaldev/.jenkins/workspace/Trunk_Build"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:763)
at hudson.Launcher$ProcStarter.start(Launcher.java:353)
at hudson.Launcher$ProcStarter.join(Launcher.java:360)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:91)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:60)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804)
at hudson.model.Build$BuildExecution.build(Build.java:199)
at hudson.model.Build$BuildExecution.doRun(Build.java:160)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:586)
at hudson.model.Run.execute(Run.java:1576)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:241)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:135)
at java.lang.ProcessImpl.start(ProcessImpl.java:130)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1021)
... 16 more
Build step 'Execute shell' marked build as failure
An attempt to send an e-mail to empty list of recipients, ignored.
Finished: FAILURE
After I created simple job Test_Job (no build scripts) in the Linux_Machine_2. And build, even I am getting same type of error.
I tried by execute permission to all .jenkins folder
chmod +x .jenkings/
Even same out error output.
I run which bash and it gave output /bin/bash.
say ls -l /usr/local/bin/bash on machine 1 to see if there's a symbolic link from /usr/local/bin/bash to /bin/bash. if yes, then create the same link on machine 2:
cd /usr/local/bin
ln -s /bin/bash .
i'm trying to built my Xcode Projekt with Jenkins, but when i built i get the error
Started by user anonymous Building in workspace /Users/icash/.jenkins/jobs/first-ios-app/workspace JDK installation
skipped: Unknown CPU name: mac os x Checkout:workspace / /Users/icash/.jenkins/jobs/first-ios-app/workspace -
hudson.remoting.LocalChannel#13ed9bc5 Using strategy: Default Last Built Revision:
Revision abc22103fa068c103fabf76999ec03d8710957f4 (origin/master)
Checkout:workspace / /Users/icash/.jenkins/jobs/first-ios-app/workspace -
hudson.remoting.LocalChannel#13ed9bc5 Fetching changes from 1 remote Git repository Fetching upstream changes
from git://github.com/shinetech/jenkins-ios-example.git Commencing build of Revision
abc22103fa068c103fabf76999ec03d8710957f4 (origin/master) Checking out Revision abc22103fa068c103fabf76999ec03d8710957f4
(origin/master) JDK installation skipped: Unknown CPU name: mac os x Working directory is
/Users/icash/.jenkins/jobs/first-ios-app/workspace [workspace] $ /users/icash/dev/ -version FATAL: Cannot run program
"/users/icash/dev/" (in directory "/Users/icash/.jenkins/jobs/first-ios-app/workspace"): error=13, Permission denied
java.io.IOException: Cannot run program "/users/icash/dev/" (in directory
"/Users/icash/.jenkins/jobs/first-ios-app/workspace"): error=13, Permission denied
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460) at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(Proc.java:216) at hudson.Launcher$LocalLauncher.launch(Launcher.java:707)
at hudson.Launcher$ProcStarter.start(Launcher.java:338) at hudson.Launcher$ProcStarter.join(Launcher.java:345)
at au.com.rayh.XCodeBuilder.perform(XCodeBuilder.java:120)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:703)
at hudson.model.Build$RunnerImpl.build(Build.java:178)
at hudson.model.Build$RunnerImpl.doRun(Build.java:139)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:473)
at hudson.model.Run.run(Run.java:1410)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:238) Caused by: java.io.IOException: error=13, Permission denied
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:53)
at java.lang.ProcessImpl.start(ProcessImpl.java:91)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
although i gave .jenkins folder all permission.
Looks like that it is trying to run a directory (/users/icash/dev/) as if it is an app. Seems something is configured incorrectly. Search for /users/icash/dev/ in your top-level config.xml; if not found search for a pattern ${var_name}/dev. If not found there, look in config.xml for your job.
I bet your build step looks like:
/users/icash/dev/$SOMEVARIABLE -version
and SOMEVARIABLE is not defined in the environment where Jenkins is running. That is why it expands into an empty string. What is left is the path to a directory and you cannot execute that.
If you need some environment variables in Jenkins, you can set them by going to Jenkins UI -> Manage Jenkins -> Configure System. Then add environment variables there.