Skip to Content
Technical Articles
Author's profile photo Siddarth Pugazhendi

Build and Deployment automation is possible in SAP Commerce Cloud now, want to know how?

Introduction

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.

Overview

Through this POC, I have experimented initiating a code build automatically in CCV2 when some 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 it is really done

The flow starts with the developer merging or pushing some code to the main branch in Bitbucket, which triggers a cloud function in Google Cloud Platform, that communicates with the SAP Commerce Cloud build platform through a series of API calls, that builds the code pushed to the main branch and deploys the build into the Commerce environment.

Let’s dive a little deeper

I have created a cloud function in Google cloud platform that uses an HTTP trigger. Then I have created a webhook in Bitbucket which triggers the cloud function when some code is pushed or merged into the main branch. 

Within the cloud function, there is logic to call createBuild REST API which notifies SAP Commerce Cloud Build Platform to pull the latest code from the main branch and trigger a code build and returns the build ID to the cloud function. Using the build ID got from the API response, the cloud function then checks if the build is completed using getBuild REST API. Based on the build completion response from the API, the cloud function then triggers a code deployment of the newly created build in SAP Commerce Cloud Build Platform using the createDeployment REST API.

Conclusion

In SAP Commerce Cloud Portal, the build and deployment have been a manual process so far. This POC automates this process through Continuous integration, delivery and deployment using the newly released Commerce Cloud build APIs. There are few downsides needing to call multiple APIs one to create build, another to check if the build is completed and the last one to create a deployment with the build, but if there was a single API which does all of these operations it would have been much more intuitive.

The next steps are to integrate this POC with slack (the communication channel I mainly use) 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.

Reference

Commerce Cloud API Documentation – SAP Help Portal

Documentation on how to authenticate to cloud API – API Tokens

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Manojkumar Jeganathan
      Manojkumar Jeganathan

      Thank you so much for sharing this information as POC. It really helped me a lot. But still I would like to clarify some of the doubts since you implemented build and deployment automation in SAP commerce cloud such as:

      1. How we can achieve parallel builds for each commit on feature branch before merging into mainline branch because we need to prevent the corruption of mainline branch and shouldn't merge the invalid code/build failed status into mainline branch right?
      2. Also I couldn't find this information on SAP documentation such as, if I create a build via cloud portal where the build is happening exactly? Is it on the environment? (or) On the cloud platform itself. Because we shouldn't perform any build on the respective environments as CI/CD best practices
      3. If we are implementing CI/CD on SAP commerce cloud with third party integration devops tools such as Jenkins, Gitlab, etc... Then can you confirm whether do we need build (or) CI server in-order to perform build, code quality, unit test, etc... on local environment rather than on cloud portal
      4. Is there any possibility to get SSH access on the environment to install third party software's such as jenkins agent, gitlab runner in-order to communicate with respective CI server
      5. Also we couldn't find what are the docker images are using behind build and deployment on SAP commerce cloud. So Is it possible to know the docker images in-order to reproduce it on our local machine (or) all developer machine
      6. How we can follow the same setup of build procedure from ccv2 on all the developer local machines? Is there any documentation that we need to follow in-order to set it up
      7. How we can integrate sonarqube (or) code quality check as a part of build procedure before we deploy into the environments

      I know I posted so many doubts but it would be nice to everyone if we get clarified it for better understanding

      Thank you

      Author's profile photo Shashi Annasagaram
      Shashi Annasagaram

      Hi Manoj,

      Did you get answers to the above questions that you posted ? I'm curious to know the solution to your ask...

      Thanks