Managing Build and Deployment Processes

Objective

After completing this lesson, you will be able to acquire the skills in creating and deploying build assets using Cloud Portal

The Build and Deployment Processes

We have acquired knowledge on defining a manifest.json file to configure the SAP Commerce Cloud build process. Now, let's explore how the manifest.json file is used in the build and deployment process.

The Development Phase

This picture shows the steps taken in the development stage, including the developer’s custom implementation, and the setup of a related manifest.json file.

During the development phase:

  1. Developers push custom extension code and configurations to the Git based code repository.
  2. Meanwhile, implementation is carried out on the manifest.json file to make references to:
    • 2a: The custom extension code and configurations which contain the business-specific implementation
    • 2b: Various SAP Commerce Cloud extensions, such as the cloud hot folder extension or media conversion extension, among others.

The Build Phase

This image outlines the critical processes occurring during the build phase.
  1. The System Administrator uses the Cloud Portal UI to initiate a build.

    A build refers to all artifacts produced by the Builder component according to the application definition found in the manifest.json file within the Git repository.

  2. The build retrieves custom extension code and SAP Commerce Cloud extensions based on the manifest.json, compiles them to generate security-hardened Docker images on top of a base image.
  3. Following a successful build, the system registers the generated images in a container registry.

You can monitor the build progress and review the steps on the build details page of the Cloud Portal.

The image displays the progression of a build on the build page, which also offers an option to download the build log file.

A build can exist in the following four stages:

  • After a system administrator creates a new build, it assumes a Scheduled state. This implies that it is queued for scheduling by the Cloud Automation Engine and accessed by multiple SAP customers within the same data center. Depending on the existing workload and the capacity of this Cloud Automation Engine, the build may take a few seconds or minutes to start.
  • When in the Building state, the Builder Component retrieves the project code from the Git repository and compiles it.
  • If the build concludes successfully, it transitions to the Success state, indicating readiness for deployment to a cloud environment.
  • However, if any part of the build process goes wrong, the build assumes a Failed state.

Note: Upon completion of a build (irrespective of whether it is successful or not), you may download the build log file (see the previous image) from the build page:

  • For successful builds, there's no need to read the log file, which could contain thousands of lines of detailed information, unless you wish to thoroughly analyze the build process.
  • For builds that have failed, it's necessary to study the log file using a text editor and navigate to the bottom to uncover any error or exception information. This should provide a general understanding of what occurred during the build and why it failed. There are numerous reasons a build might fail, such as:
    • Outdated Commerce Cloud versions that are no longer supported.
    • Inaccessibility of customer Git repositories by the Cloud Automation Engine.
    • Code-level issues like syntax errors or missing dependencies.

Finally, a successful build can be deployed to a cloud environment. Next, let's examine the deployment phase.

The Deployment Phase

The image outlines the essential steps involved in the deployment phase.

As depicted in the diagram:

  1. Through the Cloud Portal UI, a system administrator can deploy a successful build to a cloud environment.
  2. Subsequently, the Deployer component is activated by the deployment request. It retrieves the Docker images from the container registry and places them onto the Kubernetes cluster nodes.
  3. Ultimately, Docker containers are produced from these images, which are then operated on the cluster nodes (for example, the customized SAP Commerce Cloud Application in the S1 environment).

To initiate a deployment, simply select a successful build, go to the build details page, and then select theDeploy to Environment button located at the top right.

This image illustrates the button on a build page that can navigate to the deployment configuration page.

On the deployment configuration page, you're ready to deploy the selected build. Ensure you set the values for the following three elements:

This image highlights the necessary fields that need to be filled out before deploying a build on the deployment configuration page.
  1. Target Environment

    The selected build is intended for deployment in the target environment. This could be the Development, Staging, or Production environment.

  2. Platform Update Mode

    The Platform Update Mode indicates which item types or data changes are incorporated in the current build. Its possible values include:

    • No migration required: Implies no modifications to the type system (items.xml) or data (impex) are included. Therefore, the build only incorporates changes to the code and configuration files.
    • Migrate data: Suggests that changes to the type system or item data are included. Therefore, deployment requires updates to the type system or existing item data in the database.
    • Initialize database: Is typically used for the initial deployment and indicates that the database schema must be completely rebuilt from the ground up.
  3. Deployment Mode

    Deployment Mode outlines how to apply the current build to the Kubernetes cluster:

    • Rolling Update: Is typically used for Production environments and involves deploying the build to the cluster one server at a time. Therefore, the entire cluster remains operational, with at least one server available to handle live traffic.
    • Recreate: Is commonly used for initial deployments to Production environments or regular deployments to Development or Staging environments. It involves deploying the build to all the servers in the cluster simultaneously. Consequently, all existing servers in the cluster are destroyed and recreated from the build. This means the cluster is entirely non-operational and cannot service traffic during deployment.
    • Blue/Green: The blue/green deployment function adds a layer of protection to future deployments (green) by offering a preview in production prior to its official launch to customers. More details can be found in the Blue Green Deployments | Help Portal.

Creating and Deploying a Build - Demo

We've covered a lot of theory regarding the build and deployment processes, but we haven't had a chance to see the creation of a new build and its deployment to an environment. Let's proceed to the demonstration video to examine these steps:

Congratulations, you've now learned how to use the Cloud Portal UI to manage the build and deployment processes. However, note that there are two additional methods available:

  1. SAP Commerce Cloud automation/build APIs: This is a set of RESTful webservices APIs that allow you to access and manage key operations of the automation engine, such as retrieval of environment information, build management, and deployment management. For more in-depth information, please refer to the SAP Commerce Cloud API Documentation on the Help Portal.
  2. SAP Commerce Cloud Command Line Interface: This command line tool, which can be directly downloaded as a ZIP file, facilitates build and deployment actions outside of the Cloud Portal. For additional details, please view the Commerce Cloud Command Line Interface Help Portal page.

Log in to track your progress & complete quizzes