Bash Behavior - Bamboo vs OS/X

I have created a small bash script that I am using on Bamboo via a Linux Instance. I am no bash expert, so maybe I am doing something stupid, but when I execute this code:

----------------------------

grep -e "All Component Failures\|All Test Failures:" $1 > /dev/null 2>&1

if [ "$?" -ne "0" ]; then

    echo "Exited with no Errors Detected"

    exit 0

else

    echo "Build generated errors Has in Pre-deployment Enviroment"

    exit 1

fi

-----------------

I exit 0 if I feed it the string "All Test Failures" - this is incorrect.

Now if I run the same script on my Mac against I log I dl'ed from Bamboo, it finds the error and exits 1.

 

So, I am confused - I would at least expect the same results on Bamboo and my desktop.

Does anyone have any insight, or know what is causing this?

Thanks,

Peter

2 answers

0 votes

What about the following script?

if egrep -q 'All Component Failures|All Test Failures:' "$1" ; then
    echo "Build generated errors Has in Pre-deployment Enviroment"
    exit 1
else
    echo "Exited with no Errors Detected"
    exit 0
fi

Sadly Przemek, that behaves in the same way as my script - thanks for trying though smile

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,064 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