You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I have a simple script task added to my bamboo plan which is inline python script.
/usr/bin/python <<EOF
print "Hello"
EOF
It works just fine.
Now i want to just pass Hello as a plan specific variable so i configured a variable called pythontest within bamboo plan variables and provided it the value Hello.
When i switch the script to:-
/usr/bin/python <<EOF
print "$bamboo_pythontest"
EOF
It does nothing.
After going through below post:-
/usr/bin/python <<EOF
import os
print os.environ['bamboo_pythontest]
EOF
i get error
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
File "/usr/lib64/python2.6/UserDict.py", line 22, in __getitem__
raise KeyError(key)
KeyError: ''
Is there a way to successfully invoke bamboo plan variables within a python inline script just like it works for a shell or batch script.
Any help here would be greatly appreciated.
Cheers,
Ashley
Hi,
bamboo might be uppercase BAMBOO_pythontest, try to
print os.environ
/Poul
Hi Poul, It doesn't work. I think there must be a way to call bamboo variable from inside python based bamboo jobs, but what you are suggesting is definitely not the solution.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is a way to call bamboo variables inside python script
print(os.environ['bamboo_NAME_OF_THE_VARIABLE])
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.