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

Change in git plugin causes job-dsl script to break

XMLWordPrintable

      After upgrading from git:4.0.0 to git:4.1.1, we started having an issue with this job-dsl script (runs via configuration-as-code, but I don't think that's relevant):

      multibranchPipelineJob('...') {
        branchSources {
          branchSource {
            source {
              github {
                id('...')
                repoOwner('...')
                repository('...')
                repositoryUrl('')
                configuredByUrl(false)
                credentialsId('/github-api')
      
                traits {
                  cleanBeforeCheckoutTrait()
                }
              }
            }
          }
        }
      }
      

      The script fails to run with

      javaposse.jobdsl.dsl.DslScriptException: (script, line 14) the following options are required and must be specified: extension
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
         at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
         at org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:77)
      

      The stack trace goes on and on, but it doesn't look very useful.

      The problem goes away if we comment out `cleanBeforeCheckoutTrait()`. Trying to pass a `null` value for `extension` fails with

      groovy.lang.MissingMethodException: No signature of method: javaposse.jobdsl.plugin.structs.DescribableListContext.cleanBeforeCheckoutTrait() is applicable for argument types: (null) values: [null]
      

      I have to wonder if it was caused by this update to the comment (:the scream: ): https://github.com/jenkinsci/git-plugin/commit/a63cbf70fb9b0808e832f0f87224e717525b43cc#diff-3fea5cf802f684679c8bf220b9946f58

            markewaite Mark Waite
            jonathanb1 Jonathan B
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: