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

Allow to pass additional request parameter for notifyCommit

    XMLWordPrintable

Details

    • New Feature
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • git-plugin
    • None

    Description

      When calling notifyCommit it should be possible to pass additional request parameter to the notifyCommit URL and when a job is triggered the parameters are passed on the triggered job, similar to "buildWithParameters", but that the parameters are part of the call to notifyCommit. This is e.g. valuable when an external system is triggering the Jenkins job with the Git notifyCommit Url and needs to pass additional parameter, e.g. the reason for the triggering or pull request identifier.

      Attachments

        Issue Links

          Activity

            christiangalsterer Christian Galsterer added a comment - - edited
            christiangalsterer Christian Galsterer added a comment - - edited I already did some testing, see https://groups.google.com/d/msg/jenkinsci-dev/aRN0YeXXbHQ/MMTV0QpGrv8J for details.
            markewaite Mark Waite added a comment -

            Fix included in git plugin 2.4.0 released 18 July 2015

            markewaite Mark Waite added a comment - Fix included in git plugin 2.4.0 released 18 July 2015
            yyl8815 Bruce Yang added a comment -

            Can anyone help show me how I can get the additional parameters in Jenkins Job?
            Thanks

            yyl8815 Bruce Yang added a comment - Can anyone help show me how I can get the additional parameters in Jenkins Job? Thanks

            Assuming you have the following URL http://localhost:8080/jenkins/git/notifyCommit?url=<GIT_URL>&branches=<BRANCH>&sha1=<SHA>&PARAM1=VALUE1&PARAM1=VALUE2 with the two additional parameters PARAM1 and PARAM2 you can use them as any build parameter with $PARAM1 and $PARAM2.

            For examples see https://christiangalsterer.wordpress.com/2015/07/28/set-jenkins-build-description-with-a-system-groovy-script/ and https://christiangalsterer.wordpress.com/2015/04/23/continuous-integration-for-pull-requests-with-jenkins-and-stash/

            christiangalsterer Christian Galsterer added a comment - Assuming you have the following URL http://localhost:8080/jenkins/git/notifyCommit?url= <GIT_URL>&branches=<BRANCH>&sha1=<SHA>&PARAM1=VALUE1&PARAM1=VALUE2 with the two additional parameters PARAM1 and PARAM2 you can use them as any build parameter with $PARAM1 and $PARAM2. For examples see https://christiangalsterer.wordpress.com/2015/07/28/set-jenkins-build-description-with-a-system-groovy-script/ and https://christiangalsterer.wordpress.com/2015/04/23/continuous-integration-for-pull-requests-with-jenkins-and-stash/
            markewaite Mark Waite added a comment -

            This capability was added in git plugin 2.4.0 then was removed in git plugin 2.5.0 because it introduces a security bug documented in SECURITY-275.

            Refer to the git plugin javadoc for more explanation about:

            markewaite Mark Waite added a comment - This capability was added in git plugin 2.4.0 then was removed in git plugin 2.5.0 because it introduces a security bug documented in SECURITY-275. Refer to the git plugin javadoc for more explanation about: allowNotifyCommitParameters safeParameters

            People

              christiangalsterer Christian Galsterer
              christiangalsterer Christian Galsterer
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: