[JIRA] (JENKINS-58313) Expose pullrequest source commit hash to pipeline env variables

3 views
Skip to first unread message

julien.henry@sonarsource.com (JIRA)

unread,
Jul 3, 2019, 4:35:11 AM7/3/19
to jenkinsc...@googlegroups.com
Julien HENRY created an issue
 
Jenkins / New Feature JENKINS-58313
Expose pullrequest source commit hash to pipeline env variables
Issue Type: New Feature New Feature
Assignee: Julien HENRY
Components: branch-api-plugin
Created: 2019-07-03 08:34
Environment: GitHub, Bitbucket
Priority: Minor Minor
Reporter: Julien HENRY

Some operations on pullrequests (like reporting build statuses or creating reports) require to pass the commit hash of the pullrequest, as known by the remote system.
When using the branch plugin, Jenkins can 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

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

julien.henry@sonarsource.com (JIRA)

unread,
Jul 3, 2019, 5:01:02 AM7/3/19
to jenkinsc...@googlegroups.com
Julien HENRY updated an issue
Change By: Julien HENRY
Some operations on pullrequests (like reporting build statuses or creating reports) require to pass the commit hash of the pullrequest branch head , as known by the remote system.
When using the branch plugin, Jenkins
can 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}}.
Reply all
Reply to author
Forward
0 new messages