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.
The Conditional BuildStep plugin lets users add conditional logic to Freestyle jobs from within the Jenkins web UI. It does this by: Adding two types of Conditional BuildStep ("Single" and "Multiple") - these build steps contain one or more other build steps to be run when the configured condition is met.
Jenkinsfile We can set environment variables globally by declaring them in the environment directive of our Jenkinsfile. This approach of defining the variables in the Jenkins file is useful for instructing the scripts; for example, a Make file.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With