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

JobDSL folderLibraries is failing after git plugin upgrade to 4.8.1

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • job-dsl-plugin
    • None
    • 2.263.4.2

      After git plugin upgrade from version 4.5.2 to 4.8.1 we are facing issue when using JobDSL for seeding the jobs. Below you can see the definition:

      folder('project-a') {
          displayName('Folder A')
          description('Folder for project A')
          properties {
              folderLibraries {
                  libraries {
                      libraryConfiguration {
                          name("my-lib")
                          retriever {
                              modernSCM {
                                  scm {
                                      git {                        
                                              remote("https://somebitbucket.com/scm/project/reponame.git")
                                              credentialsId("jenkins-bitbucket")
                                      }
                                  }
                              }
                          }
                      }
                  }
              }
          }
      }
      

      I'm getting following error:
      ERROR: (script, line 12) No signature of method: javaposse.jobdsl.plugin.structs.DescribableListContext.git() is applicable for argument types: (script$_run_closure1$_closure2$_closure3$_closure4$_closure5$_closure6$_closure7$_closure8$_closure9) values: [script$_run_closure1$_closure2$_closure3$_closure4$_closure5$_closure6$_closure7$_closure8$_closure9@221abe45]
      Possible solutions: wait(), wait(long), is(java.lang.Object), with(groovy.lang.Closure), any(), find()
      Notifying upstream projects of job completion

          [JENKINS-66402] JobDSL folderLibraries is failing after git plugin upgrade to 4.8.1

          Mark Waite added a comment -

          I've reassigned the issue to job-dsl-plugin because it needs their help.

          The job-dsl documentation for the git keyword in branch source context is https://jenkinsci.github.io/job-dsl-plugin/#method/javaposse.jobdsl.dsl.helpers.workflow.BranchSourcesContext.git

          The job-dsl documentation for the git keyword in scm context is https://jenkinsci.github.io/job-dsl-plugin/#method/javaposse.jobdsl.dsl.helpers.ScmContext.git

          I'm not aware of job-dsl documentation for use with a pipeline shared library

          Mark Waite added a comment - I've reassigned the issue to job-dsl-plugin because it needs their help. The job-dsl documentation for the git keyword in branch source context is https://jenkinsci.github.io/job-dsl-plugin/#method/javaposse.jobdsl.dsl.helpers.workflow.BranchSourcesContext.git The job-dsl documentation for the git keyword in scm context is https://jenkinsci.github.io/job-dsl-plugin/#method/javaposse.jobdsl.dsl.helpers.ScmContext.git I'm not aware of job-dsl documentation for use with a pipeline shared library

          Thanks markewaite. This is, what I see in job-dsl API documentation in our instance (based on installed plugins)

          folderLibraries { 
              libraries { 
                  libraryConfiguration { 
                      // An identifier you pick for this library, to be used in the @Library annotation. name(String value) 
                      retriever { 
                          // Loads a library from any SCM plugin supported by Jenkins Pipeline, for example in the checkout step. 
                          legacySCM {} 
                              // Loads a library from an SCM plugin using newer interfaces optimized for this purpose. 
                              modernSCM { 
                                  scm { 
                                      // Discovers branches and/or pull requests from a specific repository in either Bitbucket Cloud or a Bitbucket Server instance.                
                                      bitbucket {} 
                                      fromScm {} 
                                      git { 
                                          // Specify the URL of this remote repository. 
                                          remote(String value) 
                                          browser {} 
                                          // Credentials used to scan branches and check out sources. 
                                          credentialsId(String value) 
                                          extensions {} 
                                          gitTool(String value) 
                                          id(String value) 
                                          traits {} 
                                     } 
                                     github {} 
                                     mercurialSCMSource {} 
                                     subversionSCMSource {} 
                                 } 
                              } 
                           } 
                           // If checked, scripts may select a custom version of the library by appending @someversion in the @Library annotation.   
                           allowVersionOverride(boolean value) 
                           // A default version of the library to load if a script does not select another. 
                           defaultVersion(String value) 
                           // If checked, scripts will automatically have access to this library without needing to request it via @Library. 
                           implicit(boolean value) 
                           // If checked, any changes in the library will be included in the changesets of a build, and changing the library would cause new builds to run for Pipelines that include this library. 
                           includeInChangesets(boolean value) 
                  } 
              } 
          }
          

          Frantisek Dolsky added a comment - Thanks markewaite . This is, what I see in job-dsl API documentation in our instance (based on installed plugins) folderLibraries { libraries { libraryConfiguration { // An identifier you pick for this library, to be used in the @Library annotation. name( String value) retriever { // Loads a library from any SCM plugin supported by Jenkins Pipeline, for example in the checkout step. legacySCM {} // Loads a library from an SCM plugin using newer interfaces optimized for this purpose. modernSCM { scm { // Discovers branches and/or pull requests from a specific repository in either Bitbucket Cloud or a Bitbucket Server instance. bitbucket {} fromScm {} git { // Specify the URL of this remote repository. remote( String value) browser {} // Credentials used to scan branches and check out sources. credentialsId( String value) extensions {} gitTool( String value) id( String value) traits {} } github {} mercurialSCMSource {} subversionSCMSource {} } } } // If checked, scripts may select a custom version of the library by appending @someversion in the @Library annotation. allowVersionOverride( boolean value) // A default version of the library to load if a script does not select another. defaultVersion( String value) // If checked, scripts will automatically have access to this library without needing to request it via @Library. implicit( boolean value) // If checked, any changes in the library will be included in the changesets of a build, and changing the library would cause new builds to run for Pipelines that include this library. includeInChangesets( boolean value) } } }

            Unassigned Unassigned
            dolsky Frantisek Dolsky
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: