ServiceNow DevOps change request state in Jenkins pipeline logs
Summarize
Summary of ServiceNow DevOps change request state in Jenkins pipeline logs
This feature enables ServiceNow customers to monitor and display the state of change requests directly within Jenkins pipeline console logs. By integrating ServiceNow DevOps change state updates into Jenkins pipelines, developers gain real-time visibility into the progress and policy evaluations of change requests during CI/CD execution.
Show less
Key Features
- Jenkins Snippet Generator Integration: Use the Jenkins Snippet Generator to configure the
SnDevOpsChangestep, controlling how and when change state updates and policy decisions appear in pipeline logs. - Change State Variables: Customize key parameters in the snippet:
- Polling Interval: Frequency in seconds for Jenkins to poll ServiceNow and update change status in logs when specific change fields update (e.g., state, assignment group, approvals).
- Change Creation Timeout: Time limit for creating a change request; based on this, the pipeline can be aborted or resumed if creation fails.
- Abort on Change Creation Failure: Option to abort or resume pipeline if change request creation fails within timeout.
- Change Step Timeout: Time limit for a change step to complete; pipeline can abort or resume depending on this setting.
- Abort on Change Step Timeout: Controls whether the pipeline aborts or continues if the change step exceeds timeout.
- Real-time Console Logs: View change request details and state transitions directly in Jenkins logs, including:
- Change number, status, sysid, type, risk, priority
- Change state, planned start/end dates
- Direct URL to the change request in ServiceNow
- Policy Condition Logging: Logs include evaluations of DevOps change request policies (Minimal and Advanced Automation) and the resulting decisions such as auto-approve, auto-reject, or manual approval.
- Support for Base System Fields: Policy conditions using specified fields (e.g., code coverage, test results, risk, commits) and operators (e.g., <=, >=, !=) are automatically logged and evaluated. Custom fields require manual addition for evaluation.
- Error Handling: If a change request fails to create, the failure reason and state are logged in the Jenkins console for troubleshooting.
Practical Benefits for ServiceNow Customers
- Gain immediate visibility into change request statuses and policy decisions within Jenkins pipelines, improving collaboration between development and change management teams.
- Proactively manage pipeline execution based on change creation and step timeouts, reducing manual monitoring and errors.
- Leverage automated policy evaluations to enforce change governance and compliance during CI/CD workflows.
- Customize polling and timeout behaviors to fit organizational processes and pipeline requirements.
- Facilitate troubleshooting by capturing detailed logs when change requests fail to be created or updated.
You can use the Jenkins Snippet Generator utility to configure how and when the change state and the corresponding policy conditions must be displayed in the Jenkins pipeline job logs. This enables developers to view the status of the change in the console logs of the pipeline itself.
- Polling Interval: Specifies the frequency (in seconds) at which Jenkins polls ServiceNow for the change status and updates the console logs with the status. The change status is updated in the console logs
only when the Change state transitions, Assignment Group updates, Approval updates, Planned Start/End date, or Change
Details (if any) fields are updated.Note:If no value is entered in the field, polling interval check won’t be run to update the change status in the console logs.
- Change Creation Timeout: Specifies the change creation timeout value in seconds. On timeout, Jenkins checks the change creation status in ServiceNow. If the change did not get created, the pipeline is
resumed or aborted based on the Abort on change creation failure flag. By default, the pipeline is aborted when timeout is specified and the Abort on change creation failure flag is
selected.Note:If no value is entered in the field, change creation timeout check won’t be run to update the pipeline.
- Abort on change creation failure: Abort or resume the pipeline if change is not created till the change creation timeout.
- Selected: Abort
- Cleared: Resume
- Change Step Timeout: Specifies the change step timeout value in seconds. On timeout, Jenkins checks the change step status in ServiceNow. If the change step is still in progress, the pipeline is resumed or
aborted based on the Abort on change step timeout flag. By default, the pipeline aborted when timeout is specified, and the Abort on change step timeout flag is selected.Note:If no value is entered in the field, change step timeout check won’t be run to update the pipeline.
- Abort on change step timeout: Abort or resume the pipeline if the change step is still in progress on change step timeout.
- Selected: Abort
- Cleared: Resume
You can navigate to the console logs in your pipeline to view the state of a change request when a change request is created or when the state of the change request is updated. The policy conditions associated with the change request state will also be evaluated and displayed in the logs. For example, if the DevOps Change Request Advanced Automation policy is activated, the policy conditions will be evaluated and the corresponding decision made (auto-approve/auto-reject/manual-approval) will be displayed in the logs.
- number
- details
- status
- sys_id
- type
- risk
- priority
- changeState
- plannedStartDate
- plannedEndDate
- changeRequestURL
- DevOps Model Change Policy: Only logs will be displayed on change creation and when the change state is updated.
- DevOps Change Request Minimal Automation Policy: Logs along with change decision and policy conditions corresponding to the change decision will be displayed.
- DevOps Change Request Advanced Automation Policy: Logs along with change decision and policy conditions corresponding to the change decision will be displayed.
- Fields
- code_coverage
- commits_without_work_item
- integration_tests_failed
- load_tests_failed
- regression_tests_failed
- num_of_outages_in_last_7_days
- num_of_current_outages
- num_of_open_incidents
- total_num_of_commits
- tests_passing_percent
- risk
- code_security
- commits
- Operators
- <=
- >=
- !=
- =
- <
- >
- ISNOTEMPTY
- ISEMPTY
- BETWEEN
- ANYTHING
- NSAMEAS
- SAMEAS
- GT_FIELD
- LT_FIELD
If a change request does not get created due to any issue, then the reason for the failure and the state is also logged in the console.