Setting Up Pipelines to Notify a Jenkins Webhook Enterprise
Using Flux's Notification Controller, a Jenkins Webhook can be invoked on Pipeline promotion events.
To enable external callers to trigger a build on a job, an additional "Generic Webhook Trigger" plugin is required as Jenkins does not have this functionality built-in.
After the plugin is installed a new "Generic Webhook Trigger" job configuration option is available.
The only mandatory field is the "Token". Without this token, Jenkins will not know which build should be triggered.
Post content parameters
To access fields from the pipeline event payload, each field has to be defined as a "Post content parameters".
An example Promotion Event payload:
"message": "Promote pipeline flux-system/podinfo-pipeline to prod with version 6.1.5",
Configure Notification Provider
In order to be able to invoke a generic webhook, a notification provider has to be defined. Jenkins expects the secret token which you configured above as a GET parameter or in the request header. The secret token can be stored in a Secret:
Now we can define a Notification Provider using this secret:
Set Up Alerts
We can configure an Alert to use the
jenkins-promotion provider. For example
an Alert for the
podinfo-pipeline in the
- kind: Pipeline