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

git-parameter SECURITY-3419 validation breaks pipeline build step that does not include an SCM

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • git-parameter-plugin
    • None

      git-parameter-plugin update 444.vca_b_84d3703c2 brought validation on the input parameter (SECURITY-3419).

      However, this seems to break in combination with pipeline-build-step-plugin.

      We have several job pipelines that have a branch git parameter as input, that they pass on to a different job through a build step.
      However, the parameter seems to get passed through as a StringParameterValue instead, breaking the job.

      ERROR: Invalid parameter value: (StringParameterValue) B_BRANCH='master'

      Using the global flag to turn off validation we have a workaround, but this seems less than ideal.

      On a clean Jenkins install, the first run of the parent job succeeds, the subsequent runs fail with the above error.


      Minimal reproducible example

      Parent job:

      pipeline {
          agent any
          
          parameters {
              gitParameter type: 'PT_BRANCH',
                           name: 'A_BRANCH',
                           branchFilter: 'origin/(.*)',
                           defaultValue: 'master',
                           description: 'Choose a branch to checkout',
                           selectedValue: 'DEFAULT',
                           sortMode: 'DESCENDING_SMART'
          }
      
          stages {
              stage('Example') {
                  steps {
                      build job: '/child',
                            parameters: [
                                gitParameter(name: 'B_BRANCH', value: params.A_BRANCH)
                            ]
                  }
              }
          }
      }
      

      Child job:

      pipeline {
          agent any
          
          parameters {
              gitParameter type: 'PT_BRANCH',
                           name: 'B_BRANCH',
                           branchFilter: 'origin/(.*)',
                           defaultValue: 'master',
                           description: 'Choose a branch to checkout',
                           selectedValue: 'DEFAULT',
                           sortMode: 'DESCENDING_SMART'
          }
      
          stages {
              stage('Example') {
                  steps {
                      echo params.B_BRANCH
                  }
              }
          }
      }
      

            markewaite Mark Waite
            thijsboehme Thijs
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: