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

Not compatible with the "Trigger builds remotely" configuration option #290

Closed raychinov closed 9 months ago

raychinov commented 10 months ago

When I enable Trigger builds remotely (e.g., from scripts) configuration in a Pipeline Jenkins job, Jenkins responses with HTTP 404 and:

{"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... "}

With no other changes, when disable the Trigger builds remotely config, the webhook trigger works as expected.

tomasbjerre commented 10 months ago

Here is the logic: https://github.com/jenkinsci/generic-webhook-trigger-plugin/blob/8d66d67dd7f4e7035bc5a8428c601e6f8e648b2f/src/main/java/org/jenkinsci/plugins/gwt/jobfinder/JobFinder.java#L108

So if you leave the token-field empty in the plugin configuration, and keep a token-value in Trigger builds remotely, it should work if you supply the token-value from Trigger builds remotely.

The first version of this plugin did not have its own token-field. It was added in #63 in 2018, perhaps it is time to simplify this code and just rely on the token-field from this plugin.

tomasbjerre commented 9 months ago

Support for BuildAuthorizationToken is dropped now in 2.0.0. The token used by this plugin now must be configured in the plugin config.