LinkedIn
Copied!

Table of Contents

Configuring Jenkins

Version:

Only available versions of this content are shown in the dropdown

If you are using a Jenkins task in your pipeline, configure Jenkins.

Do the following steps:

  1. On the orchestration server, create an authentication profile that uses Jenkins credentials.

    1. Click Create Security Authentication profile .

    1. Enter a name, and then click Create and open.

    2. In the User name field, enter the user name of the Jenkins user.

    3. Click Set password, enter the Jenkins password, and then click Submit.

    4. Click the Preemptive authentication check box.

    5. Click Save.

  2. Because the Jenkins task does not support Cross-Site Request Forgery (CSRF), disable it by completing the following steps:

    1. In Jenkins, click Manage Jenkins.

    2. Click Configure Global Security.

    3. In the CSRF Protection section, clear the Prevent Cross Site Request Forgery exploits check box.

    4. Click Save.

  3. Install the Post build task plug-in.

  4. Install the curl command on the Jenkins server.

  5. Create a new freestyle project.

  6. On the General tab, select the This project is parameterized check box.

  7. Add the BuildID and CallBackURL parameters.

    1. Click Add parameter, and then select String parameter.

    2. In the String field, enter BuildID.

    3. Click Add parameter, and then select String parameter.

    4. In the String field, enter CallBackURL.

  8. In the Build Triggers section, select the Trigger builds remotely check box.

  9. In the Authentication Token field, select the token that you want to use when you start Jenkins jobs remotely.

  10. In the Build Environment section, select the Use Secret text(s) or file(s) check box.

  11. In the Bindings section, do the following actions:

    1. Click Add, and then select User name and password (conjoined).

    2. In the Variable field, enter RMCREDENTIALS

    3. .In the Credentials field, click Specific credentials.

    4. Click Add, and then select Jenkins.

    5. In the Add credentials dialog box, in the Username field, enter the operator ID of the release manager operator that is configured on the orchestration server.

    6. In the Password field, enter the password.

    7. Click Save.

  12. Configure information in the Post-Build Actions section, depending on your operating system:

    • If Jenkins is running on Microsoft Windows, go to step 13.
    • If Jenkins is running on Linux, go to step 14.
  13. If Jenkins is running on Microsoft Windows, add the following post-build tasks:

    1. Click Add post-build action, and then select Post build task.

    2. In the Log text field, enter a unique string that for the message that is displayed in the build console output when a build fails, for example BUILD FAILURE.

    3. In the Script field, enter curl --user %RMCREDENTIALS% -H "Content-Type: application/json" -X POST --data "{\"jobName\":\"%JOB_NAME%\",\"buildNumber\":\"%BUILD_NUMBER%\",\"pyStatusValue\":\"FAIL\",\"pyID\":\"%BuildID%\"}" "%CallBackURL%".

    4. Click Add another task.

    5. In the Log text field, enter a unique string that for the message that is displayed in the build console output when a build is successful, for example BUILD SUCCESS.

    6. In the Script field, enter curl --user %RMCREDENTIALS% -H "Content-Type: application/json" -X POST --data "{\"jobName\":\"%JOB_NAME%\",\"buildNumber\":\"%BUILD_NUMBER%\",\"pyStatusValue\":\"SUCCESS\",\"pyID\":\"%BuildID%\"}" "%CallBackURL%"

    7. Click Save.

  14. If Jenkins is running on Linux, add the following post-build tasks. Use the dollar sign ($) instead of the percent sign (%) to access the environment variables:

    1. Click Add post-build action, and then select Post build task.

    2. In the Log text field, enter a unique string that for the message that is displayed in the build console output when a build fails, for example BUILD FAILURE.

    3. In the Script field, enter curl --user $RMCREDENTIALS -H "Content-Type: application/json" -X POST --data "{\"jobName\":\"$JOB_NAME\",\"buildNumber\":\"$BUILD_NUMBER\",\"pyStatusValue\":\"FAIL\",\"pyID\":\"$BuildID\"}" "$CallBackURL"

    4. Click Add another task.

    5. In the Log text field, enter a unique string that for the message that is displayed in the build console output when a build is successful, for example BUILD SUCCESS.

    6. In the Script field, enter curl --user $RMCREDENTIALS -H "Content-Type: application/json" -X POST --data "{\"jobName\":\"$JOB_NAME\",\"buildNumber\":\"$BUILD_NUMBER\",\"pyStatusValue\":\"SUCCESS\",\"pyID\":\"$BuildID\"}" "$CallBackURL"

    7. Click Save.

Did you find this content helpful?

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.