rht-labs / labs-ci-cd

👻UNMAINTAINED - A collection of Red Hat Open Innovation Labs CI/CD components
Apache License 2.0
101 stars 70 forks source link

Webhooks for PR Builds #247

Open pcarney8 opened 5 years ago

pcarney8 commented 5 years ago

Our Jenkinsfile needs to be kicked off and get information from the GitHub PR Webhook: https://developer.github.com/v3/activity/events/types/#pullrequestevent

Currently that is not supported in OCP for multibranch or github specific webhooks. It appears that using a generic webhook is possible, but would require something to translate it: https://github.com/openshift/origin/issues/13970#issuecomment-298276316 their reasoning here: https://github.com/openshift/origin/issues/15455#issuecomment-318159076

The other option is to go directly to Jenkins and use something like this: https://github.com/jenkinsci/generic-webhook-trigger-plugin/

mcanoy commented 5 years ago

they way we handled it with hf was to with an app that took accepted the webhook and update / invoked the PR / MR pipeline config.

There is also this card in trello that is getting a bit stale https://trello.com/c/ucGKOKnt/1158-5-support-folders-organization-folders-and-multibranch-pipelines-pipelineintegration-evg

pcarney8 commented 5 years ago

@mcanoy cool, sounds the "translate it" solution. Hmm yeah that was moved to devtools candidates in July it looks like.

Have you tried the generic-webhook-trigger-plugin with GH webhooks? i haven't tried that yet, but it looked promising.

mcanoy commented 5 years ago

I haven't tried it. Looks interesting but seems like there still has to be something in the middle to get the ref or commit value set, right? I am assuming if that was changed to the value we wanted - the pr - then it will build that instead of the ref that is in the pipeline bc.

git:
  uri: "<url to git repository>"
  ref: "<optional git reference>"
  commit: "<commit hash identifying a specific git commit>"
  author:
    name: "<author name>"
    email: "<author e-mail>"
  committer:
    name: "<committer name>"
    email: "<committer e-mail>"
  message: "<commit message>"
env: 
   - name: "<variable name>"
     value: "<variable value>"