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

Jenkins DSL Script lightweight() checkout not working

      So, here is my pipelineJob() Jenkins DSL Script that I am using to create Jobs in Jenkins, but when I use lightweight() in cpsScmFlowDefinition, this script doesn't work and gives me an error which I have pasted below.

      Jenkins version 2.73.2 and DSL plugin version 1.66. Please help me to fix this issue. Thanks.

       

      pipelineJob('') {
       label('')
       definition {
        cpsScmFlowDefinition {
         scm {
          git {
           remote {
            url('')
            credentials('')
           }
           branch('')
           extensions {
            cleanBeforeCheckout()
            localBranch()
           }
          }
         }
         scriptPath('')
         lightweight(true) // error while using this
        }
       }
      }

       

      ERROR:

       

      Processing provided DSL script
      ERROR: (script, line 14) No signature of method: javaposse.jobdsl.plugin.structs.DescribableListContext.git() is applicable for argument types: (script$_run_closure1$_closure4$_closure7$_closure8$_closure9) values: [script$_run_closure1$_closure4$_closure7$_closure8$_closure9@516b358d]
      Possible solutions: wait(), wait(long), with(groovy.lang.Closure), is(java.lang.Object), grep(), find()
      [BFA] Scanning build for known causes...
      [BFA] No failure causes found
      [BFA] Done. 0s
      Collecting metadata...
      Metadata collection done.
      Started calculate disk usage of build
      Finished Calculation of disk usage of build in 0 seconds
      Started calculate disk usage of workspace
      Finished Calculation of disk usage of workspace in 0 seconds
      Finished: FAILURE

       

          [JENKINS-47698] Jenkins DSL Script lightweight() checkout not working

          The problem is not the lightweight method. There is no method called {{git below scm. The error message is a bit fuzzy but gives a hint:

          code
          No signature of method: javaposse.jobdsl.plugin.structs.DescribableListContext.git() is applicable for argument types
          code

          Refer to the embedded API viewer to find the correct syntax.

          Daniel Spilker added a comment - The problem is not the lightweight method. There is no method called {{git below scm . The error message is a bit fuzzy but gives a hint: code No signature of method: javaposse.jobdsl.plugin.structs.DescribableListContext.git() is applicable for argument types code Refer to the embedded API viewer to find the correct syntax.

          The thing I did to solve this issue is to use cpsScmFlowDefinition() like this:

          pipelineJob('example') {
           definition {
           cpsScmFlowDefinition {
           scm {
           gitSCM {
           userRemoteConfigs {
           userRemoteConfig {
           credentialsId('')
           name('')
           refspec('')
           url('')
           }
           }
           branches {
           branchSpec {
           name('')
           }
           }
           extensions {
           cleanBeforeCheckout()
           localBranch {
           localBranch('')
           }
           }
           doGenerateSubmoduleConfigurations(false)
           browser {
           gitWeb {
           repoUrl('')
           }
           }
           gitTool('')
           }
           }
           scriptPath('')
           lightweight(true)
           }
           }
          }

          Summit Singh Thakur added a comment - The thing I did to solve this issue is to use  cpsScmFlowDefinition()  like this: pipelineJob( 'example' ) { definition { cpsScmFlowDefinition { scm { gitSCM { userRemoteConfigs { userRemoteConfig { credentialsId('') name('') refspec('') url('') } } branches { branchSpec { name('') } } extensions { cleanBeforeCheckout() localBranch { localBranch('') } } doGenerateSubmoduleConfigurations( false ) browser { gitWeb { repoUrl('') } } gitTool('') } } scriptPath('') lightweight( true ) } } }

            daspilker Daniel Spilker
            summitsc Summit Singh Thakur
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: