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

Expose pullrequest source commit hash to pipeline env variables

    Details

    • Type: New Feature
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: branch-api-plugin
    • Labels:
      None
    • Environment:
      GitHub, Bitbucket
    • Similar Issues:

      Description

      Some operations on pullrequests (like reporting build statuses or creating reports) require to pass the hash of the pullrequest branch head, as known by the remote system.
      When using the branch plugin, Jenkins may create a merge commit between the PR source and target branch. It makes it difficult for a pipeline script to retrieve the original source commit hash.

      My suggestion is to add a new environment variable, similar to CHANGE_BRANCH, that would expose this source commit. We could name this variable CHANGE_BRANCH_COMMIT_ID, to make it consistent with existing CHANGE_BRANCH and COMMIT_ID.

      See original discussion:
      https://groups.google.com/d/topic/jenkinsci-dev/-ojqklsaKbw/discussion

      Example of operations requiring the PR head commit hash:

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            • Assignee:
              henryju Julien HENRY
              Reporter:
              henryju Julien HENRY
            • Votes:
              3 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: