Skip to content

Instantly share code, notes, and snippets.

@kazuhito-m
Last active December 11, 2015 06:48
Show Gist options
  • Save kazuhito-m/4561530 to your computer and use it in GitHub Desktop.
Save kazuhito-m/4561530 to your computer and use it in GitHub Desktop.
Jenkins Groovy Console exsamples.
// ジョブの「依存するスナップショットがビルドされたときにビルド」を操作。
Jenkins.instance.items.each {
println "job name : ${it.name}"
println "ignoreUpstremChanges : ${it.ignoreUpstremChanges}"
it.ignoreUpstremChanges = false
println "after change : ${it.ignoreUpstremChanges}"
}
// ジョブの「E-mailでの通知」を操作。
Jenkins.instance.items.each {
println "job name : ${it.name}"
if (!(it instanceof hudson.model.FreeStyleProject)) {
// メール設定が在るかどうか捜索。
def mailReport = it.reporters.find {r-> r instanceof hudson.maven.reporters.MavenMailer}
// あったら設定の塊ごと消す。
if (mailReport != null) {
println "ジョブ ${it.name} のE-Mail送信設定を削除します。"
it.reporters.remove(mailReport)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment