oo

Restarting Jenkins Stages

The CI service can be configured to preserve Jenkins stashes. You can then use the stashes to restart specific stages in a Jenkins build.

Preserving Jenkins Stashes

Use the following CI service variables to determine the number of completed builds for which stashes and artifacts are preserved:

  • LCP_CI_PRESERVE_STASHES_BUILD_COUNT
  • LCP_CI_ARTIFACT_NUM_TO_KEEP

In this example, stashes are preserved for the last 3 builds, while artifacts are preserved for the last 6.

Use these variables to determine which artifacts are preserved.

By default, the LCP_CI_PRESERVE_STASHES_BUILD_COUNT value is set to 20, while the LCP_CI_ARTIFACT_NUM_TO_KEEP value is set to 1. If restarting stages isn’t important to you, then you can set their values to 0 to prevent CI from retaining either stashes or artifacts.

important

Stashes cannot be preserved for more builds than allowed by the LCP_CI_ARTIFACT_NUM_TO_KEEP variable, regardless of the number of builds set for the LCP_CI_PRESERVE_STASHES_BUILD_COUNT variable.

How to Restart a Jenkins Stage

Follow these steps to restart a Jenkins stage:

  1. Access your project’s CI service page (i.e., ci-<project>-infra.lfr.cloud), and click on the Open Blue Ocean plugin to view your project’s pipelines.

    note

    While pipelines stages can be restarted via the standard Jenkins console, the Open Blue Ocean plugin provides a clearer and more intuitive user experience when viewing or managing pipeline stages.

    Click on the Open Blue Ocean plugin to view your project's pipelines.

  2. Select the desired pipeline, and click on the desired build.

    Click on the build with the stage you want to restart.

  3. Select the desired stage, and click on Restart.

    Select the desired stage, and click on Restart.

    This initiates a new Jenkins run that begins with your selected stage and has the same PR and commit information as the run it is based on. A new description is automatically generated that identifies its preceding run, as well as the name of the restarted stage. You can quickly navigate back to the prior run using the breadcrumb button at the top left of the navigation bar.

    This runs a new build based on the build you selected.

Capability:
Deployment Approach: