Skip to content

Instantly share code, notes, and snippets.

@tyuki39
Created March 8, 2011 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tyuki39/860367 to your computer and use it in GitHub Desktop.
Save tyuki39/860367 to your computer and use it in GitHub Desktop.
Jenkinsで他のプロジェクトのビルドを中止する方法
// 他のプロジェクトのビルドを中止する方法
// 以下は groovy plugin の Execute system Groovy script の中で使用して
// TEST プロジェクトのビルドを中止する例
def jobname = "TEST"
def job = hudson.model.Hudson.instance.getItem(jobname)
assert job, "ERROR: Can't find the job $jobname."
def lastbuild = job.lastBuild
if( lastbuild ) {
def executor = lastbuild.executor
if( executor ) {
executor.interrupt()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment