Correct exit code for build failure

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Correct exit code for build failure

acouch
I'm new to Jenkins and am starting out by setting up cron runs for
multiple servers from a single server.

I'm using the SSH plugin to SSH in and run a bash script. Everything
works fine except I can't get Jenkins to acknowledge a failed run. The
documentation I've read says any return other than 0 should trigger a
failure. However, no matter what I return Jenkins reports 'SUCCESS'.

Below is the cli output. As you can see I return and exit of '1' but
the end still says 'SUCCESS'.

started by user anonymous
[SSH] executing pre build script:
bash cron-test
Cron failed.

[SSH] exit-status: 1
[SSH] executing post build script:

[SSH] exit-status: 0
Finished: SUCCESS

Any help is appreciated. Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Correct exit code for build failure

Ulli Hafner
On 02/14/2011 03:31 PM, AC wrote:

> I'm new to Jenkins and am starting out by setting up cron runs for
> multiple servers from a single server.
>
> I'm using the SSH plugin to SSH in and run a bash script. Everything
> works fine except I can't get Jenkins to acknowledge a failed run. The
> documentation I've read says any return other than 0 should trigger a
> failure. However, no matter what I return Jenkins reports 'SUCCESS'.
>
> Below is the cli output. As you can see I return and exit of '1' but
> the end still says 'SUCCESS'.
>
> started by user anonymous
> [SSH] executing pre build script:
> bash cron-test
> Cron failed.
>
> [SSH] exit-status: 1
> [SSH] executing post build script:
>
> [SSH] exit-status: 0
> Finished: SUCCESS
>
> Any help is appreciated. Thanks!
Where is the second exit status: 0 coming from?

Ulli
Reply | Threaded
Open this post in threaded view
|

RE: Correct exit code for build failure

Arve Knudsen
In reply to this post by acouch
It says there's a prebuild failure, maybe failure pre-build is ignored?

Arve

Sent from my Windows Phone From: AC
Sent: 14. februar 2011 15:31
To: Jenkins Users
Subject: Correct exit code for build failure
I'm new to Jenkins and am starting out by setting up cron runs for
multiple servers from a single server.

I'm using the SSH plugin to SSH in and run a bash script. Everything
works fine except I can't get Jenkins to acknowledge a failed run. The
documentation I've read says any return other than 0 should trigger a
failure. However, no matter what I return Jenkins reports 'SUCCESS'.

Below is the cli output. As you can see I return and exit of '1' but
the end still says 'SUCCESS'.

started by user anonymous
[SSH] executing pre build script:
bash cron-test
Cron failed.

[SSH] exit-status: 1
[SSH] executing post build script:

[SSH] exit-status: 0
Finished: SUCCESS

Any help is appreciated. Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Correct exit code for build failure

acouch
In reply to this post by Ulli Hafner
The ssh plugin has an input for a 'Pre build script' and a 'Post build script' in the 'Build Environment' section of the project configuration.

Even if I return a failure for the post build or both of them it still says "SUCCESS":


Started by timer
[SSH] executing pre build script:
bash cron-test
Cron failed.

[SSH] exit-status: 1
[SSH] executing post build script:
return BUILD_FAILED
[SSH] exit-status: 1
Finished: SUCCESS




On Mon, Feb 14, 2011 at 8:58 AM, Ullrich Hafner <[hidden email]> wrote:
On 02/14/2011 03:31 PM, AC wrote:
I'm new to Jenkins and am starting out by setting up cron runs for
multiple servers from a single server.

I'm using the SSH plugin to SSH in and run a bash script. Everything
works fine except I can't get Jenkins to acknowledge a failed run. The
documentation I've read says any return other than 0 should trigger a
failure. However, no matter what I return Jenkins reports 'SUCCESS'.

Below is the cli output. As you can see I return and exit of '1' but
the end still says 'SUCCESS'.

started by user anonymous
[SSH] executing pre build script:
bash cron-test
Cron failed.

[SSH] exit-status: 1
[SSH] executing post build script:

[SSH] exit-status: 0
Finished: SUCCESS

Any help is appreciated. Thanks!
Where is the second exit status: 0 coming from?

Ulli

Reply | Threaded
Open this post in threaded view
|

Re: Correct exit code for build failure

Arve Knudsen
I guess we can deduce that failures in pre- and post-build actions are ignored then? I don't really know the SSH plugin, but it seems to me you should be doing your work in the real build action (not pre- or post-build), unless you have some good reason for doing whatever you're trying to do before or after.

Arve

On Mon, Feb 14, 2011 at 4:08 PM, Aaron Couch <[hidden email]> wrote:
The ssh plugin has an input for a 'Pre build script' and a 'Post build script' in the 'Build Environment' section of the project configuration.

Even if I return a failure for the post build or both of them it still says "SUCCESS":


Started by timer

[SSH] executing pre build script:
bash cron-test
Cron failed.

[SSH] exit-status: 1
[SSH] executing post build script:
return BUILD_FAILED
[SSH] exit-status: 1
Finished: SUCCESS




On Mon, Feb 14, 2011 at 8:58 AM, Ullrich Hafner <[hidden email]> wrote:
On 02/14/2011 03:31 PM, AC wrote:
I'm new to Jenkins and am starting out by setting up cron runs for
multiple servers from a single server.

I'm using the SSH plugin to SSH in and run a bash script. Everything
works fine except I can't get Jenkins to acknowledge a failed run. The
documentation I've read says any return other than 0 should trigger a
failure. However, no matter what I return Jenkins reports 'SUCCESS'.

Below is the cli output. As you can see I return and exit of '1' but
the end still says 'SUCCESS'.

started by user anonymous
[SSH] executing pre build script:
bash cron-test
Cron failed.

[SSH] exit-status: 1
[SSH] executing post build script:

[SSH] exit-status: 0
Finished: SUCCESS

Any help is appreciated. Thanks!
Where is the second exit status: 0 coming from?

Ulli


Reply | Threaded
Open this post in threaded view
|

Re: Correct exit code for build failure

Aaron Couch
Thanks for your feedback. I think the issue is with the SSH plugin (or my use of it). Will post a ticket there and report any findings.


On Mon, Feb 14, 2011 at 11:01 AM, Arve Knudsen <[hidden email]> wrote:
I guess we can deduce that failures in pre- and post-build actions are ignored then? I don't really know the SSH plugin, but it seems to me you should be doing your work in the real build action (not pre- or post-build), unless you have some good reason for doing whatever you're trying to do before or after.

Arve

On Mon, Feb 14, 2011 at 4:08 PM, Aaron Couch <[hidden email]> wrote:
The ssh plugin has an input for a 'Pre build script' and a 'Post build script' in the 'Build Environment' section of the project configuration.

Even if I return a failure for the post build or both of them it still says "SUCCESS":


Started by timer

[SSH] executing pre build script:
bash cron-test
Cron failed.

[SSH] exit-status: 1
[SSH] executing post build script:
return BUILD_FAILED
[SSH] exit-status: 1
Finished: SUCCESS




On Mon, Feb 14, 2011 at 8:58 AM, Ullrich Hafner <[hidden email]> wrote:
On 02/14/2011 03:31 PM, AC wrote:
I'm new to Jenkins and am starting out by setting up cron runs for
multiple servers from a single server.

I'm using the SSH plugin to SSH in and run a bash script. Everything
works fine except I can't get Jenkins to acknowledge a failed run. The
documentation I've read says any return other than 0 should trigger a
failure. However, no matter what I return Jenkins reports 'SUCCESS'.

Below is the cli output. As you can see I return and exit of '1' but
the end still says 'SUCCESS'.

started by user anonymous
[SSH] executing pre build script:
bash cron-test
Cron failed.

[SSH] exit-status: 1
[SSH] executing post build script:

[SSH] exit-status: 0
Finished: SUCCESS

Any help is appreciated. Thanks!
Where is the second exit status: 0 coming from?

Ulli



Reply | Threaded
Open this post in threaded view
|

Re: Correct exit code for build failure

Aaron Couch
Just following up to document.

I ended up just using "Execute Shell" and "ssh -t" instead of the SSH plugin and the failure / success states work correctly. Thanks again.

On Mon, Feb 14, 2011 at 11:48 AM, Aaron Couch <[hidden email]> wrote:
Thanks for your feedback. I think the issue is with the SSH plugin (or my use of it). Will post a ticket there and report any findings.



On Mon, Feb 14, 2011 at 11:01 AM, Arve Knudsen <[hidden email]> wrote:
I guess we can deduce that failures in pre- and post-build actions are ignored then? I don't really know the SSH plugin, but it seems to me you should be doing your work in the real build action (not pre- or post-build), unless you have some good reason for doing whatever you're trying to do before or after.

Arve

On Mon, Feb 14, 2011 at 4:08 PM, Aaron Couch <[hidden email]> wrote:
The ssh plugin has an input for a 'Pre build script' and a 'Post build script' in the 'Build Environment' section of the project configuration.

Even if I return a failure for the post build or both of them it still says "SUCCESS":


Started by timer

[SSH] executing pre build script:
bash cron-test
Cron failed.

[SSH] exit-status: 1
[SSH] executing post build script:
return BUILD_FAILED
[SSH] exit-status: 1
Finished: SUCCESS




On Mon, Feb 14, 2011 at 8:58 AM, Ullrich Hafner <[hidden email]> wrote:
On 02/14/2011 03:31 PM, AC wrote:
I'm new to Jenkins and am starting out by setting up cron runs for
multiple servers from a single server.

I'm using the SSH plugin to SSH in and run a bash script. Everything
works fine except I can't get Jenkins to acknowledge a failed run. The
documentation I've read says any return other than 0 should trigger a
failure. However, no matter what I return Jenkins reports 'SUCCESS'.

Below is the cli output. As you can see I return and exit of '1' but
the end still says 'SUCCESS'.

started by user anonymous
[SSH] executing pre build script:
bash cron-test
Cron failed.

[SSH] exit-status: 1
[SSH] executing post build script:

[SSH] exit-status: 0
Finished: SUCCESS

Any help is appreciated. Thanks!
Where is the second exit status: 0 coming from?

Ulli