Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-69849

Support for additional classpath within jobdsl and casc

XMLWordPrintable

      The jobdsl plugin documentation mentions that it is possible to use shared libraries:

      https://github.com/jenkinsci/job-dsl-plugin/wiki/Real-World-Examples#import-other-files-ie-with-class-definitions-into-your-script

      Despite of multiple searches I haven't found a way to use jobdsl with configured additional classpath. More over the configuration as code part brings some more constraints too. All references point to other mechanism which is a pipeline with a jobdsl step.

      While it is said to do things in such a way it rather sounds like a workaround which multiply amount of jobs/configurations carried for basic scenarios. Effectively this approach double amount of configurations.

      Hence my proposal is to introduce a new option for jobdsl CASC which would allow to configure classpath elements used for bootstrapped jobs and finally let them utilize advertised real word example:

      jobs: 
      
        - additionalClasspath: ['/var/jenkins_home/lib/', 'abc/', 'def/']
        - script: >
            job('testJob1') {
                scm {
                    git('git://github.com/quidryan/aws-sdk-test.git')
                }
                triggers {
                    scm('H/15 * * * *')
                }
                steps {
                    maven('-e clean test')
                }
            }
      
        - file: ./src/test/resources/javaposse/jobdsl/plugin/testjob.groovy
        - file: ./src/test/resources/javaposse/jobdsl/plugin/advancedJob.groovy
      

       

            basil Basil Crow
            splatch Łukasz Dywicki
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: