Configuring a remote host to receive environment variables from Bamboo

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

Bamboo SSH tasks can send build-specific variables to a remote host  as environment variables for use during script execution.

If the remote host doesn't allow Bamboo to set environment variables, build-specific variables won't be available for use in shell scripts run by SSH tasks and references to Bamboo build variables (${bamboo_*}) will resolve to empty lines.

To allow Bamboo to set environment variables on the remote host:

  1. Append the following lines to the hosts's  /etc/ssh/sshd_config  file:

    # Allow Bamboo SSH task to pass build variables
    AcceptEnv bamboo_*
  2. Restart the SSH daemon on the remote host:
    • On Debian-based Linux distributions, run:

      sudo systemctl restart ssh
    • On Red Hat-based Linux distributions, run:

      sudo systemctl restart sshd

You can now reference build-specific variables in your shell scripts using the following syntax:

${bamboo_*}

For example:

${bamboo_buildNumber}
Last modified on Oct 9, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.