How to get list of changed files since last build in Jenkins/Hudson

后端 未结 11 2031
时光取名叫无心
时光取名叫无心 2020-11-28 09:35

I have set up Jenkins, but I would like to find out what files were added/changed between the current build and the previous build. I\'d like to run some long running tests

11条回答
  •  广开言路
    2020-11-28 10:31

    I have done it the following way. I am not sure if that is the right way, but it seems to be working. You need to get the Jenkins Groovy plugin installed and do the following script.

    import hudson.model.*;
    import hudson.util.*;
    import hudson.scm.*;
    import hudson.plugins.accurev.*
    
    def thr = Thread.currentThread();
    def build = thr?.executable;
    
    def changeSet= build.getChangeSet();
    
    changeSet.getItems();
    

    ChangeSet.getItems() gives you the changes. Since I use accurev, I did List accurevTransList = changeSet.getItems();.

    Here, the modified list contains duplicate files/names if it has been committed more than once during the current build window.

提交回复
热议问题