简体   繁体   中英

Jenkins groovy script - git command execution

I've been trying to retrieve number of commits to use them as a number. The working command that i know of is: "git rev-list develop.. --count". Thats the number I try to get. I want to assign it to variable and use it in some other line to introduce version, so my lines in groovy look like this. Assignment:

       def commitCount = "git rev-list develop.. --count".execute() 

Basically the Jenkins throws error at me that looks like this:

"Scripts not permitted to use staticMethod"

Any ideas how to make it work?

尝试: def out = sh(script: 'rev-list develop.. --count', returnStdout: true).trim()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM