Jenkins not Finding CVS on Solaris - jenkins

I'm trying to pull from a CVS repository from Jenkins on a Solaris box. Jenkins is running under Tomcat and CVS is on the same machine as Jenkins and Tomcat. When I try to set up a Jenkins job that pulls from CVS it fails with the following stack trace:
Building in workspace /home/tomcat/.jenkins/jobs/compile xml/workspace
cvs checkout -P -D 23 May 2013 15:49:46 -0800 -d workspace xml
ERROR: CVS Authentication failed: Connection error
org.netbeans.lib.cvsclient.connection.AuthenticationException: Connection error
at org.netbeans.lib.cvsclient.connection.LocalConnection.openConnection(LocalConnection.java:102)
at org.netbeans.lib.cvsclient.connection.LocalConnection.open(LocalConnection.java:145)
at org.netbeans.lib.cvsclient.Client$1.run(Client.java:374)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.io.IOException: Cannot run program "cvs": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
at java.lang.Runtime.exec(Runtime.java:593)
at java.lang.Runtime.exec(Runtime.java:431)
at java.lang.Runtime.exec(Runtime.java:328)
at org.netbeans.lib.cvsclient.connection.LocalConnection.openConnection(LocalConnection.java:95)
... 3 more
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:53)
at java.lang.ProcessImpl.start(ProcessImpl.java:65)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
... 7 more
ERROR: Cvs task failed
It looks to me that Jenkins can't find cvs. When I log in as tomcat and type cvs, the command works. If I create a job in Jenkins and run the cvs command from the shell task, the command works. If I echo environment variables, such as PATH or CVSROOT, I get the expected results.
Where does Jenkins look for cvs? How can I set its path so it can see cvs?
-Update-
This looks similar: https://issues.jenkins-ci.org/browse/JENKINS-12633 but I have cvs installed on the server

The problem ended up being that Jenkins was getting its path from tomcat and tomcat was not getting the same path as the tomcat user (I assume because I'm starting tomcat as a service). I solved this by adding the following to the beginning of catalina.sh
PATH=$PATH:/path/to/cvs
export PATH

Related

Getting an error while integrating SonarQube with Jenkins

I followed the SonarQube Jenkins integration tutorial from SonarQube official website. I am getting an error after building my project.
[RetailerWebsite_releaseTestCodeDx] $ "C:\Program Files (x86)\Jenkins2\tools\hudson.plugins.sonar.SonarRunnerInstallation\My_scanner\bin\sonar-scanner.bat" "SonarQube Scanner" -e -Dsonar.host.url=http://10.252.80.55:9000 -Dsonar.projectName=RetailerWebsite -Dsonar.projectVersion=1.0 -Dsonar.projectKey=Retailer-Website -Dsonar.sources=. -Dsonar.projectBaseDir=D:\Builds\RetailerWebsite_releaseTestCodeDx
\Jenkins2\tools\hudson.plugins.sonar.SonarRunnerInstallation\My_scanner\bin\..\jre was unexpected at this time.
ERROR: SonarQube scanner exited with non-zero code: 255
Project Configuration
Global Configuration
It appears you are victim of this Jenkins bug: when using a JRE installed at a path that includes parentheses, Jenkins (on Windows) tries to execute an invalid command.
Workaround: install the JDK elsewhere, and use that one in your Job configuration (or Jenkins itself).

Jenkins cannot run program sonar-runner

Installed:
Sonarqube 5.5
Sonar-runner 2.4 (http://dev.mamikon.net/installing-sonarqube-runner-on-ubuntu/)
When I try to run Jenkins with a simple project, this is the error I get:
[test] $ sonar-runner -e
-Dsonar.host.url=http://server_url:9000/sonar/ -Dsonar.projectBaseDir=/var/lib/jenkins/workspace/test
SONAR ANALYSIS FAILED
FATAL: command execution failed. java.io.IOException: Cannot run
program "sonar-runner" (in directory
"/var/lib/jenkins/workspace/test"): error=2, No such file or directory
It seems that jenkins cannot find the sonar-runner program.
But when I open the server with a terminal, and run sonar-runner, it analyzes the project.
Can someone help me with this?
after hours of frustration, it turned out i had to add environment variable in the /etc/profile file.
export SONAR_RUNNER_HOME=/opt/sonar-runner
export PATH=$PATH:$SONAR_RUNNER_HOME/bin

Jenkins build error - Cannot run program "ant"

I have build.xml set up to run a project to execute selenium test cases. I have mac computer and I can run ant from terminal. But when I try to run from jenkins I get following error. I have specified Ant home in Jenkins' config
/usr/local/Cellar/ant/1.9.4/libexec
I used homebrew to install ANT
FATAL: command execution failed.Maybe you need to configure the job to choose one of your Ant installations?
java.io.IOException: Cannot run program "ant" (in directory "/Users/Shared/Jenkins/Home/workspace/BaublebarTest"): error=2, No such file or directory
at java.lang.ProcessBuilder.processException(ProcessBuilder.java:478)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:457)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:802)
at hudson.Launcher$ProcStarter.start(Launcher.java:380)
at hudson.Launcher$ProcStarter.join(Launcher.java:387)
at hudson.tasks.Ant.perform(Ant.java:217)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
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:533)
at hudson.model.Run.execute(Run.java:1754)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.enter code hereforkAndExec(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:452)
... 15 more
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE
First, the proper way
Jenkins will install Ant (and other tools for you). On the Global Configuration (Manage Jenkins), configure Ant installation, by selecting the version and the source.
Then, when you run an Ant build step, you can choose a version, either default or the one you've just configured. When the build is executed, Jenkins will download, install, and configure that particular version for you (within Jenkins only), without affecting the rest of the OS. The installation only needs to happen once per node, and after that it's quick.
The default
That default version is a fallback that Jenkins uses when you haven't configured a proper version to use. It tries to use whatever is available on command line, simply by executing ant from current working directory.
You said it works for you when you just type ant on command line, but you've got to realize that Jenkins runs under jenkins user, not your logged in user, and things like ANT_HOME and proper path to Ant is probably configured specifically for your user.
So to fix your issue, either use the proper way with Jenkins doing the tool installation, or properly configure the tool on OS level for jenkins user.
You can start by typing:
sudo su jenkins
ant
And seeing if that works from within jenkins user
I am not using terminal for jenkins, but I was getting the same error. Changing Ant version from default to Ant fixed the errors.

P4 command line client in Jenkins issues on OSX

I've been scratching my head on this issue but haven't found a way around it. I've installed Jenkins on my OSX v10.8.4 using the Jenkins 1.571 installer from the Jenkins website.
It gets installed by default in /Users/Shared/Jenkins/Home folder.
I want to use Jenkins to act as a CI server for my iOS code residing on my company's perforce server. For this I created a user(matching to that of my perforce user along with the same password)on my OSX box. I also copied the P4 command line to /usr/local/bin and correctly setup the P4PORT to point to my perforce server settings. So far so good.
I verified that I was able to connect to my perforce server from command line by using the p4 login command, and it worked successfully.
I then installed the perforce plugin from Jenkins Manage plugins option (https://wiki.jenkins-ci.org/display/JENKINS/Perforce+Plugin).
Now when I create a new job and specify the settings correctly in the perforce plugin piece of the jenkins job, I always get these errors:
Started by user anonymous
Building in workspace /Users/Shared/Jenkins/Home/jobs/iosbuild/workspace
Using master perforce client: ios-jenkins
[workspace] $ p4 workspace -o ios-jenkins
Caught exception communicating with perforce. Could not run perforce command.com.tek42.perforce.PerforceException: Could not run perforce command.
at hudson.plugins.perforce.HudsonP4DefaultExecutor.exec(HudsonP4DefaultExecutor.java:90)
at com.tek42.perforce.parse.AbstractPerforceTemplate.getPerforceResponse(AbstractPerforceTemplate.java:331)
at com.tek42.perforce.parse.AbstractPerforceTemplate.getPerforceResponse(AbstractPerforceTemplate.java:301)
at com.tek42.perforce.parse.Workspaces.getWorkspace(Workspaces.java:61)
at hudson.plugins.perforce.PerforceSCM.getPerforceWorkspace(PerforceSCM.java:1615)
at hudson.plugins.perforce.PerforceSCM.getPerforceWorkspace(PerforceSCM.java:1576)
at hudson.plugins.perforce.PerforceSCM.checkout(PerforceSCM.java:892)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1252)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:624)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:530)
at hudson.model.Run.execute(Run.java:1732)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:234)
Caused by: java.io.IOException: Cannot run program "p4" (in directory "/Users/Shared/Jenkins/Home/jobs/iosbuild/workspace"): error=2, No such file or directory
at java.lang.ProcessBuilder.processException(ProcessBuilder.java:478)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:457)
at hudson.Proc$LocalProc.(Proc.java:244)
at hudson.Proc$LocalProc.(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:780)
at hudson.Launcher$ProcStarter.start(Launcher.java:360)
at hudson.plugins.perforce.HudsonP4DefaultExecutor.exec(HudsonP4DefaultExecutor.java:81)
... 14 more
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.(UNIXProcess.java:53)
at java.lang.ProcessImpl.start(ProcessImpl.java:91)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
... 19 more
ERROR: Unable to communicate with perforce. Could not run perforce command.
Finished: FAILURE`
First I specified the perforce jenkins plugin to create the workspace for me and also let jenkins to manage my views, but I still got the same above error.
Following is my view map:
//depot/rombay/MarketingApplication/iOS/ianywhere/... //ios-jenkins/depot/rombay/MarketingApplication/iOS/anywhere/...
I then created a workspace using the p4v client, and then deselected letting jenkins create my workspaces and manage my views. The view map remains the same. However, I still get the same error.
My hunch is that since Jenkins is installed in the shared folder it's not able to execute the p4 command. However, I tried doing that and it opened up the clientspec in vi for me, which is I guess the expected behavior, but I still don't understand as to why it says that it can't find the p4 program to work for me.
Any help here would be deeply appreciated as I've run out of ideas as to what could possibly be I doing wrong.
No softlinks are required. Check if you have updated the Global Settings for p4. Manage Jenkins->Global Settings

I am getting error while executing script from jenkins

In jenkins pre-build step I select Execute shell script on remote using ssh while executing script I am getting below error
cd /home/appsusr/bin; ./removetwl.sh
[ssh] Exception:java.io.FileNotFoundException: /home/appsusr/ .ssh/id_dsa (No such file directory)
com.Jcraft.jsch.JschException:java.io.filenotfoundexception: /home/aapsusr/ .ssh/id_dsa (no such file or directory)
Is there somewhere you're specifying the path to your SSH key? Looks like you have an extra space before .ssh.

Resources