Example: Automating service requests for running a deployment job by using Jenkins
The following video (2:25) explains how to automate a user request for running a deployment job:
Before you begin
Make sure that you create a deployment job in Jenkins. For more information, see Automating-triggering-of-Jenkins-jobs.
Task 1: To create a Jenkins connector configuration
- Log in to BMC Helix Digital Workplace Catalog.
- On the Services tab, click Connectors.
- Select Jenkins, click Actions, and click Open.
Update the following fields:
Name
Description
URL
URL of the Jenkins server.
User
Username to log in to the Jenkins server.
Important: The user must have permissions to run the Jenkins jobs.Password
Password to log in to the Jenkins server.
Alternatively, you can use the API token in your Jenkins user profile configuration as the password.Trust All Certificates
If you want to trust your certificates, specify the value as True, else do not specify any value
- Click Save.
Task 2: To define the Deploy Instance service
- Log in to BMC Helix Digital Workplace Catalog.
- On the Services tab, click Services.
The service BMC Sample Deploy Instance <version> is displayed in the Service Management console. - Select the service, click Actions, and click Edit Service Name.
- Update the service name, and click Save.
For example, Deploy Instance.
Task 3: To define Deploy Instance service workflow
- In BMC Helix Digital Workplace Catalog, in the Service Management console, select the Deploy Instance service.
- Click Actions and click Open.
- In the Service Options pane, click Edit corresponding to the Workflow option.
In the Workflow and Questions pane, in the Workflow section, click Edit.
The following workflow is displayed in the Workflow designer:The following elements are used in the workflow:
Element
Label
Description
Create Document
Job input parameters
Accesses the attributes within the schema of the JenkinsParameters document definition.
You must specify the document node values as they are used as input to run the Jenkins job.Run Jenkins job
Run Jenkins job
Triggers a Jenkins job.
You must specify the deployment job that you want to run in the element properties.Get Queue Item
Get Queue Item
Retrieves the ID of an item in a Jenkins queue.
Exclusive
NA
Checks if the queue item is retrieved.
Receive Task
Wait for the queue item
Waits for the queue item to be retrieved.
Timer
NA
Interrupts a wait step after time out.
Get Jenkins Job Build
Get Jenkins job result
Retrieves the build details of a Jenkins job.
Exclusive
NA
Checks if the Jenkins job is to be completed.
Receive Task
Wait for the job result
Adds wait steps in the workflow and waits for Jenkins job completion.
Timer
NA
Interrupts a wait step after time out.
Send User Message
Send Message
Sends job results to the service requester through an email.
- If required, update the workflow input variables.
The following input variables are available:
You must map these input variables to the service questionnaire so that the user responses to service questions are used as variable values. - Select the Send User Message element in the workflow and update the Outgoing Profile Source and Outgoing Email Profile properties.
- Save the changes.
Task 4: To define the Deploy Instance service questionnaire
- In BMC Helix Digital Workplace Catalog, in the Service Management console, select the Deploy Instance service.
- Click Actions, and click Open.
- In the Service Options pane, click Edit corresponding to the Workflow option.
- In the Workflow and Questions pane, in the Questions section, click Edit.
The following questions are displayed in the Questions Designer:Question
Description
VM Name
The value specifies the name of the virtual machine. Users can specify the virtual machine name where they want to perform the deployment.
Deploy BMC Helix Digital Workplace Catalog
The value specifies the product name to deploy. Users can specify the value as true and update the product name based on your deployment job.
Deploy BMC Helix Business Workflows
The value specifies the product name to deploy. Users can specify the value as true and update the product name based on your deployment job.
Deploy Approval
The value specifies the product name to deploy. Users can specify the value as true and update the product name based on your deployment job.
- If you have added additional input variables in the workflow to receive inputs from the service requester, add questions corresponding to the variables.
- Save the changes.
Task 5: To publish the Deploy Instance service
- In BMC Helix Digital Workplace Catalog, in the Service Management console, select the Deploy Instance service.
- In the Service Options pane, click , and click Publish.
After you publish the service, the service is available to users.
Task 6: To test the Deploy Instance service
- Log in to BMC Helix Digital Workplace Advanced.
- Submit a deployment request by using the Deploy Instance service.
- Verify that you have received an email about deployment completion.
Result
The Deploy Jenkins service is available for the users. Users can submit deployment requests by using this service and their requests are processed automatically.