envvar

environment variables

get current customized environment

get downstream build environment

get previous build environment

global environment

System.getenv()

To get the Jenkins Global environment variables

  • result

sh 'env' or sh 'printenv'

running script in agent, so the result is the agent system environment variables + job itself variables (i.e: params and ${env.JENKINS_xxx})

  • result

env.getEnvironment() or currentBuild.getRawBuild().getEnvironment()

pure Jenkins job's environment variables (and parameters) references:

  • result

or

setup environment

  • declarative pipeline

  • scripted pipeline

Last updated