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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

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

Export bash variable for use in deployment task

I have a Script task in my Deployment project that executes some shell commands. I want this shell command to have access to a Bash environment variable (Not a Bamboo variable).

If I was running this script manually at the command line I would export the variable in my .bashrc and it would be available to the script. How can I achieve the same thing when the script is running inside Bamboo?

1 answer

0 votes

Hi Devang,

Thanks for your question!

Try using like this:

source ~/.bashrc

echo $variable

Please accept the answer if it helps you so that others can also make use of it.

Thanks,

Robhit

Hi Rohit,

Do you mean add a "source" line to my deployment task? I have about 30 tasks, I was hoping I could have the task access system environment variables without going in to each one and editing them.

robhit Atlassian Team Mar 22, 2018

Hi Dewang,

You could also try to add the variables in the ".bash_profile" or the ".profile" then it will be available.

Thanks,

Robhit

I've already added the variable to the .profile but it doesn't get picked up when the task is running inside Bamboo. Is there any other change that needs to be made? Do I need to restart the Bamboo server?

Just to clarify - this is an _inline_ Script task running as part of a Deployment project

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...

986 views 4 7
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