Build and Deployment in SAP Commerce Cloud V2 – how it works

Table of Contents


SAP recently released Commerce Cloud build APIs for SAP Commerce Cloud V2 (CCV2) to trigger and track builds. So far the build and deployment process is manual in SAP Commerce Cloud through the Cloud Portal. I developed a Proof of Concept (PoC) to implement build automation in CCV2 using the above APIs.

SAP Commerce Cloud V2 Overview

Through this PoC, I experimented by automatically initiating a “code build” in CCV2 when the code is pushed/merged to the main branch, thus delivering the continuous integration feature missing in CCV2.
I further extended this by trying out continuous delivery and deployment.
I leveraged Cloud Functions from Google Cloud Platform to implement this PoC and most likely the same kind of implementation can be done in any CI/CD tool which we can call REST APIs.

How does SAP Commerce Cloud V2 (CCV2) work?

The flow starts with the developer merging or pushing some code to the main branch in Bitbucket. A cloud function triggers in Google Cloud Platform. Through a series of API calls, it communicates with the SAP Commerce Cloud build platform. The code build pushed to the main branch is then deployed into the Commerce environment.

SAP Commerce Cloud CCV2

Let’s dive a little deeper.

Let’s create a cloud function in the Google Cloud Platform that uses an HTTP trigger. A webhook in Bitbucket is made to trigger the cloud function when code merges into the main branch. 
Within the cloud function, there is logic to call createBuild REST API. SAP Commerce Cloud Build Platform gets an update to pull the latest code from the main branch. It also triggers a code build and returns the build ID to the cloud function. The cloud functions cross-check the build through the ID generated from API Response using getBuild REST API.
Based on the build completion response from the API, the cloud function triggers a code deployment of the created build using the createDeployment REST API.

SAP Commerce CCV2


In SAP Commerce Cloud Portal, the build and deployment have been a manual process so far. This PoC automates the process through continuous integration, delivery and deployment using the newly released Commerce Cloud build APIs. There are a few downsides though: calling multiple APIs to create a build, checking if the build is complete, and lastly, creating a deployment with the build. If a single API did all these operations, it would have much more intuitive.
The next steps are to integrate this PoC with slack to provide notifications on the build and deployment progress as this is something that is not available out of the box in the current SAP Commerce Cloud.

Commerce Cloud API Documentation – SAP Help Portal

Documentation on how to authenticate to cloud API – API Tokens

Share the article with your peers!