在我的共享库中,我定义:
变量/checkoutSvnCode.groovy
#!/usr/bin/env groovy
//get svn code
def call(String URL="url") {
def scmVars = checkout([
$class: 'SubversionSCM',
additionalCredentials: [],
excludedCommitMessages: '',
excludedRegions: '',
excludedRevprop: '',
excludedUsers: '',
filterChangelog: false,
ignoreDirPropChanges: false,
includedRegions: '',
locations: [[
cancelProcessOnExternalsFail: true,
credentialsId: 'svn_auth',
depthOption: 'infinity',
ignoreExternalsOption: true,
local: '.',
remote: "${URL}"
]],
quietOperation: false,
workspaceUpdater: [$class: 'UpdateUpdater']
])
def REVISION = scmVars.SVN_REVISION
println "//Revision:\"${REVISION}\""
}
在我的管道中,我定义
#!/usr/bin/env groovy
@Library('jenkins-pipeline-library')_
import com.test.GlobalVars
pipeline {
environment {
def SVN_ADDR = "svn://code.test.com/myproject"
}
agent any
stages {
stage('getCode') {
steps {
script {
checkoutSvnCode("${SVN_ADDR}")
println "//Revision:\"${REVISION }\""
}
}
}
}
}
现在我得到这个错误
groovy.lang.MissingPropertyException:没有这样的属性:类的修订:groovy.lang.Binding
我怎样才能在我的管道中获得“修订”?