実行中の場合は、次を使用できます。
def env = System.getenv()
//Print all the environment variables.
env.each{
println it
}
// You can also access the specific variable, say 'username', as show below
String user= env['USERNAME']
それがシステム groovy にある場合は、次を使用できます。
// get current thread / Executor and current build
def thr = Thread.currentThread()
def build = thr?.executable
//Get from Env
def stashServer= build.parent.builds[0].properties.get("envVars").find {key, value -> key == 'ANY_ENVIRONMENT_PARAMETER' }
//Get from Job Params
def jobParam= "jobParamName"
def resolver = build.buildVariableResolver
def jobParamValue= resolver.resolve(jobParam)
どの println も標準出力ストリームに出力を送信しています。コンソール ログを確認してみてください。幸運を!