jenkinsci / generic-webhook-trigger-plugin

Can receive any HTTP request, extract any values from JSON or XML and trigger a job with those values available as variables. Works with GitHub, GitLab, Bitbucket, Jira and many more.
https://plugins.jenkins.io/generic-webhook-trigger
410 stars 162 forks source link

Generic Webhook trigger plugin and webhook configuration #299

Closed elipesatya closed 8 months ago

elipesatya commented 8 months ago

Jenkins and plugins versions report

Hi

I need some help with the below issue regarding setting up "Generic webhook trigger" plugin and corresponding Github web hook.

My web-hook URL is: "https://*inkins.corp.***deley.com/generic-webhook-trigger/invoke?token=abcd" And that gives me "404 Response", with the below text:


{"jobs":null,"message":"Did not find any jobs with GenericTrigger configured! If you are using a token, you need to pass it like ...trigger/invoke?token=TOKENHERE. If you are not using a token, you need to authenticate like http://user:passsword@example.org/generic-webhook... "}"

Attached are the pics of my job configuration with "Generic trigger" configured " and the webhook:
![Screenshot 2024-03-16 at 15 27 12](https://github.com/jenkinsci/generic-webhook-trigger-plugin/assets/64086286/66bb0c0d-6131-40cf-a4fc-1ee59e482fb7)
![Screenshot 2024-03-16 at 15 27 38](https://github.com/jenkinsci/generic-webhook-trigger-plugin/assets/64086286/54ca8f9a-ddaf-4abd-adc3-072c443ffcab)
![Screenshot 2024-03-16 at 15 27 54](https://github.com/jenkinsci/generic-webhook-trigger-plugin/assets/64086286/9a470216-33cc-423d-af89-5f0e3008e4db)
![Screenshot 2024-03-16 at 15 28 09](https://github.com/jenkinsci/generic-webhook-trigger-plugin/assets/64086286/f470d7f2-cd88-4ada-a9fb-37eea0594923)
![Screenshot 2024-03-16 at 15 29 05](https://github.com/jenkinsci/generic-webhook-trigger-plugin/assets/64086286/25606970-baad-4ecd-b0cd-297a83fc0ef0)

Few more details:
Jenkins version: 2.449
Generic trigger plugin version: 2.0.0

Pipeline section for fetching the branch from ref is attached here:
![Screenshot 2024-03-16 at 16 54 14](https://github.com/jenkinsci/generic-webhook-trigger-plugin/assets/64086286/8a3c3951-7e95-4a3e-b7f3-a2abd2635da9)

Console output is attached here:
![Screenshot 2024-03-16 at 16 56 45](https://github.com/jenkinsci/generic-webhook-trigger-plugin/assets/64086286/d0f0431b-4f90-4cb2-81d4-1533b0cde65b)

So, job is falling onto the default branch value (coming from the inputs params as job is parameterized). 

Goal is to fetch the feature branch dynamically from the webhook payload / "ref" content and checkout that branch and perform some actions, but since my webhook throws 404 the payload wasn't receiving the jenkins. 

Im sure that I may be doing something wrong somewhere, but can't trace it out. 
Any help would be really appreciated. 

Many thanks
Satya
tomasbjerre commented 8 months ago

It might be that you are supplying wrong credential.

The error means that this plugin did not trigger any job.

It also looks like you are using some GitHub plugin. I would suggest creating a new job that:

elipesatya commented 8 months ago

Thank you @tomasbjerre Yes, creating a fresh job only with required fields works.

Wonder, whats the best way to create the recorder for the plugin please ? I use this logger "org.jenkinsci.plugins.gwt.GenericWebhookTrigger" but doesn't seem to work, is there a specific one ?

Many thanks Satya

tomasbjerre commented 8 months ago

Not sure what you mean with "recorder". Sounds unrelated to this issue.