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

Unable to set extensions for Git SCM Source via DSL

      In the past I used `gitSCMSource` to specify my git configuration with extensions in my Job DSL.
       
      Template I used:

      multibranchPipelineJob('${JOB_NAME}') {
          displayName('${JOB_NAME}')
          description('${JOB_DESCRIPTION}')
          orphanedItemStrategy {
              discardOldItems {
                  numToKeep(7)
              }
          }
          branchSources {
              branchSource {
                  source {
                      gitSCMSource {
                          id('')
                          remoteName('origin')
                          rawRefSpecs('')
                          ignoreOnPushNotifications(false)
                          remote('${JOB_GIT_URL}')
                          credentialsId('${GIT_CREDENTIALS_ID}')
                          includes('*')
                          excludes('')
                          extensions {
                              wipeWorkspace()
                              preBuildMerge {
                                  options {
                                      mergeRemote('origin')
                                      mergeTarget('${GIT_BRANCH}')
                                      mergeStrategy('default')
                                      fastForwardMode('FF')
                                  }
                              }
                          }
                      }
                  }
              }
          }
      }

      Now after updating to latest Jenkins/Plugins this no longer works. I looked at using the `git` source instead of `gitSCMSource` but it does not provide a way to set the extensions.

      In the new git-plugin 3.4.0 extensions are deprecated and are now traits. Not sure if this has anything to do with the issue.

          [JENKINS-45688] Unable to set extensions for Git SCM Source via DSL

          Sam Gleske added a comment -

          Here's a link to the DSL used.

          https://github.com/gimp-ci/jenkins-dsl/blob/292cafd41e8c26e200dbe967aba7ec71e120df84/jobs/gimp_multibranch_pipelines.groovy

          Here's a list of plugins installed that broke the the DSL. https://github.com/gimp-ci/jenkins-os-packages/commit/2e9e0e6b5a2e0287268ca70d836f2a7e71fef72b

          In particular I confirmed the following plugins broke the DSL.

          • org.jenkins-ci.plugins:cloudbees-bitbucket-branch-source:2.2.11
          • org.jenkins-ci.plugins:github-branch-source:2.3.4

          Sam Gleske added a comment - Here's a link to the DSL used. https://github.com/gimp-ci/jenkins-dsl/blob/292cafd41e8c26e200dbe967aba7ec71e120df84/jobs/gimp_multibranch_pipelines.groovy Here's a list of plugins installed that broke the the DSL. https://github.com/gimp-ci/jenkins-os-packages/commit/2e9e0e6b5a2e0287268ca70d836f2a7e71fef72b In particular I confirmed the following plugins broke the DSL. org.jenkins-ci.plugins:cloudbees-bitbucket-branch-source:2.2.11 org.jenkins-ci.plugins:github-branch-source:2.3.4

          Sam Gleske added a comment -

          This nonsense requiring the configure block is ridiculous.  I've spent the past 5 hours trying to figure it out and I'm definitely not a Job DSL newb.

          Sam Gleske added a comment - This nonsense requiring the configure block is ridiculous.  I've spent the past 5 hours trying to figure it out and I'm definitely not a Job DSL newb.

          sag47 I am sure this is not by intention and the maintainers will welcome your pull requests to stop this nonsense.

          Steffen Gebert added a comment - sag47 I am sure this is not by intention and the maintainers will welcome your pull requests to stop this nonsense.

          Sam Gleske added a comment - - edited

          stephenking my comments have added a lot of value to this issue by referencing both source code, examples, and reproduction.  Your comment claims I should stop doing this.  I disagree.

          Edit: I think I initially misread your comment.  In any case, "contribute code" should never be the default retort as a comeback in my opinion.

          Sam Gleske added a comment - - edited stephenking my comments have added a lot of value to this issue by referencing both source code, examples, and reproduction.  Your comment claims I should stop doing this.  I disagree. Edit: I think I initially misread your comment.  In any case, "contribute code" should never be the default retort as a comeback in my opinion.

          No, my point was "please be friendly". Nobody creates "nonsense" by intention.

          Steffen Gebert added a comment - No, my point was "please be friendly". Nobody creates "nonsense" by intention.

          Sam Gleske added a comment -

          Sure, I can put my frustration in check.  My intent wasn't to be hostile nor to imply it was done on purpose (it would be odd to assume that it's on purpose).

          Sam Gleske added a comment - Sure, I can put my frustration in check.  My intent wasn't to be hostile nor to imply it was done on purpose (it would be odd to assume that it's on purpose).

          Sam Gleske added a comment -

          Added git-plugin since the git-plugin should define "@Symbol" for its classes to help with the DSL generation to be unique.

          Sam Gleske added a comment - Added git-plugin since the git-plugin should define "@Symbol" for its classes to help with the DSL generation to be unique.

          Sam Gleske added a comment -

          Sam Gleske added a comment - https://github.com/jenkinsci/git-plugin/pull/595

          sag47, thanks for bringing this forward!

          Steffen Gebert added a comment - sag47 , thanks for bringing this forward!

          Sam Gleske added a comment -

          You're welcome.

          Sam Gleske added a comment - You're welcome.

            Unassigned Unassigned
            arty13 Art V
            Votes:
            1 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: