I would like to use a slightly more complex pipelining through jenkinsfiles with some repetitive steps, since I have many or similar projects. I am using jenkins 2.0 with pipeline plugins. I know that you can load groovy scripts, which may contain some common parts of the code, but I was wondering if these scripts can use some object-oriented groovy functions as traits. For example, I have a trait called Step:
package com.foo.something.ci
trait Step {
void execute(){ echo 'Null execution'}
}
And the class that then implemented the attribute in another file:
class Lint implements Step {
def execute() {
stage('lint')
node {
echo 'Do Stuff'
}
}
}
And another class containing the "main" function:
class foo {
def f = new Lint()
f.execute()
}
Jenkins, , , ? ?