Jenkins Plugins for PR events
Last updated
Last updated
You can use Generic Webhook Trigger plugin for triggering Jenkins builds on PR events and get the pr number from the payload it sends to trigger test runs from HyperTest CLI.
To achieve it, you will have to do the following
Send webooks to Jenkins webhooks trigger on pull request events from your codebase
Install Generic Webhook Plugin in Jenkins
Configure Plugin in your pipeline
Go to Webhooks
Add a new Webhook
Payload Url: Wehook trigger listens on /generic-webhook-trigger/invoke.
If you have any authentication on jenkins, pass it in webhook url like below http://<username>:<password>:@<jenkins_ip>:<jenkins_port>/generic-webhook-trigger/invoke
Content type: application/json
Add any secret if required
To trigger the webhooks on pull request events only, select let me select individual events and check pull requests
Save and add Webhook
Install Generic Webhook Plugin from Jenkins plugins page and restart Jenkins after the plugin is installed
Go to configure tab in your pipeline
Check the Generic Webhook plugin option under Build triggers
To fetch the pull request id, add the parameter in post content parameter Variable Name: pull_request_number Expression: $.pull_request.number
Add other envs/token or other settings if required and save
Now you access the parameter by $pull_request_number
Export HT_PR parameter inside your Jenkinsfile export HT_PR=$pull_request_number
Alternatively you can also control environment variables of Generic Webhook plugin from your Jenkinsfile like below, and add it in HT_PR in environment section
Install Generic Webhook Plugin from Jenkins plugins page and restart jenkins after the plugin is installed
1.Go to configure tab in your pipeline
2.Check the generic webhook plugin option under Build triggers
3.To fetch the pull request id, add the parameter in post content parameter Variable Name: pull_request_number Expression: $.pull_request.number
4.Add other envs/token or other settings if required and save
5.Now you access the parameter by $pull_request_number
6.Export HT_PR parameter inside your Jenkinsfile export HT_PR=$pull_request_number
Alternatively you can also control environment variables of Generic Webhook plugin from your Jenkinsfile like below, and add it in HT_PR in environment section
You can use Generic Webhook Trigger plugin for triggering Jenkins builds on PR events and get the pr number from the payload it sends to trigger test runs from HyperTest CLI.To achieve it, you will have to do the followingSend webooks to Jenkins webhooks trigger on pull request events from your codebaseInstall Generic Webhook Plugin in JenkinsConfigure Plugin in your pipelineSteps:1. Send Webhooks to JenkinsGo to WebhooksAdd a new WebhookPayload Url: Wehook trigger listens on /generic-webhook-trigger/invoke. If you have any authentication on jenkins, pass it in webhook url like below http://<username>:<password>:@<jenkins_ip>:<jenkins_port>/generic-webhook-trigger/invokeContent type: application/jsonAdd any secret if requiredTo trigger the webhooks on pull request events only, select let me select individual events and check pull requestsSave and add Webhook