Configuring Jenkins
Version:
If you are using a Jenkins task in your pipeline, configure Jenkins.
Do the following steps:
-
On the orchestration server, create an authentication profile that uses Jenkins credentials.
-
Click
.
-
Enter a name, and then click Create and open.
-
In the User name field, enter the user name of the Jenkins user.
-
Click Set password, enter the Jenkins password, and then click Submit.
-
Click the Preemptive authentication check box.
-
Click Save.
-
-
Because the Jenkins task does not support Cross-Site Request Forgery (CSRF), disable it by completing the following steps:
-
In Jenkins, click Manage Jenkins.
-
Click Configure Global Security.
-
In the CSRF Protection section, clear the Prevent Cross Site Request Forgery exploits check box.
-
Click Save.
-
Install the Post build task plug-in.
Install the curl command on the Jenkins server.
Create a new freestyle project.
-
On the General tab, select the This project is parameterized check box.
-
Add the BuildID and CallBackURL parameters.
-
Click Add parameter, and then select String parameter.
-
In the String field, enter BuildID.
-
Click Add parameter, and then select String parameter.
-
In the String field, enter CallBackURL.
-
-
In the Build Triggers section, select the Trigger builds remotely check box.
-
In the Authentication Token field, select the token that you want to use when you start Jenkins jobs remotely.
-
In the Build Environment section, select the Use Secret text(s) or file(s) check box.
-
In the Bindings section, do the following actions:
-
Click Add, and then select User name and password (conjoined).
-
In the Variable field, enter RMCREDENTIALS
-
.In the Credentials field, click Specific credentials.
-
Click Add, and then select Jenkins.
-
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.
-
In the Password field, enter the password.
-
Click Save.
-
-
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.
-
If Jenkins is running on Microsoft Windows, add the following post-build tasks:
-
Click Add post-build action, and then select Post build task.
-
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.
-
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%".
-
Click Add another task.
-
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.
-
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%"
-
Click Save.
-
-
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:
-
Click Add post-build action, and then select Post build task.
-
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.
-
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"
-
Click Add another task.
-
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.
-
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"
-
Click Save.
-