Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

Recognition

  • Give kudos
  • My kudos

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

ANT_HOME being overridden on Bamboo Remote Agent Edited

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?

1 answer

0 votes

Hi! 

 

Have you fixed it ?

 

Cheers,

Gonchik Tsymzhitov

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo 7.1 is here and is packed with value!

I'm happy to announce that Bamboo 7.1 has been released and it’s overflowing with awesome new features. Top-voted issues First and foremost, a bunch of JAC top voted issues has been delivered - y...

696 views 1 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you