10
votes

How can I use the Conditional Step Jenkins plugin, to check if an environment variable is set? If it is set, proceed as normal. If it is not set, skip the post-build actions and mark build as a pass (not a failure).

Or if there is a way to do this without using the Conditional Step plugin, I would be open to that as well.

1

1 Answers

9
votes

You could do this with the Flexible Publish plugin. Under Conditional action select Not, then under that select Strings match. Put your environment variable as String 1 and leave String 2 empty. Then add your post-build actions below.

enter image description here