| Not sure if this is the right issue but there are probably some things to consider for this issue. Up until version 0.4 I was able to use @Library like this:
@Library('foo@master')
def util = new foo.Util()
timestamps {
pipeline {
agent docker: 'maven:3-jdk-8'
stages {
stage('Pre-Build') {
util.doSomething()
}
// more stages
}
notifications {
success {
util.notifyBuildStatusSuccess()
}
...
}
}
Now with 0.4 it fails to find the @Library annotation, I can work around by using the FQN. But I can't get a single Util instance to work anymore, best I came up with is this:
@Library('foo@master')
import foo.Util
// timestamps don't work anymore
//timestamps {
pipeline {
agent docker: 'maven:3-jdk-8'
stages {
stage('Pre-Build') {
script {
def util = new Util()
util.doSomething()
}
}
// more stages
}
notifications {
success {
script {
def util = new Util()
util.notifyBuildStatusSuccess()
}
}
...
}
}
//}
I tried putting the Util in environment but that throws ....sandbox.RejectedAccessException:
@Library('foo@master')
import foo.Util
// timestamps don't work anymore
//timestamps {
pipeline {
agent docker: 'maven:3-jdk-8'
environment {
util = new Util()
}
stages {
stage('Pre-Build') {
script {
env.util.doSomething()
}
}
// more stages
}
notifications {
success {
script {
env.util.notifyBuildStatusSuccess()
}
}
...
}
}
//}
|