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

Getting Agent Hostname or IP address as a variable

Getting Agent Hostname or IP address as a variable 

 

We have 5 bamboo agents and bamboo server triggers the tests to one of the bamboo agent. 

 

Could we get the agent's hostname or IP as a variable in bamboo?

Eventually we want that variable as -Dhost=${bamboo.hostname} or something like that.  

1 answer

0 votes

I don't see any such variable presently in Bamboo.

But, how about this idea:
Bamboo has this variable: "bamboo.agentId"

1. Use this variable to get the agent id (agent id is never changed)

2. This agent is configured in the file <agent-home>/bamboo-agent.cfg.xml with the parameter <id>1234</id>. This file has the other details as well which are name, agent uuid. Manually assign the bamboo global variable to have the hostname for each of these agents id's.

2. Have a script task to check for the "bamboo.agentId" and have something like case statement to get the hostname based on the agent id and then assign this hostname to a variable which can be used later as per the requirement. Something like:

case  ${bamboo.agentId}  in
                <agent-id1>)       
                     export hostname=<globalvariable1>
                    ;;
                <agent-id2>)
           export hostname=<globalvariable2>
                    ;;
                *)              
          esac 

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published yesterday in Confluence

Confluence CVEs and common questions

Two vulnerabilities have been published for Confluence Server and Data Center recently: March 20, 2019 CVE-2019-3395 / CVE-2019-3396 April 17, 2019 CVE-2019-3398 The goal of this article is...

70 views 0 9
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you