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

Git plugin approved list is ignored in called method

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • git-plugin
    • None
    • git plugin 4.1.0
      git client plugin 4.1.0
      Jenkins 2.204.1

      Git plugin 4.1.0 adds many GitSCM getters to the Pipeline approved list as part of JENKINS-42860 so that Pipeline users do not need to specifically approve a script that refers to GitSCM fields. It is confirmed to work when the references are directly inside the Jenkinsfile, as in the JENKINS-42860 automated check.

      It fails to approve the reference to that field when it is accessed from a shared library method like GitUtils.my_utils

      The failing reference looks something like this:

      @Library(value='globalPipelineLibraryMarkEWaite', changelog=false) _
      
      import com.markwaite.GitUtils
      
      def branch='master'
      
      node {
        stage('Checkout') {
          def my_utils = new com.markwaite.GitUtils()
          dir(branch) {
            checkout([$class: 'GitSCM',
                      branches: [[name: branch]],
                      userRemoteConfigs: my_utils.adjustRemoteConfig(scm.userRemoteConfigs[0], branch)
                     ])
          }
      }
      

            Unassigned Unassigned
            markewaite Mark Waite
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: