Restarting failed build or release pipeline jobs and stages
Summarize
Summary of Restarting failed build or release pipeline jobs and stages
This functionality enables ServiceNow customers to rerun or redeploy failed or canceled Azure DevOps build and release pipelines, jobs, or stages within the same pipeline execution. This rerun capability improves efficiency by displaying reattempts as continuous runs on the DevOps pipeline UI, avoiding the creation of new pipeline executions.
Show less
Key Features
- Rerun Options: Customers can rerun entire pipelines or specific failed/canceled jobs and stages directly in ServiceNow DevOps.
- Change Request Reuse: When rerunning change-enabled jobs, you can choose to reuse the existing change request if it is in the implement or post-implement states, or create a new one. This decision is managed by the base system ‘DevOps Change Request Reusability Decision Subflow’, which can be customized to fit specific workflows.
- Attempt Tracking: An
attemptNumberparameter is included in the payload to track reruns, and it must be correctly configured in the Azure Invoke REST API payload for build and release pipelines. This ensures all related data such as test summaries, software quality scan results, commits, and work items are updated for each rerun. - Pipeline UI Enhancements: The DevOps pipeline UI now shows rerun attempts as continuous runs. Users can view the latest attempt details by clicking on a stage card and access all previous attempts through the “View all attempts” link. The “View change” link displays the change request related to the latest attempt.
- Customizable Flows: Two subflows, ‘DevOps Change Request Reusability Decision Subflow’ and ‘DevOps Change Request Reusability Model Subflow’, enable customization of change request reuse logic and state updates during reruns.
Practical Considerations for Customers
- Ensure the
attemptNumberparameter is included in build and release pipeline payloads when using the Azure Invoke REST API to enable accurate rerun tracking. - Avoid using existing started and completed notifications for stage jobs as this interferes with rerun functionality.
- Leverage the default or customized change request reuse subflows to maintain consistency with your change management policies when rerunning jobs.
- Utilize the enhanced DevOps pipeline UI to monitor rerun attempts and associated change requests, improving transparency and control over pipeline executions.
Key Outcomes
By using this rerun capability, ServiceNow customers can reduce pipeline execution clutter, maintain continuity in change requests, and ensure all test and quality data are properly updated with each rerun attempt. This functionality streamlines managing failed builds or releases, increases operational efficiency, and provides clear visibility into pipeline retry activities within the ServiceNow DevOps environment.
Rerun or redeploy Azure DevOps build, release changes, or pipelines that are failed or canceled in that stage or pipeline. The reattempts display on the DevOps pipeline UI as continuous runs instead of creating new executions.
Rerun Azure DevOps pipelines or stages
You can rerun a failed or canceled build or release pipelines or change jobs in Azure DevOps. The reruns are processed as part of the same pipeline execution as the first run in ServiceNow DevOps. You can rerun entire pipelines or specific failed or canceled jobs and stages. You can now choose to reuse a change request instead of creating a new change request each time you restart a stage or a pipeline.
An attemptNumber parameter is added to the payload which helps us track reruns. Associated test summary, software quality scan results, commits, work items corresponding to every rerun attempt is also updated in ServiceNow DevOps.
If you are using the Configuring change control using the Azure Invoke REST API you must add the attempt number parameter to your payload body in the specified syntax format for build and release pipelines. If you do not specify the attempt number parameter, the default attempt number is set to 1.
"attemptNumber": "$(system.jobAttempt)"Example attempt number
parameter in the release pipeline
payload:"attemptNumber": "$(Release.AttemptNumber)"
Reusing Change Requests
If a change enabled job is rerun, and a change request exists for the previous run/attempt, you can choose to reuse the previous change request or create a new change request, using the base system ‘DevOps Change Request Reusability Decision Subflow’. The default implementation of this subflow, allows you to reuse a change request from the previous attempt if the change request is in implement, or post-implement states. If the Change request is in any other state, by default, a new change request is created when you rerun the job. Per existing behavior, all associated details such as test summaries, and scans, are newly generated while commits and work items are retained unchanged for new change requests.
For example, when a pipeline fails at a specific stage after the change request is approved, and you rerun that stage. The change request is reused, the associated test summary and software quality scans, and the commits and work items associated to the artifact are associated with the same change request which you approved.
To apply a custom logic for reusability, you can copy the existing subflow, make the changes, publish it, and update the new subflow name under .
In the regular base system flow when a change is created, ‘ Customizing DevOps flows’ is used to update the State field of step execution record after a decision is taken on the change request. However, when you reuse a change, the first trigger condition of a change request being created is not met. A base system subflow ‘DevOps Change Request Reusability Model Subflow’ is triggered instead, whenever a change request is reused when a job is a rerun. The default implementation of this subflow is similar to the DevOps Model Change Request flow. You can create a custom subflow and update the subflow name at .
Pipeline UI changes
- Click a card to view the latest attempt of that stage.
- Click the View all attempts link to see all the step executions and related information associated to the step or stage that is run more than once.
- The View change link displays the change request associated with the latest attempt.