4449 shaares
3 results
tagged
groovy
A very short blog post to share some minimal code snippets on how to quickly and easily setup Gitlab CI pipelines to run static code analysis tools on C++ code and Jenkins pipelines (or any Groovy code).
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 …