Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Event Trigger #91

Open
dclayton-godaddy opened this issue Oct 29, 2020 · 12 comments
Open

GitHub Event Trigger #91

dclayton-godaddy opened this issue Oct 29, 2020 · 12 comments

Comments

@dclayton-godaddy
Copy link

I'd love to submit a PR to create a GitHubEventTrigger to allow all events to be captured in pipeline. All events sent to the master can cause a build to be triggered if the pipeline has githubEventTrigger with the event name and a payloadFilter. This will save us from having to continuously update this plugin for future supported events of GitHub.

githubEventTrigger("pull_request", payloadFilter: ["action": "closed"])

or

githubEventTrigger("deployment", payloadFilter: ["action": "created"])
@dclayton-godaddy
Copy link
Author

Before I get started, I want to make sure this is something that has an opportunity to get merged.

@paschdan
Copy link

paschdan commented Nov 5, 2020

I'd love this.

because with the current implementation, we have to define multiple Cause Objects, to find out, what has triggered the job:

def triggerCommentCause = currentBuild.rawBuild.getCause(org.jenkinsci.plugins.pipeline.github.trigger.IssueCommentCause)

if (triggerCommentCause) {
    echo("build was started by a github trigger")
} else {
    echo('Build was not started by a trigger')
}

def triggerReviewCause = currentBuild.rawBuild.getCause(org.jenkinsci.plugins.pipeline.github.trigger.PullRequestReviewCause)

if (triggerReviewCause) {
     echo("build was started by a github trigger")
} else {
    echo('Build was not started by a trigger')
}

for backwards ability you have to add the githubEventTrigger additionally to the existing triggers.

for the githubEventTriggerCause, i would suggest, that it should have the github events public properties (https://developer.github.com/v3/activity/event_types/#event-object-common-properties) maybe exluding the id

@dclayton-godaddy
Copy link
Author

Sweet! We'll look at submitting a PR on this. You think it will get approved if it has unit tests, etc? Not a fan of maintaining forks as I've had with many other plugins.

@paschdan
Copy link

paschdan commented Nov 5, 2020

Sorry for the confusion, I'm no maintainer, was just giving my 2 ct :)

@dclayton-godaddy
Copy link
Author

Sure. I was asking because you had successful commits. :)

@paschdan
Copy link

paschdan commented Nov 6, 2020

hehe, ok, @aaronjwhiteside was kind of fast in merging the PRs, and @aaronwalker did the main work for the latest trigger

@aaronwalker
Copy link
Member

@dclayton-godaddy had exactly the same thought while implementing the PR review trigger. Happy to test and provide feedback and also work to get it merged as quickly as possible.

@blundercon
Copy link

Not sure what the status or progress here is. I can help out with this as well.

@dclayton-godaddy
Copy link
Author

Hi all. Sorry, been super busy. I haven't started if someone else has the time. We've started looking at the Checks API plugin to handle checks which was one of the use-cases we wanted.

@allout58
Copy link

I'd like to take a crack at this, should hopefully have a PR up in a week or two.

@allout58
Copy link

allout58 commented Jan 22, 2024

Having some issues because it's so generic. Would the expectation be that

githubEventTrigger("pull_request", payloadFilter: ["action": "closed"])

would only run on the Pull Request Job that the event is about? What about events that aren't related to a particular branch or PR like deployment or gollumn or issues?

Should we add an optional "job name regex" option to the trigger that only trigger a branch/tag/pr with that name?

@dclayton-godaddy
Copy link
Author

Ya, my thought was to allow for a full JSON filter. This would mean you could filter by branch as well, correct? Awesome you're working on that! Thanks

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

No branches or pull requests

6 participants