Always run specific build/postbuild step

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

Always run specific build/postbuild step

Alex Domoradov
Hello,

is it possible at all? I have tried to use Conditional BuildStep with condition "Always" but without success. I have two build step each of them is shell script.

Build step1 - Execute shell
#!/bin/bash -ex

echo "******* STEP1 *******"
exit 1

Build step2 - Execute shell
#!/bin/bash -ex

echo "******* STEP2 *******"
exit 0

Conditional step (single)
Run?: Always
Builder: Execute shell
#!/bin/bash

echo "%%%%%%% CLEAN %%%%%%%"

With such settings I get the following result

Started by user Alex
[EnvInject] - Loading node environment variables.
Building on master in workspace /usr/share/tomcat8/.jenkins/workspace/temp
Run condition [Always] enabling prebuild for step [Execute shell]
[temp] $ /bin/bash -ex /var/cache/tomcat8/temp/hudson8076614436373471043.sh
+ echo '******* STEP1 *******'
******* STEP1 *******
+ exit 1
Build step 'Execute shell' marked build as failure
Finished: FAILURE

P.S.
Jenkins ver. 1.652

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/0c5b0978-570f-4871-b2cc-4ca806774dbb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Always run specific build/postbuild step

Richard Ginga
your Step 1 returns 1 which is a failure and Jenkins is always going to stop build execution at that point. no other "build steps" will be executed. 

You can install the flexible publish plugin (this lets you can run many build steps in the Post-build phase). the condition can be set to test the "Current build status" where you can set Worst as Failed and best as Success, then I think it will always run.


On Mon, Apr 10, 2017 at 5:29 PM, Alex Domoradov <[hidden email]> wrote:
Hello,

is it possible at all? I have tried to use Conditional BuildStep with condition "Always" but without success. I have two build step each of them is shell script.

Build step1 - Execute shell
#!/bin/bash -ex

echo "******* STEP1 *******"
exit 1

Build step2 - Execute shell
#!/bin/bash -ex

echo "******* STEP2 *******"
exit 0

Conditional step (single)
Run?: Always
Builder: Execute shell
#!/bin/bash

echo "%%%%%%% CLEAN %%%%%%%"

With such settings I get the following result

Started by user Alex
[EnvInject] - Loading node environment variables.
Building on master in workspace /usr/share/tomcat8/.jenkins/workspace/temp
Run condition [Always] enabling prebuild for step [Execute shell]
[temp] $ /bin/bash -ex /var/cache/tomcat8/temp/hudson8076614436373471043.sh
+ echo '******* STEP1 *******'
******* STEP1 *******
+ exit 1
Build step 'Execute shell' marked build as failure
Finished: FAILURE

P.S.
Jenkins ver. 1.652

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/0c5b0978-570f-4871-b2cc-4ca806774dbb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Dick Ginga
Build Engineer

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAL3PpaXQpOg_PCwKJ-KAgbQDYNHqumnqa5w7s4yrkgw%3DgnsFow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Always run specific build/postbuild step

Alex Domoradov
Thanks Richard, but it seems I had found alternative solution.

I got the same result with Execute a set of scripts in Post-build Actions - http://i.imgur.com/g9wMKPW.png

On Tue, Apr 11, 2017 at 3:21 PM, Richard Ginga <[hidden email]> wrote:
your Step 1 returns 1 which is a failure and Jenkins is always going to stop build execution at that point. no other "build steps" will be executed. 

You can install the flexible publish plugin (this lets you can run many build steps in the Post-build phase). the condition can be set to test the "Current build status" where you can set Worst as Failed and best as Success, then I think it will always run.


On Mon, Apr 10, 2017 at 5:29 PM, Alex Domoradov <[hidden email]> wrote:
Hello,

is it possible at all? I have tried to use Conditional BuildStep with condition "Always" but without success. I have two build step each of them is shell script.

Build step1 - Execute shell
#!/bin/bash -ex

echo "******* STEP1 *******"
exit 1

Build step2 - Execute shell
#!/bin/bash -ex

echo "******* STEP2 *******"
exit 0

Conditional step (single)
Run?: Always
Builder: Execute shell
#!/bin/bash

echo "%%%%%%% CLEAN %%%%%%%"

With such settings I get the following result

Started by user Alex
[EnvInject] - Loading node environment variables.
Building on master in workspace /usr/share/tomcat8/.jenkins/workspace/temp
Run condition [Always] enabling prebuild for step [Execute shell]
[temp] $ /bin/bash -ex /var/cache/tomcat8/temp/hudson8076614436373471043.sh
+ echo '******* STEP1 *******'
******* STEP1 *******
+ exit 1
Build step 'Execute shell' marked build as failure
Finished: FAILURE

P.S.
Jenkins ver. 1.652

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/0c5b0978-570f-4871-b2cc-4ca806774dbb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Dick Ginga
Build Engineer

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/515uGxnDt64/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAL3PpaXQpOg_PCwKJ-KAgbQDYNHqumnqa5w7s4yrkgw%3DgnsFow%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAK90gp4Vi%3DyD970o6uKLe0AAVytn3LkYD4U-hPLTi6Aa0GtJ8Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.