In my shared libraries, I define:
vars/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}\""
}
In my pipeline, I define
#!/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 }\""
}
}
}
}
}
now I get this error
groovy.lang.MissingPropertyException: No such property: REVISION for class: groovy.lang.Binding
how can I get the "REVISION" in my pipeline?