Always run specific build/postbuild step

35 views
Skip to first unread message

Alex Domoradov

unread,
Apr 10, 2017, 5:29:55 PM4/10/17
to Jenkins Users
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

Richard Ginga

unread,
Apr 11, 2017, 8:21:14 AM4/11/17
to jenkins...@googlegroups.com
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.


--
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 jenkinsci-users+unsubscribe@googlegroups.com.
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

Alex Domoradov

unread,
Apr 11, 2017, 9:03:19 AM4/11/17
to jenkins...@googlegroups.com
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

--
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 jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAL3PpaXQpOg_PCwKJ-KAgbQDYNHqumnqa5w7s4yrkgw%3DgnsFow%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages