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

Regression: parameters are not set on commit notification

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • git-plugin
    • Jenkins 1.626
      Java 1.8
      CentOS 6.6 (x86_64)

      After upgrades (I'm not sure whether it happened after jenkins or jenkins plugin upgrade), jenkins doesn't set configured environment variables with default values in the "This build is parameterized" section on commit notification from SCM (Stash) using /git/notifyCommit request. However it works properly when build is manually triggered with "Build with parameters" button. The only difference I can see is the lack of these configured variables set – everything else works as expected.

      It is a regression – this setup is used for a very long time in our environment.

          [JENKINS-30178] Regression: parameters are not set on commit notification

          Emil Smoleński created issue -

          Mark Waite added a comment -

          Could you compare the behavior of the previous release (2.3.5) and the current release (2.4.0) to see if that is where the change was introduced? There was a change included in 2.4.0 which may have caused this regression, and it would help me to have it narrowed to a specific version that introduced the bug.

          Mark Waite added a comment - Could you compare the behavior of the previous release (2.3.5) and the current release (2.4.0) to see if that is where the change was introduced? There was a change included in 2.4.0 which may have caused this regression, and it would help me to have it narrowed to a specific version that introduced the bug.

          Thanks for quick reply!

          I downgraded git-plugin to the 2.3.5 version and it in fact solved the problem. Please let me know if you need additional testing or more information in order to fix this.

          Emil Smoleński added a comment - Thanks for quick reply! I downgraded git-plugin to the 2.3.5 version and it in fact solved the problem. Please let me know if you need additional testing or more information in order to fix this.

          Mark Waite added a comment -

          It would be great to confirm that the problem also occurs when using a commitNotify from something other than Stash. I don't have a Stash installation available, so it will help if I can see it from commitNotify from a simple bare git repository, rather than requiring Stash.

          Mark Waite added a comment - It would be great to confirm that the problem also occurs when using a commitNotify from something other than Stash. I don't have a Stash installation available, so it will help if I can see it from commitNotify from a simple bare git repository, rather than requiring Stash.

          Emil Smoleński added a comment - - edited

          The actual commit notification from Stash (taken from logs) looks like this:

          GET /git/notifyCommit?url=ssh%3A%2F%2Fgit%40stash.example.com%3A1234%2Fproj%2Frepo.git&branches=branch&sha1=0123456789abcdef0123456789abcdef01234567
          

          In the newest versions of Stash you can also:

          • Omit SHA1 Hash Code
          • Omit Branch Name

          (these options are disabled by default)

          HTH.

          Emil Smoleński added a comment - - edited The actual commit notification from Stash (taken from logs) looks like this: GET /git/notifyCommit?url=ssh%3A%2F%2Fgit%40stash.example.com%3A1234%2Fproj%2Frepo.git&branches=branch&sha1=0123456789abcdef0123456789abcdef01234567 In the newest versions of Stash you can also: Omit SHA1 Hash Code Omit Branch Name (these options are disabled by default) HTH.

          Daniel Beck added a comment -

          If a sha1 is provided, the build is triggered without default parameters:
          https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/GitStatus.java#L281...L292

          buildParameters in the above code seems to be fed in
          https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/GitStatus.java#L72
          which means it only contains explicitly passed parameters, and not those defined in the job.

          Haven't confirmed in a debugger, but seems to explain what's going on here.

          Daniel Beck added a comment - If a sha1 is provided, the build is triggered without default parameters: https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/GitStatus.java#L281...L292 buildParameters in the above code seems to be fed in https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/GitStatus.java#L72 which means it only contains explicitly passed parameters, and not those defined in the job. Haven't confirmed in a debugger, but seems to explain what's going on here.

          Daniel Beck added a comment -

          Additionally, if there are no such parameters, the build will end up with an empty ParametersAction in the sidepanel anyway. This should really only be set when there actually are parameters IMO.

          Daniel Beck added a comment - Additionally, if there are no such parameters, the build will end up with an empty ParametersAction in the sidepanel anyway. This should really only be set when there actually are parameters IMO.
          Félix Belzunce Arcos made changes -
          Assignee Original: Nicolas De Loof [ ndeloof ] New: Félix Belzunce Arcos [ fbelzunc ]
          Félix Belzunce Arcos made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

            fbelzunc Félix Belzunce Arcos
            emil_upnext Emil Smoleński
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: