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

Allow to pass additional request parameter for notifyCommit

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Major Major
    • git-plugin
    • None

      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.

          [JENKINS-27902] Allow to pass additional request parameter for notifyCommit

          Christian Galsterer added a comment - PR available at https://github.com/jenkinsci/git-plugin/pull/315

          Code changed in jenkins
          User: Christian Galsterer
          Path:
          src/main/java/hudson/plugins/git/GitStatus.java
          src/test/java/hudson/plugins/git/GitStatusTest.java
          http://jenkins-ci.org/commit/git-plugin/f0b2d0d16826906d5743722ae97967bf1d6303d7
          Log:
          JENKINS-27902 Allow to pass additional request parameter for notifyCommit

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Christian Galsterer Path: src/main/java/hudson/plugins/git/GitStatus.java src/test/java/hudson/plugins/git/GitStatusTest.java http://jenkins-ci.org/commit/git-plugin/f0b2d0d16826906d5743722ae97967bf1d6303d7 Log: JENKINS-27902 Allow to pass additional request parameter for notifyCommit

          Code changed in jenkins
          User: Christian Galsterer
          Path:
          src/main/java/hudson/plugins/git/GitStatus.java
          http://jenkins-ci.org/commit/git-plugin/336d7f7dfbcd427db8b180f23396ddad3cef56de
          Log:
          JENKINS-27902 Allow to pass additional request parameter for notifyCommit

          • fixed review finding, that sha1 was not passed correctly.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Christian Galsterer Path: src/main/java/hudson/plugins/git/GitStatus.java http://jenkins-ci.org/commit/git-plugin/336d7f7dfbcd427db8b180f23396ddad3cef56de Log: JENKINS-27902 Allow to pass additional request parameter for notifyCommit fixed review finding, that sha1 was not passed correctly.

          Code changed in jenkins
          User: Nicolas De loof
          Path:
          src/main/java/hudson/plugins/git/GitStatus.java
          src/test/java/hudson/plugins/git/GitStatusTest.java
          http://jenkins-ci.org/commit/git-plugin/9e46ae773fa0f00b15dc989d3109941a664042af
          Log:
          Merge pull request #315 from christiangalsterer/JENKINS-27902

          JENKINS-27902 Allow to pass additional request parameter for notifyCommit

          Compare: https://github.com/jenkinsci/git-plugin/compare/30766fe249c2...9e46ae773fa0

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De loof Path: src/main/java/hudson/plugins/git/GitStatus.java src/test/java/hudson/plugins/git/GitStatusTest.java http://jenkins-ci.org/commit/git-plugin/9e46ae773fa0f00b15dc989d3109941a664042af Log: Merge pull request #315 from christiangalsterer/ JENKINS-27902 JENKINS-27902 Allow to pass additional request parameter for notifyCommit Compare: https://github.com/jenkinsci/git-plugin/compare/30766fe249c2...9e46ae773fa0

          Mark Waite added a comment -

          The git plugin and git client plugin are being tested in hopes of releasing new versions before the end of June. If you're willing to assist with the testing, please download and install a pre-release build of the git client plugin and the git plugin. Problems detected in the pre-release should be e-mailed to MarkEWaite and ndeloof.

          I wrote some test ideas if you would like suggestions of areas that need testing. The git plugin supports many different use cases and its automated tests only evaluate a very few of those use cases.

          Mark Waite added a comment - The git plugin and git client plugin are being tested in hopes of releasing new versions before the end of June. If you're willing to assist with the testing, please download and install a pre-release build of the git client plugin and the git plugin . Problems detected in the pre-release should be e-mailed to MarkEWaite and ndeloof . I wrote some test ideas if you would like suggestions of areas that need testing. The git plugin supports many different use cases and its automated tests only evaluate a very few of those use cases.

          Christian Galsterer added a comment - - edited

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

          Mark Waite added a comment -

          Fix included in git plugin 2.4.0 released 18 July 2015

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

          Bruce Yang added a comment -

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

          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/

          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/

          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:

          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

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

              Created:
              Updated:
              Resolved: