jenkins删除Build History构建历史

jenkins–系统管理----脚本命令行

jenkins删除Build History构建历史_第1张图片

/*** BEGIN META {
  "name" : "Bulk Delete Builds",
  "comment" : "For a given job and a given range of possible build numbers, delete those builds.",
  "parameters" : [ 'jobName', 'buildRange' ],
  "core": "1.409",
  "authors" : [
    { name : "Andrew Bayer" }
  ]
} END META**/


// NOTE: uncomment parameters below if not using Scriptler >= 2.0, or if you're just pasting
// the script in manually.

// The name of the job.
//def jobName = "some-job"

// The range of build numbers to delete.
//def buildRange = "1-5"

import jenkins.model.*;
import hudson.model.Fingerprint.RangeSet;
def j = jenkins.model.Jenkins.instance.getItem(jobName);

def r = RangeSet.fromString(buildRange, true);

j.getBuilds(r).each { it.delete() }

注意了,修改jobName 和buildRange 这两个参数。

参考资料
删除构建历史

你可能感兴趣的:(转载,jenkins)