Triggering a GIT Fetch, RESET Using JENKINS

I am in need of an urgent help and any guidance from anyone out there would be really appreciated.
Please find below the USE-CASE that I am trying to accomplish here:

I have a Java-package which is checked in GIT (and code.amazon.com) and I have a ANT job to trigger the package.
Within the ANT job, I have created a macrodef for GIT and I am performing a GIT FETCH and GIT RESET so that I can get the latest codebase every time I am triggering the ANT JOB.

When I am triggering the ANT job using ECLIPSE, it is working.
If I am running the ANT job from terminal using “ANT –buildfile my_buildfile.xml”, it is also working.

Now I have setup JENKINS on my machine and am trying to run the ANT file. Jenkins is not able to trigger the GIT job in the ANT file. It is giving following error.

/rhel5pdi/workplace/bangshis/EpubYJConvPerfWorkspace/src/EpubYJConvPerfLinux/Jenkins_Linux_build_Global.xml:81: The following error occurred while executing this line:
/rhel5pdi/workplace/bangshis/EpubYJConvPerfWorkspace/src/EpubYJConvPerfLinux/Jenkins_Linux_build_Global.xml:99: Execute failed: java.io.IOException: Cannot run program “git”: error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
at java.lang.Runtime.exec(Runtime.java:617)
at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:428)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:442)
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:628)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:669)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:495)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)

Part of this error might be due to the reason that, my JENKINS is not able to trigger the JOB as the current user of the HOST MACHINE.
To solve this problem, I have tried taking the following steps:
1. Creating a Global credential and using PASSWORD less account (RSA ID).
2. Logging into JENKINS using the same user name as system.
3. Installing GIT and GIT CLIENT plugins and setting them up appropriately.

Kindly let me know if I am missing some, and if there is any way out. If my approach is not correct, I would be glad if you can share few other ideas.


Source: eclipse

Leave a Reply