cake-build / docker

🐳 🍰 Docker images with Cake tool pre-installed

Home Page:https://cakebuild.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build script fail to capture exit code

tharanga2006 opened this issue · comments

Hi All
I have a following script that is running through bamboo agent

/*****************
echo "-------------------------Start Compilation ----------------------"
docker run --rm -v $PWD:$mountpoint -w $mountpoint docker.xxx.x.x.x/syncromatics/build-box:latest cake --dotnetCore="false" --setClean="true"
--package=${arr[0]} --workDir=${arr[1]}
--releaseName=${arr[2]}
echo "-------------------------End Compilation -------------------------"
echo " "
rc=$?
echo "ERRRRRRRRRRRRRRRRRRRRRRR" $rc
if [ $? -ne 0 ]
then

echo "An error occurred while compile time".
exit 1
fi
******************/
inside the build.cake it fails the build with exit code 1.

/************************
An error occurred when executing task 'Build'.
Error: One or more errors occurred.
MSBuild: Process returned an error (exit code 1).
***********************/

But I cant capture this error using $?. It always return 0.

You're getting the result code of the echo statement, you'll need to capture it into an variable right after docker run.

Hi devlead,
Right on target thanks.