Open twotired opened 4 years ago
Please excuse my late response. The referred documentation shows how to use jobs in a common library function. Have you tried to use the same functionality but just with stages/plans when you experienced the classloader errors?
A minimal DSL example would help me a lot to reproduce this.
Thanks, Michael
I put some time into getting some examples for you, and here's one of my findings:
class StageFactory {
// This works
public Stage createStage(Plan plan) {
Stage s = plan.stage('Common Stage')
Job j = s.job('ABC123', 'setup job')
j.miscellaneous {
cleanWorkingDirectoryAfterEachBuild(true)
}
s
}
// This doesn't work
public Stage createStage() {
Stage s = new Stage('Common Stage 2') // Could not find matching constructor for: ch.mibex.bamboo.plandsl.dsl.Stage(java.lang.String)
Job j = s.job('ABC124', 'setup job 2')
j.miscellaneous {
cleanWorkingDirectoryAfterEachBuild(true)
}
s
}
}
So in order to create a stage, I need to pass in the plan object, but I am able to create jobs independently of a stage object like this:
Job j = new Job(key: key, name: name, description: description)
Is this technically possible? I get classloader errors when I try to define a Job or Stage in common code, similar to how using a common Job is documented here: https://github.com/mibexsoftware/bamboo-plan-dsl-plugin/wiki/Real-world-DSL-scripts
Would be great if that page also showed how to define and use common Plans/Stages/Jobs.