Jenkins Configuration

In Jenkins, enable the remote build triggers by selecting the Trigger builds remotely check box on the Configuration screen.

How to Construct Webhook URL?

While doing configurations for Build Triggers in the CI/CD tool, you can see the instruction given below the Authentication Token field to use the URL to trigger build remotely.

Normal Project

Parameterized Project

Normal Project

Parameterized Project

The following is an example of how to construct the Webhook URL for a normal project in Jenkins.

The URL suggested in Jenkins during the configuration of Build Triggers: JENKINS_URL/job/QTMCloud/build

If your Jenkins instance URL is http://qtm-qa-jenkins.qmetry.com:8080

Then the URL to trigger the build will be -

http://qtm-qa-jenkins.qmetry.com:8080/job/QTMCloud/build

→ The following is an example of how to construct the Webhook URL for a project with parameters in Jenkins.

The URL suggested in Jenkins during the configuration of Build Triggers:

JENKINS_URL/job/QTMCloud/buildWithParameters

If your Jenkins instance URL is http://qtm-qa-jenkins.qmetry.com:8080

Then the URL to trigger the build will be -

http://qtm-qa-jenkins.qmetry.com:8080/job/QTMCloud/buildWithParameters

Authorization

To supply the Authorization header with the value Basic <auth>, perform the following steps:

  1. Build a string of the form username:<api_token> using Jenkins credentials. Generate API Token in Jenkins from User Profile > Configure > API Token section.

  2. Encode the string in Base64 format.

    • If the API Token was generated in Jenkins using the "admin" account, to encode the string in Base64 format, use the string format as admin:<API_Token>.

    • Your string should look like "admin:1185c84ee2447df322af5ced7597bbad6b" when you're encoding to Base64 format. The encoded string corresponds to: YWRtaW46MTE4NWM4NGVlMjQ0N2RmMzIyYWY1Y2VkNzU5N2JiYWQ2Yg==.

image-20240212-120955.png
  1. Supply an "Authorization" header with the content "Basic " followed by the encoded string from Step 2.

    • For example, the string "admin" encodes to "YWRtaW46MTE4NWM4NGVlMjQ0N2RmMzIyYWY1Y2VkNzU5N2JiYWQ2Yg==" in base64. So the Basic <auth> value would be as follows.

Basic YWRtaW46MTE4NWM4NGVlMjQ0N2RmMzIyYWY1Y2VkNzU5N2JiYWQ2Yg==

image-20240212-121114.png