<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    paulwong

    How do I clear my Jenkins/Hudson build history?

    問題:

    I recently updated the configuration of one of my hudson builds. The build history is out of sync. Is there a way to clear my build history?

    Please and thank you

    回答1:

    If you click Manage Hudson / Reload Configuration From Disk, Hudson will reload all the build history data.

    If the data on disk is messed up, you'll need to go to your %HUDSON_HOME%\jobs\<projectname> directory and restore the build directories as they're supposed to be. Then reload config data.

    If you're simply asking how to remove all build history, you can just delete the builds one by one via the UI if there are just a few, or go to the %HUDSON_HOME%\jobs\<projectname> directory and delete all the subdirectories there -- they correspond to the builds. Afterwards restart the service for the changes to take effect.



    回答2:

    Use the script console (Manage Jenkins > Script Console) and something like this script to bulk delete a job's build history https://github.com/jenkinsci/jenkins-scripts/blob/master/scriptler/bulkDeleteBuilds.groovy

    That script assumes you want to only delete a range of builds. To delete all builds for a given job, use this (tested):

    // change this variable to match the name of the job whose builds you want to delete def jobName = "Your Job Name" def job = Jenkins.instance.getItem(jobName)  job.getBuilds().each { it.delete() } // uncomment these lines to reset the build number to 1: //job.nextBuildNumber = 1 //job.save()


    回答3:

    This answer is for Jenkins

    1. Go to your Jenkins home page → Manage Jenkins → Script Console

    2. Run the following script there. Change copy_folder to your project name

    Code:

    def jobName = "copy_folder" def job = Jenkins.instance.getItem(jobName) job.getBuilds().each { it.delete() } job.nextBuildNumber = 1 job.save()

    My post



    回答4:

    Here is another option: delete the builds with cURL.

    $ curl -X POST http://jenkins-host.tld:8080/jenkins/job/myJob/[1-56]/doDeleteAll

    The above deletes build #1 to #56 for job myJob.

    If authentication is enabled on the Jenkins instance, a user name and API token must be provided like this:

    $ curl -u userName:apiToken -X POST http://jenkins-host.tld:8080/jenkins/job/myJob/[1-56]/doDeleteAll

    The API token must be fetched from the /me/configure page in Jenkins. Just click on the "Show API Token..." button to display both the user name and the API token.

    Edit: one might have to replace doDeleteAll by doDelete in the URLs above to make this work, depending on the configuration or the version of Jenkins used.



    回答5:

    You could modify the project configuration temporarily to save only the last 1 build, reload the configuration (which should trash the old builds), then change the configuration setting again to your desired value.



    回答6:

    Here is how to delete ALL BUILDS FOR ALL JOBS...... using the Jenkins Scripting.

    def jobs = Jenkins.instance.projects.collect { it }  jobs.each { job -> job.getBuilds().each { it.delete() }} 


    回答7:

    Another easy way to clean builds is by adding the Discard Old Plugin at the end of your jobs. Set a maximum number of builds to save and then run the job again:

    https://wiki.jenkins-ci.org/display/JENKINS/Discard+Old+Build+plugin



    回答8:

    Go to the %HUDSON_HOME%\jobs\<projectname> remove builds dir and remove lastStable, lastSuccessful links, and remove nextBuildNumber file.

    After doing above steps go to below link from UI
    Jenkins-> Manage Jenkins -> Reload Configuration from Disk

    It will do as you need



    回答9:

    If using the Script Console method then try using the following instead to take into account if jobs are being grouped into folder containers.

    def jobName = "Your Job Name" def job = Jenkins.instance.getItemByFullName(jobName)

    or

    def jobName = "My Folder/Your Job Name def job = Jenkins.instance.getItemByFullName(jobName)


    回答10:

    Navigate to: %JENKINS_HOME%\jobs\jobName

    Open the file "nextBuildNumber" and change the number. After that reload Jenkins configuration. Note: "nextBuildNumber" file contains the next build no that will be used by Jenkins.



    回答11:

    Using Script Console.

    In case the jobs are grouped it's possible to either give it a full name with forward slashes:

    getItemByFullName("folder_name/job_name")  job.getBuilds().each { it.delete() } job.nextBuildNumber = 1 job.save()

    or traverse the hierarchy like this:

    def folder = Jenkins.instance.getItem("folder_name") def job = folder.getItem("job_name") job.getBuilds().each { it.delete() } job.nextBuildNumber = 1 job.save()


    回答12:

    If you want to clear the build history of MultiBranchProject (e.g. pipeline), go to your Jenkins home page → Manage Jenkins → Script Console and run the following script:

    def projectName = "ProjectName" def project = Jenkins.instance.getItem(projectName) def jobs = project.getItems().each { def job = it   job.getBuilds().each { it.delete() }   job.nextBuildNumber = 1   job.save() }


    回答13:

    This one is the best option available.

    Jenkins.instance.getAllItems(AbstractProject.class).each {it -> Jenkins.instance.getItemByFullName(it.fullName).builds.findAll { it.number > 0 }.each { it.delete() } }

    This code will delete all Jenkins Job build history.

    posted on 2019-07-24 16:18 paulwong 閱讀(342) 評論(0)  編輯  收藏 所屬分類: JENKINS

    主站蜘蛛池模板: 黑人大战亚洲人精品一区| 亚洲日韩中文字幕一区| 无码的免费不卡毛片视频| 99久久99久久精品免费看蜜桃| 国产精品亚洲产品一区二区三区| 国产午夜亚洲精品| 精品熟女少妇av免费久久| 久久国产成人亚洲精品影院| 亚洲欧美日韩中文字幕一区二区三区| 日韩电影免费在线观看中文字幕| 一级毛片直播亚洲| 亚洲中文字幕久久精品无码VA| 免费国产污网站在线观看15| 国产亚洲精品久久久久秋霞| 蜜桃传媒一区二区亚洲AV| 99久久免费国产精品特黄| 久久亚洲精品无码AV红樱桃| 国产特黄一级一片免费 | 国产h视频在线观看免费| 精品亚洲综合在线第一区| 免费看一级高潮毛片| 青青青青青青久久久免费观看| 亚洲国产模特在线播放| 免费无码一区二区三区| 亚洲精品乱码久久久久久自慰| 永久免费无码日韩视频| 免费国产a国产片高清| 亚洲AV无码一区二区乱子仑| 97人伦色伦成人免费视频 | 免费国产黄网站在线观看| 亚洲乱码中文字幕久久孕妇黑人| 人妻18毛片a级毛片免费看| 国产免费久久精品久久久| 亚洲国产成人精品无码区二本| 国产免费看JIZZ视频| 亚洲成a人片77777群色| 久久国产高潮流白浆免费观看| 久久精品国产亚洲AV网站| 中文字幕久精品免费视频| 亚洲乱码中文字幕综合| a毛片在线免费观看|