Possible to have bamboo load .bashrc?

Is there a way to have bamboo load .bashrc or .bash_profile as part of the start up script so I don't have to export custom PATH & environment vars in every Script tasks?


For example, in each Script task anytime we want to do a ruby related script we need to include

# export PATH="$RBENV_ROOT/shims:$RBENV_ROOT/bin:$PATH"

It would be nice if this was loaded automatically somehow.

1 answer

1 accepted

1 votes

Instead of calling the Bamboo startup script directly, just source the .bashrc and then call the script. The exoprted variables will be visible to all script tasks run on the local agents. If you want to do the same for remote agents, you need to do the same - i.e. source the dot files first, then run the agent startup command.

Is there a way to have it source automatically? I'd just be swapping out one line for another, right?

And to be clear, this is a "Job Task" inside of a plan, not starting up bamboo itself

Or are you saying there is a script that launches the elastic agent I can append a source .file to?

Ah. No, that won't work. The tasks are isolated. Whatever you source in one, won't be visible in others. THe only way to make them available everywhere is to use them during Bamboo startup or Bamboo agent startup.

Re: elastic agents. Yes, you can do it for the elastic agent. The easiest way is to add the necessary lines to .bashrc of the bamboo user using the instance startup script (have a look at your image configuration).

That script is run before the agent is started, so whatever you do there will be visible to the agent.

By instance startup script, do you mean the script that is entered in EC2 that runs on boot (I believe set as `user data` in the launch menu) or a bamboo startup script in the server itself?

Click edit on your image configuration. You can enter a script there. It will be run right before the agent is started. The script is run as root.

awesome, thank you (and thank you for such speedy support!)

Can you elaborate on where to put the ". ~/.bashrc"

For a ubuntu 14 remote agent I am trying in the "start-agent.sh" file and running "./start-agent.sh"

like so:

. ~/.bashrc
java -Djavax.net.ssl.trustStore=/home/devadmin/keystore -Dbamboo.agent.ignoreServerCertName=true -jar atlassian-bamboo-agent-installer-5.9.1.jar https://mybuildserver/bamboo/agentServer/ start


But the bashrc is still not loading for my tasks.

Suggest an answer

Log in or Join to answer
Community showcase
Renan Battaglin
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,068 views 0 5
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot