Build and Deployment in SAP Commerce Cloud V2 – How it works?
SAP has recently released Commerce Cloud build APIs for SAP Commerce Cloud V2 (CCV2) to trigger and track builds. So far the build and deployment process has been 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 have experimented by initiating a “code build” automatically in CCV2, when code is pushed/merged to the main branch, thus delivering the continuous integration feature which is missing in CCV2.
I further extended this by trying out continuous delivery and deployment.
I have leveraged Cloud Functions from Google Cloud Platform to implement this PoC, most likely the same kind of implementation can be done in any CI/CD tools which can call REST APIs.
How SAP Commerce Cloud V2 (CCV2) works?
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.
Let’s dive a little deeper:
Let’s create a cloud function in 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. Also, it 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.
In SAP Commerce Cloud Portal, the build and deployment have been a manual process so far. This P0C automates the process through Continuous integration, delivery and deployment using the newly released Commerce Cloud build APIs. There are few downsides though.
Calling multiple APIs to create a build, checking if the build complete, last, to create a deployment with the build. If there was a single API doing 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.
Connect with FAIR today and get the latest tips and tricks on improving your CX tools and eCommerce platforms. Once you subscribe you will get access to workshops, webinars, recent projects and so much more.