1

Within an Atlassian Bamboo, is it possible to get hold of the IP address (or DNS name) of the build agent a task is currently being executed on?

It's the intention to use this to execute functional tests from another machine using grunt and protractor.

e.g. grunt acceptancetests --baseUrl=${bamboo.buildagent.ip}

CT_
  • 11
  • 2
  • Where are you trying to get this? From within the build tasks? I would think you could just get that from the system running the task, no? Do you mean from external to bamboo via the bamboo REST API or something? – Etan Reisner Aug 28 '15 at 15:06

1 Answers1

2

You should be able to set the Bamboo Agent IP/Hostname as a Agent Capability and then reference that within your build.

Alternatively you can do this:

  1. Add a Script task that does this:

    #!/bin/bash
    rm -f agent.properties
    HOST=$(hostname)
    echo "agentHostname=$HOST" > agent.properties
    cat agent.properties
    
  2. Add a Inject Bamboo variables task that loads in the agent.properties file.

  3. In your command you would reference ${bamboo.<namespace>.agentHostname} where <namespace> is defined in within the Inject Bamboo variables task.

Welsh
  • 5,138
  • 3
  • 29
  • 43
  • What would be the point of this? The task that can see the injected variables will either be running on the same agent (and can get it from the agent itself the way the original task could) or will be running on another agent at a time when it will either not yet be able to see the variables (different concurrent job) or when the previous task is no longer running (down-stream stage). – Etan Reisner Aug 28 '15 at 15:08