Skip to content

Instantly share code, notes, and snippets.

@sergeyhush
Last active August 29, 2015 14:10
Show Gist options
  • Save sergeyhush/24a716dd4f959d72bd6c to your computer and use it in GitHub Desktop.
Save sergeyhush/24a716dd4f959d72bd6c to your computer and use it in GitHub Desktop.
Jenkins: Stop upstream job with downstream ones
import jenkins.model.Jenkins
def upstreamName = build.buildVariableResolver.resolve("FlushJob")
def upstream = Jenkins.instance.getItem(upstreamName)
if (upstream) {
upstream.getLastBuild().doStop()
upstream.getDownstreamProjects().each { it.getLastBuild().doStop() }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment