fabric8io / jenkins-pipeline-library

a collection of reusable jenkins pipelines and pipeline functions
Apache License 2.0
275 stars 180 forks source link

lets refactor the 'envFoo = ..." expressions from Jenkinsfiles #110

Closed jstrachan closed 8 years ago

jstrachan commented 8 years ago

we've lots of Jenkinsfiles with code of this form:

def envStage = "${env.JOB_NAME}-staging"

Particularly the flows for nodejs / swift etc.

It'd be nice to go around and refactor all these to use a standard function. Something like

def envStage = environmentNamespace("staging")

which we can then implement using either

// environment per build
"${env.JOB_NAME}-staging"

or a nicer default:

// environment per build
"${env.KUBERNETES_NAMESPACE}-staging"
rawlingsj commented 8 years ago

Yeah that would be good. FWIW I'm hoping after the current round of refactoring we can take a look at the Jenkinsfiles and global library functions and tidy them all up as we're kinda getting a better feel for how much logic goes in a Jenkinsfile, groovy function and groovy src. There's already a fair amount of technical dept building up and it would be nice if they're a bit leaner and better docs around them.