- Using Visual Builder Studio
- Maximize the Power of Your Project
- Send Notifications to External Software Using Webhooks
- Jenkins
- Create a Hudson/Jenkins - Build Trigger Webhook to Trigger a Jenkins Job on an Update to a Git Repository
- Configure a Hudson/Jenkins Build Trigger Webhook
Configure a Hudson/Jenkins Build Trigger Webhook
Before you create the webhook, make sure that you've installed the required plugins and have the token required to access Jenkins through the webhook.
- In the left navigator, click Project Administration .
- Click Webhooks.
- Click + Create Webhook.
- From Type, select Hudson/Jenkins - Build Trigger.
- In Name, enter a unique name.
- In Build Server URL, enter the Jenkins base URL.
If the Jenkins job URL is
http://my_jenkins/path/job/my_job
, then enterhttp://my_jenkins/path/
. - If you provided an HTTPS URL in Build Server URL, select the Ignore SSL Errors check box to ignore SSL errors if Jenkins uses a self-signed certificate (or an invalid one).
- In Job Name, enter the case sensitive name of the job on the target build server.
- From Build Server Security, select the Jenkins security
schema and enter the required details:
Security Option Fill in these fields Anonymous Access Under Authentication, in Remote Build Token, enter the Jenkins authentication token, similar to what is shown in this example: API Token Access Under Authentication, enter the authenticated user's details:
-
In User ID, enter the username of the Jenkins user.
-
In API Token, enter the API token of the Jenkins user.
-
In Remote Build Token, enter the Jenkins authentication token, similar to what is shown in this example:
Build Token Root Plugin Under Authentication, in Remote Build Token, enter the Jenkins authentication token, similar to what is shown in this example: No Security NA -
- In Trigger Event: Git Push, complete the
following:
- Select the Git repository.
- Specify what to follow: All branches/tags (pushes to any branch or tag), Branch (pushes to one specific branch), or Tag (forced updates of one specific tag)
- If you specified Branch or
Tag in the previous step, select the branch
or tag to be followed.
In the filter, you can either select from the branch(es) or tag(s) displayed or use a regular expression to make a more complex selection (a range or ranges, perhaps) that involves multiple items that match a pattern. See Glob Pattern Reference for Matching Branch, Job, and Pipeline Names for detailed information about the syntax for regular expressions.
- Set up the directory filter.
Click Add directory to specify a directory or list of directories to watch for changes.
The directory or list of repository directories act as an additional filter for triggering the webhook only when changes are detected in at least one directory or in at least one of its subdirectories. Each directory path needs to be relative to the repository root and be specified using Unix-like slash ("/") separators.
- Enable the Parametrized Build toggle if the
build job on the target server accepts parameters. (The target URL is
different for parametrized and non-parametrized builds.)
If Parametrized Build is enabled, you can add build parameters using Add Parameter. For each parameter, set the name that must match the parameter name defined on the build server side.
- Verify the URL displayed in Target URL.Use cURL with HTTPS GET and the Target URL to check your configuration:
curl -X GET '<Target_URL>’
- Click Done.