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

Allow modification to GitSCM from Pipeline

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Won't Do
    • Icon: Minor Minor
    • git-plugin

      The GitHub organisation plugin automatically passes in an "scm" variable to Pipeline scripts, which allows you to use it like so:

      ```
      checkout scm: scm
      ```

      I want to be able to modify the `scm` variable, because there's no other way of checking out the merged result for PRs. In particular, I want to be able to do:

      ```
      scm.getExtensions().add([$class: 'RelativeTargetDirectory', relativeTargetDir: name])
      scm.getExtensions().add([$class: 'CleanCheckout'])
      ```

      However, by default calling getExtensions is not allowed in Pipeline scripts (in the Groovy sandbox), which means I can't put this in my Pipeline shared library without getting everyone that uses it to whitelist those methods.

            Unassigned Unassigned
            hachque June Rhodes
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: