最近由于项目自动化构建的需要,研究了下gradle调用脚本并传参的用法,在此作个总结。
Prebuild.gradle中定义了$jenkinsJobName $jenkinsBuild两个Jenkins变量,意图将gradle中的这两个值传到shell/python脚本中去用
def jenkinsBuild = System.getenv("BUILD_NUMBER") ?: "0" println "jenkinsBuild is set to $jenkinsBuild" def jenkinsJobName = System.getenv("JOB_NAME") ?: "defaultJobName" println "jenkinsJobName is set to $jenkinsJobName"