Execution context from within an jenkins build

133 views
Skip to first unread message

Schalk Neethling

unread,
Mar 10, 2012, 3:12:57 PM3/10/12
to jenkins...@googlegroups.com
Hey all,

Quick question regarding ant and Jenkins. So, I am getting the following error : "Execute failed: java.io.IOException: Cannot run program" at the first step in my Ant build step. When I run the same Ant target via the terminal as the jenkins user it executes without a problem. This leads me to believe that there is a difference between running Ant directly via the terminal and running Ant from within a Jenkins build.

What is different between executing from the terminal directly and having the Ant target executed from a jenkins build? Is there some config I might be missing?

Thanks,
Schalk

Sami Tikka

unread,
Mar 10, 2012, 5:56:23 PM3/10/12
to jenkins...@googlegroups.com
Did you configure ant location in the Manage Jenkins / Configure System / Tool locations?

-- Sami

Schalk Neethling

unread,
Mar 11, 2012, 8:17:38 AM3/11/12
to jenkins...@googlegroups.com
Hey Sami,

So here is my system config

Home Directory :: /Users/Shared/Jenkins/Home

Under Global Properties

Tool locations for Ant as follows:

/usr/local/apache-ant-1.8.2

JDK installations :: /Library/Java/Home

Git installations :: git

Ant installations :: /usr/local/apache-ant-1.8.2

SSH Server set to random

No password SSH private key and I have a Github web hook set up that verifies perfectly.

With all of the above I am still getting the following:

Started by an SCM change
Building in workspace /Users/Shared/Jenkins/Home/jobs/SocorroCSS/workspace
Checkout:workspace / /Users/Shared/Jenkins/Home/jobs/SocorroCSS/workspace - hudson.remoting.LocalChannel@6a5d5a2c
Using strategy: Default
Checkout:workspace / /Users/Shared/Jenkins/Home/jobs/SocorroCSS/workspace - hudson.remoting.LocalChannel@6a5d5a2c
Fetching changes from 1 remote Git repository
Fetching upstream changes from /Users/sneethling/mozilla/projects/socorro/
Commencing build of Revision 6da056d198dfb68c68c97234aaf7da54e28be622 (origin/add-csslint-ant-task)
Checking out Revision 6da056d198dfb68c68c97234aaf7da54e28be622 (origin/add-csslint-ant-task)
No change to record in branch origin/add-csslint-ant-task
[workspace] $ ant csslint
Buildfile: /Users/Shared/Jenkins/Home/jobs/SocorroCSS/workspace/build.xml

csslint:

BUILD FAILED
/Users/Shared/Jenkins/Home/jobs/SocorroCSS/workspace/build.xml:9: Execute failed: java.io.IOException: Cannot run program "csslint": error=2, No such file or directory

Thanks,
Schalk

Sami Tikka

unread,
Mar 11, 2012, 1:50:20 PM3/11/12
to jenkins...@googlegroups.com
The error "Cannot run program "csslint": error=2, No such file or
directory" tells me either you do not have the program csslint in your
system or it is installed somewhere where ant isn't looking for it.

You can check the value of PATH environment variable by e.g. going to
$JENKINS_URL/systemInfo

If the value of PATH isn't what you want it to be, you can change it
at $JENKINS_URL/configure under the heading "Environment variables"

-- Sami

2012/3/11 Schalk Neethling <sneet...@mozilla.com>:

Schalk Neethling

unread,
Mar 11, 2012, 3:29:46 PM3/11/12
to jenkins...@googlegroups.com
Hey Sami,

I updated the PATH by going to $JENKINS_URL/configure under the heading "Environment variables" and adding a new env entry as follows:

Name: PATH
Value: /opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin

The value above is the same $PATH info I get when echoing from the terminal as the jenkins user. When heading back to $JENKINS_URL/systemInfo however, the value for PATH in the Environment variables table has not changed.

Thanks for the all the assistance so far,

Schalk Neethling

unread,
Mar 11, 2012, 3:31:37 PM3/11/12
to jenkins...@googlegroups.com
Hey Sami,

Even though it does not change on the sys info screen as stated, it does clearly take effect and my build no completed successfully.

Thanks a million,

Sami Tikka

unread,
Mar 11, 2012, 3:54:13 PM3/11/12
to jenkins...@googlegroups.com
The sys info page shows the value of PATH in the environment of
Jenkins itself. The environment variable setting you added is the
value of PATH which Jenkins sets into the environment of processes it
starts.
Reply all
Reply to author
Forward
0 new messages