Having a weird issue with my Bamboo Remote Agents and ANT_HOME. The TL;DR - Is I have ANT_HOME set for the shell executing the remote agent, however bamboo appears to be overriding it with its own value when executing the ANT task:
The Configuration:
> Bamboo Instance on an Amazon Linux EC2
> Bamboo Remote Agent on Amazon Linux EC2
> ant installed via AWS yum repo ( yum -y install ant )
The ant executable is installed in /usr/bin/ant , however the etc and lib directories are in /usr/share/ant.
I installed the remote agent using an init.d wrapper, which looks like this:
#!/bin/bash
########################################################
# Wrapper script to execute the Bamboo Remote Agent
# that lives at /opt/atlassian/application-data/bamboo-agent/bin/bamboo-agent.sh
# chkconfig: 2345 20 80
# description: Bamboo Remote Agent Wrapper
########################################################
export RUN_AS_USER=bamboo
export ANT_HOME=/usr/share/ant/
export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64/
export BAMBOO_HOME=/opt/atlassian/bamboo/
exec "/opt/atlassian/application-data/bamboo-agent/bin/bamboo-agent.sh" "$@"
The agent launches and connects successfully. When trying to build using the Ant Task, we get the "Your ANT_HOME isn't set correctly" error of:
error 13-Aug-2018 14:04:04 Error: Could not find or load main class org.apache.tools.ant.launch.Launcher
I embedded a shell task to verify that the ANT_HOME is set in the wrapper of just
> echo Ant Home: ${ANT_HOME}
And in the logs I see
build 13-Aug-2018 14:04:03 Ant Home: /usr/share/ant/
So according to this article: https://confluence.atlassian.com/bamkb/cannot-execute-ant-builds-ant-does-not-launch-213524968.html , I was expecting the remote agent to see ANT_HOME when launching and set it accordingly, but looking at the log for the Ant build task, I see it setting its own ANT_HOME:
using extra environment variables:
... etc
ANT_HOME=/usr
... etc
Ant works 100% fine as configured in any users bash shell, so this is definitely something with how bamboo is setting up the execution environment for the ant build task.
Any thoughts?