job-dsl-gradle-example icon indicating copy to clipboard operation
job-dsl-gradle-example copied to clipboard

How to use from Pipeline?

Open g1ps opened this issue 6 years ago • 0 comments

Hi,

I have your classes working nicely from a JobDSL script via import. I'd also like to be able to call them from a Pipeline script along these lines:

@Library('JobBuilder') _

node('master'){
    new org.jobBuilder.BaseJobBuilder(
        directory: directory,
        name: "_libTest",
        repository: repository,
        branch: 'master',
        gitTag: 'IMPORTANT_GIT_TAG',
        script: 'test.sh',
        gradleTasks: 'sayHello'
    ).build(<WHAT GOES HERE?>)
}

I have the global library working and the classes load correctly but I can't work out what to pass the JobBuilder class. I understand that it needs the right JobDSL closure which will provide the delegate needed by the classes but I can't determine how to construct it. I have tried importing and using a large number of classes from the plugin and associated code without success. I have also experimented with using the Pipeline JobDsl step, equally unseuccesfully. Can you point me in the right direction?

Cheers.

g1ps avatar Jul 02 '18 13:07 g1ps