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

DSL script from configuration or file not treated equally

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Trivial Trivial
    • job-dsl-plugin
    • None
    • Jenkins ver. 1.642.1
      Job DSL plugin ver. 1.42
      Java 1.8.0_66
      Debian GNU/Linux 8

      The following script configured for Job DSL plugin works OK when put into "Use the provided DSL script" (or jenkins script console), but not when put into file (into scm) and called via "Look on Filesystem"
      The cause of error output is probably trivial and doesn't matter much, but I would expect those two input methods to be identical (both work or fail).

      for (job in jenkins.model.Jenkins.theInstance.getProjects()) { out.println("Found job: " + job.name) }
      
      Error output: 
      Processing DSL script jenkins.dsl
      ERROR: (jenkins.dsl, line 1) No such property: model for class: jenkins
      
      

      adding imports doesn't help, it doesn't seem to be the difference

      import jenkins.*
      import jenkins.model.*
      import hudson.*
      import hudson.model.*
      

      Are they using different classes, or importing different libraries?
      Thank you very much for help.

            daspilker Daniel Spilker
            default John Default
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: