Skip to content

Conversation

mk7run
Copy link

@mk7run mk7run commented Feb 16, 2021

Description

This allows us to infer the person responsible for opening a PR or
updating a branch which triggers a Jenkins build. We extract this info
inside a Jenkins pipeline like so:

def causes =
currentBuild.getBuildCauses('org.jenkinsci.plugins.github_branch_source.GitHubSenderCause')
if (!causes.isEmpty()) {
  return causes[0].login
}

Example pipeline utilizing above code:
Screen Shot 2021-02-16 at 5 17 37 PM

To run updated unit tests:

mvn test -Dtest=EventsTest.java

Submitter checklist

  • Link to JIRA ticket in description, if appropriate.
  • Change is code complete and matches issue description
  • Automated tests have been added to exercise the changes
  • Reviewer's manual test instructions provided in PR description. See Reviewer's first task below.

Reviewer checklist

  • Run the changes and verify that the change matches the issue description
  • Reviewed the code
  • Verified that the appropriate tests have been written or valid explanation given

Documentation changes

  • Link to jenkins.io PR, or an explanation for why no doc changes are needed

Users/aliases to notify

Melissa Kanhirun and others added 5 commits February 16, 2021 22:56
This allows us to infer the person responsible for opening a PR or
updating a branch which triggers a Jenkins build. We extract this info
inside a Jenkins pipeline like so:

```
def causes =
currentBuild.getBuildCauses('org.jenkinsci.plugins.github_branch_source.GitHubSenderCause')
if (!causes.isEmpty()) {
  return causes[0].login
}
```

Signed-off-by: Joyce Yee <joyce.z.yee@gmail.com>
@wlfshmn
Copy link

wlfshmn commented Jun 9, 2023

Is there still interest in this PR? I'm using this in my instance to gain visibility and auditability into who does what in our builds, and would very much like to see this updated and merged upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants