Capturing snapshots

In a software release process, the goal is to have a consistent deployment process that can be run often throughout the release life cycle. When the deployments are run in production, there are no unexpected results. Snapshots are used to implement these deployments.

A snapshot captures both the component versions and the process that were used for deployments. These snapshots make the deployments repeatable and stable.

CloudBees CD supports these types of snapshots:

  • Environment snapshot—An environment snapshot is created from an environment where the application or microservice is deployed and tested. A snapshot will capture the exact artifact or container versions, process versions, configuration parameters, and so on used for the deployment to ensure repeatability. This is considered the reliable version of a snapshot for reliability and repeatability.

  • Application or microservice snapshot—A snapshot is created directly from the application or microservice model and does not depend on any environment deployment. When a snapshot is captured from the application or microservice model, it locks the architecture, components, and process versions. If you specify the “Latest” artifact version as part of the component definition in the snapshot, the latest artifact versions will be used every time it is used for deployment. The main purpose of an application- or microservice-based snapshot is to allow the creation of user-defined versions of the models. The application or microservice snapshot name can be used to indicate a specific user-defined version.

For example, in a software delivery process, the developer checks in code, the components are built automatically by a continuous integration system, and the objects in the resulting build are published to a binary artifact management system. When the full complement of component artifacts is available, a release candidate pipeline is initiated. The first stage is to deploy to a development environment. From this deployment, a snapshot is created and used as the model for subsequent deployments to other environments.

There will be some differences between the development, QA and production environments, such as database connection strings, credentials, and debug-vs-production artifacts. CloudBees CD can manage these differences in the application or microservice model using parameters and properties in templates, only modifying the deployment process flow in a controlled manner.

The process described in the example avoids some of the pitfalls encountered in traditional release scenarios. For example, configuration teams often perform their own builds. This means that the binaries supplied by the CM team may be different than what has already been tested. Release teams may also manually edit configuration files to adjust for differences in the deployment environments. Both of these practices are prone to error and can negatively impact the quality of the final software release.

In CloudBees CD, you can deploy snapshots for more reliable and repeatable software releases. Here are some of the use cases snapshots can serve:

  • You can model and save a version of your software release with specific artifact versions and rerun it later, even if the latest release version of it has changed.

  • If you save snapshots during development and test phases, you can ensure that the components that were deployed and tested are the same as those in the release candidate. You can redeploy the snapshot any time.

  • You can create and save more than one snapshot for different deployment scenarios.

  • You can use an application or microservice snapshot to capture a version of the model. This can be used to define a future or desired state of the application or microservice model as well.

  • You can view the snapshots in the Snapshot List. From this list, you can manage all your snapshots, compare two snapshots, or get more information about them.

  • Comparing snapshots helps you to deploy releases with reliable and repeatable results during ongoing software release cycles. You can build and test releases using snapshots, and do not have to design new applications or microservices for each release. Comparing snapshots also allows you to compare a future or desired state of the application model to any saved version of the model. See Comparing Snapshots and Comparing Results for more information.

  • You can use snapshots to refine and optimize applications or microservices that fit your deployment scenario and ensure that this version is properly developed, tested, and released.

Example: Creating, Deploying, and Comparing Snapshots

This example shows how to create application, microservice, and environment snapshots, deploy snapshots, and compare them during the software release life cycle.

Creating Application Snapshots

  1. In the Applications List, choose an application and click the snapshot button.

  2. Select Snapshot List.

    The Snapshot List appears.

  3. To add a new snapshot, click There are no Snapshots. Add one +.

    The New Snapshot dialog box appears.

  4. Enter the name for the snapshot that must be unique within the application and enter an optional description of it.

    This name can be used to indicate the user defined version of the model. For example, in the figure below, see HeatClinic v1.2 .

    Application snapshots can be used for various purposes like creating a baseline version of the model or even for modeling a future state or desired state of the model.

  5. Click Next. The New/Preview dialog box opens.

  6. Toggle between the Component and App Process views to see the components and application processes for the selected application.

    In the Component view, change the version of the Config component to Latest.

  7. Click OK.

    A message appears stating that the snapshot has been created, and the snapshot list is updated.

Deploying Application Snapshots

  1. In the Applications List, choose an application and click the Run process button.

  2. Select New Run.

    The dialog box to select the settings for the application run opens.

  3. Select these settings for the application run:

    • In the Select Process field, select Run.

    • In the Select Environment field, select heatclinic-qe.

    • In the Select a Snapshot field, select HeatClinic v1.2.

      Clicking arrow next to Compare shows the comparison of the selected snapshot to last deployment of the Run process in the heatclinic-qe environment.
  4. To deploy the snapshot, click OK.

Creating Environment Snapshots

  1. Open an environment inventory from the Environments list.

  2. Choose an application, and click the button.

  3. Click New Snapshot. The New Snapshot dialog box opens.

  4. Enter the name and a description of the snapshot. Enter something like Heatclinic_QE2.

  5. Click Next. The New/Preview dialog box opens. You can view the snapshot settings in the Component and App Process tabs but cannot change them because the application has been deployed to the heatclinic-qe environment.

  6. Click OK.

Comparing Snapshots

This example shows how to compare an application snapshot to an environment snapshot.

  1. In the Snapshot list, select two snapshots that you want to compare and click the Compare button. The Snapshot Comparison page opens.

Comparing Results

In the Snapshot Comparison page, the Component and App Process views show the differences between the snapshots, Heatclinic v1.2 (the application snapshot) and Heatclinic_QE2 (the environment snapshot). Heatclinic_QE2 is the more reliable, repeatable, and up-to-date version of the application.

The Component view shows that the Config component is different. Heatclinic v1.2 uses the Latest version of the artifact that may not be the same as the artifact version in Heatclinic_QE2, the more reliable and repeatable version of the snapshots.

The App Process shows one difference. Heatclinic v1.2 has one less application process than Heatclinic_QE2.

Clicking the pull-down button next to the snapshot name allows you to select a different snapshot.