4282 shaares
2 results
tagged
groovy
I took me some time to figure it out, so I'm sharing this here:
import hudson.EnvVars
import org.jenkinsci.plugins.workflow.steps.EnvironmentExpander
def env = EnvironmentExpander.getEffectiveEnvironment(new EnvVars(), null, steps.getContext(EnvironmentExpander.class), null, null)
def ansiColorEnabled = 'TERM' in env
Recently I lost a lot of time on this. Hence I want to share a working solution, even if i cannot take the time to detail the issue.
I'm taking about writing reusable code for Jenkinsfiles : https://jenkins.io/doc/book/pipeline/shared-libraries/
One cannot simply use Groovy HTTPBuilder
, because …