I am part of the team maintaining the Team Concert plugin for Jenkins -
https://wiki.jenkins-ci.org/display/JENKINS/Team+Concert+Plugin.
We are seeing a restriction with accessing the env object in pipeline scripts. We contribute environment variables to a run. If the env object is not accessed before SCM checkout runs, then accessing the environment variables contributed by the Team Concert plugin, returns the appropriate values. But if the env object is accessed before the checkout runs, then accessing the environment variables contributed by the Team Concert plugin, even after checkout runs, always return null.
For example, assuming that the Team Concert plugin contributes the environment variable "TC_ENV_VAR1". Then the following script returns the value set by the Team Concert plugin, for TC_ENV_VAR1.
checkout(<scm_parameters>)
echo "${env.TC_ENV_VAR1}"
But the following script returns a null value for "TC_ENV_VAR1"
echo "${env.BUILD_NUMBER}"
checkout(<scm_parameters>)
echo "${env.TC_ENV_VAR1}"
We contribute environment variables through an implementation of hudson.model.EnvironmentContributor.
Could there be any additional implementation that is required to invalidate or refresh the environment variables, in case the env object was already constructed?