Solve the problem of jenkins build failure and insufficient space

With too many builds, there will be insufficient space in the Jenkins build. The solution is as follows:

Table of contents

1. When configuring, remove old build tasks

2. Use script to delete historical builds

3. Clear disk space

4. Reload the server node


1. When configuring, remove old build tasks

2. Use script to delete historical builds

  1. Open the Jenkins homepage
  1. Select menu Manage JenkinsInsert image description here
  2. Enter Script Console

 3. Enter the Script ConsoleInsert image description here

  1. Paste the script and run it

 

例如:删除构建任务NAME 40次以前的构建任务
def jobName = "NAME"
def maxNumber = 40
 
Jenkins.instance.getItemByFullName(jobName).builds.findAll {
  it.number <= maxNumber
}.each {
  it.delete()
}

3. Clear disk space

According to the directory where Jenkins prompts that there is insufficient space, use the du command to find the large file and delete it.

When it does not take effect, clean the disk

4. Reload the server node

For example, if the above steps of clearing the build history and clearing the space are not enough, try reloading the server node with jenkisn. There may be a cache.

 

 

 

 

Guess you like

Origin blog.csdn.net/qq_44691484/article/details/128333964