Issue Details (XML | Word | Printable)

Key: BAM-1073
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Edwin Wong [Atlassian]
Reporter: Steve Loughran
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Bamboo

No way to pass proxy information down to Ant

Created: 28/Mar/07 06:18 AM   Updated: 23/Apr/07 09:31 PM
Component/s: Builders (Other)
Affects Version/s: 1.0.2
Fix Version/s: 1.1

Time Tracking:
Not Specified

Environment: Xubunto behind a firewall where a proxy is needed for all network access

Participants: Ajay Sridhar [Atlassian], Edwin Wong [Atlassian], Mark Chaimungkalanont [Atlassian] and Steve Loughran
Since last comment: 1 year, 23 weeks, 6 days ago
Number of comments: 5
Internal Work Bucket: Confirmed
Labels:


 Description  « Hide
I am setting up a bamboo system behind a firewall. There is no easy way to set up proxy settings for bamboo itself, other than by editing bamboo.sh, which I have done -SVN and JIRA then go through the wall to the public repostories.

But the proxy settings are not passed down to ant, which we need for Ivy.

1. They are defined in the ANT_OPTS env variable, but this is not passed down, and there is no way to set an env variable with spaces in it in the dialog (try it)

2. you can do -D definitions for Ant, but these are Ant properties, not system properties.

The only way to set up the proxy that worked was to edit ant.sh and patch in the proxy settings there.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Edwin Wong [Atlassian] added a comment - 12/Apr/07 09:11 PM
Hi Steve,

Apologies for the late response to your issue.

We have been doing some testing around this area to see what the issue is.

You mentioned in the issue that the Environment variable is not passed down, I was just wondering what you meant by this?

With regards to the space issue - that does indeed seem to be the case.

Cheers,
Edwin


Steve Loughran added a comment - 13/Apr/07 02:44 AM
...dont worry about the schedule; I do have a workaround (I patched ant.sh)

>You mentioned in the issue that the Environment variable is not passed down, I was just wondering what you meant by this?

I mean that I have ANT_OPTS predefined with all our proxy settings in the normal environment; the environment in which Bamboo runs, but the env variable doesn't appear to get down to Ant when Bamboo execs it. And as we both agree, you can't set a new env variable with spaces in, where the one I need is

ANT_OPTS=-Dhttp.proxyHost=proxy -Dhttp.proxyPort=8088

I can't set these in the properties section of the form, because they are JVM properties, not ant props.

As an aside, I am the effective maintainer of Ant's proxy support; both the <setproxy> task, the Ant1.7 proxy support, and their documentation is mine, primarily because I encounter the problem at work:
http://ant.apache.org/manual/proxy.html

we did try with Ant1.7beta to enable proxies by default, using java.net.useSystemProxies, but this (a) didnt appear to work on many systems (b) caused ClassNotFoundExceptions on IBM's runtime and (c) broke JDBC connections to oracle databases. This is why it is not the default in Ant1.7. I may be able to turn it on using
ANT_OPTS=-Djava.net.useSystemProxies=true in the env variables settings under Bamboo, but without the JVM picking up the proxy settings in linux, its not worth the effort.

-steve


Ajay Sridhar [Atlassian] added a comment - 15/Apr/07 11:56 PM
Hi Steve,

Thanks for getting back to us. So what we are saying is that the environment variables set up on the machine doesn't get picked up by the Ant process that gets run by Bamboo?

So to confirm - if we can set multiple environment variables in the "Environment variables" field for a build plan (which currently doesn't seem to work), then this issue should be resolved?

Cheers,
Ajay


Steve Loughran added a comment - 18/Apr/07 05:43 AM
I think there are a number of ways to solve this problem without relying on Sun to fix their proxy support in Java, or the Ant team (i.e. me) to write a custom proxy setup tool for Java1.5

1. let me set env variables with spaces in their values in the build plan, so that I can set up ANT_OPTS properly.

2. provide a way in the build plan to specify JVM parameters to Ant. then I can go -Dhttp.proxyHost=proxy -Dhttp.proxyPort=8088 -Xmx512M directly.

these two are effectively the same...ant.bat and ant.sh take the ANT_OPTS env variable and turn it into the arguments for the JVM.

3. automatically propagate proxy settings from Bamboo to the ant build.

this would be the best, because bamboo needs proxy setup for both SVN access and, eventually, for XMPP support through firewalls. If you have a one-stop place to set up the proxy and pass it down to ant and maven, then end users get the proxy settings they want, without having to fiddle with things.

Nb, the most up to date info on Ant's proxy settings are now:
http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/proxy.html?revision=528522

this is based on recent discussions with Sun on how their proxy code in Java5 works, with specific reference to behaviour on Linux and windows.

http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/proxy.html?revision=528522


Edwin Wong [Atlassian] added a comment - 23/Apr/07 09:31 PM
Steve,

An update to this:

1) I have fixed the code so that you can now input environment variables with spaces in them. To do this, you will need to quote the value, like:
ANT_OPTS='-Dhttp.proxyHost=proxy -Dhttp.proxyPort=8088 -Xmx512M'. The fix should be in the next release.

2) On a side note, I was also testing setting the system environment variables and seeing if this went through. I tested this by a simple task:
<echo message="ANT_OPTS is set to = ${env.ANT_OPTS}"/>
From what I could see, it seems that the environment variables set up in the "normal" machine environment should have go through to ant as well. One thing to look out for though, is the user under which the Bamboo service runs, as the environment variables are user specific.

Cheers,
Edwin