How can I access the last built revision according to jenkins?

后端 未结 5 1294
一整个雨季
一整个雨季 2021-02-06 05:50

Near the top of my build console I see a \"Last Built Revision:\" w/ a revision #. How can I access this last built rev # in my build script? I\'m using Gradle, but I don\'t t

5条回答
  •  野的像风
    2021-02-06 06:20

    The Git plugin returns information from the checkout() command. In Pipeline script, this can be used to get the previous commit:

    def scmVars = checkout scm
    
    scmVars.GIT_PREVIOUS_COMMIT
    

提交回复
热议问题