Making Job from Failure to Aborted

7 views
Skip to first unread message

Kristian

unread,
Jun 6, 2016, 10:50:23 AM6/6/16
to jenkins...@googlegroups.com
Hey guys,

I have this problem. We have several projects, which have a script, which starts the build process of the project. This script is called build.sh (builds are made on Linux).  Some of these build scripts need some parameter.

As I do not want always write ./build.sh Paramter1 Parameter2, I wrote a managed script, which does it for me, so I only have to add the parameters. So the managed linux script start the build script.

The managed script looks like this

> # exit on error
> set -o errexit
> pushd $PROJECT_SRC
> chmod +x build.sh
> sudo ./build.sh $PARA1 $PARA2 $PARA3

The problem is this: When someone aborts a Job for whatever reason, the state of the jobs is not aborted, but failure. This is somehow annoying.

So I tried some things to change that

1) Trying to catch SIGTERM signal in the managed script, so in the end, the managed script looked like this:

> on_sigterm()
> {
>     exit 0
> }
> trap 'on_sigterm' SIGTERM SIGHUP SIGINT
> # exit on error
> set -o errexit
> pushd $PROJECT_SRC
> chmod +x build.sh
> sudo ./build.sh $PARA1 $PARA2 $PARA3

2) Trying to catch SIGTERM signal in the build.sh script. That also did not work.

3) Both, trying to catch SIGTERM in managed script and in build.sh script.

4) Trying to read the log of the job, with the help of Jenkins TextFinder plugin. I searched in the log for something like this 'java.lang.InterruptedException', and as far as I could see, the plugin found this text, but didn't change the state of the job to unstable or success.

5) Do you have some other ideas which might help me to solve this problem?
Reply all
Reply to author
Forward
0 new messages