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.

  1. In the left navigator, click Project Administration Project Administration.
  2. Click Webhooks.
  3. Click + Create Webhook.
  4. From Type, select Hudson/Jenkins - Build Trigger.
  5. In Name, enter a unique name.
  6. In Build Server URL, enter the Jenkins base URL.

    If the Jenkins job URL is http://my_jenkins/path/job/my_job, then enter http://my_jenkins/path/.

  7. 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).
  8. In Job Name, enter the case sensitive name of the job on the target build server.
  9. 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
  10. In Trigger Event: Git Push, complete the following:
    1. Select the Git repository.
    2. 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)
    3. 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.

    4. 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.

    5. 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.

    6. 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>’

  11. Click Done.