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

How can I run python script as a task under Bamboo Build Stages?

Saifuddin Tariwala May 19, 2016

I have a python script to parse Bamboo build logs which I would like to run as a post build task to parse build logs.

How can I run python scripts  under Bamboo Build Task?

 

1 answer

1 accepted

1 vote
Answer accepted
rverschoor
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 20, 2016

If your Python script is part of the repository that you check out, you can use a Script Task that runs "python yourscript.py".
replace "python" with the full path of the python executable if it's not in your PATH.

You can also use the Script Task directly with an inline Python script.
This trick works for me on OSX and Linux:

/usr/bin/python <<EOF
print "Hello, World!"
EOF

If you need to run the Python script in the Post Build step you can't use the inline script, you'll have to call "python yourscript.py".

Saifuddin Tariwala May 20, 2016

Thanks @Rene Verschoor [Atlassian]. It worked!

rverschoor
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 23, 2016

You're welcome smile

Feel free to hit the "Accept answer" button.

Deleted user October 10, 2017

How would you use a virtual env that has been created in a previous step of the plan?

Assume it's available under: 

/opt/bamboo-home/xml-data/build-dir/RTE-RT-CPVE/env

More precise question: Where do you get the previous stage folder from?

Vineesh July 15, 2019

.

Vineesh July 25, 2019

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events