I am using a scripted pipeline where I am required to skip some stages conditionally.Is there a way to show skipped stages on Jenkins UI other than importing org.jenkinsci.plugins.pipeline.modeldefinition.Utils in the jenkinsfile as the import is giving me "cannot resolve class" error while running build.gradle for some other script.

1 Answer 1


By default, there is no way to visualize skipped stages in the Jenkins UI. See this issue report on the Jenkins JIRA about visualizing skipped stages.

There are a few workarounds that I'm aware of:

You can disable the Groovy sandbox to allow importing the aforementioned class.

You can also use the imperative-when plugin for scripted Pipelines as described in this blog post to add visualization (note that I haven't tested this personally).

Or you can skip the visualization altogether and wrap your build steps in an if clause to conditionally execute them. You'll see in the Jenkins UI that a stage takes 0ms to execute if it has no steps, so there's at least some indication that it was skipped even if it doesn't explicitly say "skipped".

  • My issue got resolved by importing org.jenkinsci.plugins.pipeline.modeldefinition.* instead of org.jenkinsci.plugins.pipeline.modeldefinition.Utils Commented Jan 29, 2021 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.