Cloud Foundry Deployment Using CI/CD Pipeline

Cloud Foundry Deployment Using CI/CD Pipeline

Fri 04 Jul 2025

Introduction

In this blog, I’ll walk, you through how to set up a CI/CD pipeline to automate the deployment of an SAP CAP (Cloud Application Programming) application to Cloud Foundry, using tools like GitHub Actions / Jenkins/ Azure DevOps/ or GitLab CI (based on your choice of tooling). Whether you're just getting started or looking to optimize your current pipeline, this guide will help you build a robust CI/CD process tailored for SAP BTP environments.

In the world of enterprise application development, automation is key to achieving faster delivery cycles, reduced manual errors, and consistent deployments. SAP Cloud Application Programming (CAP) model provides a powerful framework for developing full-stack, cloud-native applications. Combining CAP with a robust CI/CD pipeline allows for seamless deployment to SAP Business Technology Platform (BTP) using Cloud Foundry.

Prerequisites

  • Installed Visual Studio Code or SAP Business Application Studio
  • You have prepared your application for deployment in SAP BTP, Cloud Foundry runtime. (example: CAP Application)
  • GitHub / GitLab / Jenkins (CI tool of your choice in our case we are going to use GitHub)
  • Access to SAP BTP account with Cloud Foundry environment enabled.
  • Subscription to CI/CD pipeline.

Subscribing to the CI/CD Service in SAP BTP Cockpit

Step-by-Step Guide

1. Navigate to Your Subaccount

  • Log in to the SAP BTP Cockpit
  • Click on subaccount that you are working on

2. Enable the CI/CD Service

  • Go to the Service Marketplace
  • Search for "CI/CD" or "Continuous Integration and Delivery"

  • Click on the tile, then click "Create".

3. Assign Role Collections

To access and configure the CI/CD dashboard:

  • Go to Security → users
  • Select the user it opens Role Collections which are assigned to the selected user

  • Click on Assign Role Collection

  • Assign the following roles to your user
    •  CI/CD Service Administrator
    •  CI/CD Service Developer

4. Access the CI/CD Dashboard

  • After subscription, go to Instances and Subscriptions
  • Click the link under the CI/CD service – this will launch the SAP Continuous Integration and Delivery dashboard

  • It opens the CI/CD application in another browser window like

Now you are subscribed to CI/CD service, and you are ready to consume it. Let's configure the CI/CD with our project.

To be able to perform the steps for setting up a CI/CD pipeline, you will need a public repository. Currently, SAP Continuous Integration and Delivery supports GitHub and Bitbucket repositories.

In this example, we’ll be creating a repository on GitHub. You’ll need an GitHub account for this step. Go ahead and create one if you don’t have it yet.

 

  1. Create a new GitHub repository in your GitHub account.

  1. Under Repository name, enter Employee_CAP.
  2. Choose Create repository.
  3. Now you can see screen like below

  1. Now initialize the git hub repository in you project directory.
  2. Navigate to your CAP project and open terminal.
  3. And give the below git commands in sequence
    1. git init
    2. git add .
    3. git commit -m “Any Text”
    4. git branch -m main
    5. git remote add origin
    6. git push -u origin main
  4. Now you configured git hub repository.

CI/CD Configuration:

  1. Navigate to your CI/CD application
  2. Choose the Credentials tab and choose the icon to add a new credential.

  1. Under Create Credentials on the right:
    1. Enter github in the Credential Name field.
    2. Choose Basic Authentication from the dropdown in the Type field.
    3. Enter your GitHub user name in the Username field.
    4. Enter your GitHub password in the Password field.
    5. Choose Create.

  1. Choose the icon to add a new credential again and create a credential for Cloud Foundry.
  • Enter cloudfoundry in the Credential Name field.
  • Choose Basic Authentication from the dropdown in the Type field.
  • Enter your SAP BTP global username in the Username field.
  • Enter your SAP BTP global password in the Password field.
  • Choose Create.

Add a CI/CD job (for Node.js project)

  • Navigate to the Jobs tab and choose the icon to add a new job.
  • Enter employee_CAP in the Job Name field.

  • Open the value help for the Repository field.

  • In the Select Repository popup, choose Add Repository. A popup opens.

In the Add Repository popup, enter details for the repository you created in Step 1: Create a repository:

  • Enter employee_CAP in the Name field.
  • Enter your repository’s URL in the Clone URL field.
  • Open the value help in the Credentials field and choose the credential github that you created in previous Step
  • Select githubcred from the dropdown in the Type field.

In the Create Credentials popup:

  • Enter webhook in the Credentials Name field.
  • Click Generate next to the Secret field to create a secret.
  • Copy the generated secret from the Secret field and save it. You’ll need it later.
  • Choose Create.

  • Back in the Add Repository popup, choose Add to complete the addition of a repository.

Configure pipeline and stages

  1. Back in the General Information tab, enter main in the Branch field.
  2. Select Cloud Foundry Environment from the dropdown in the Pipeline field.

  1. In the Stages section, select mta from the dropdown in the Build Tool field.
  2. Select the latest Java and Node version from the dropdown in the Build Tool Version field.

Add unit tests and configure release

  1. In the Additional Unit Tests section, switch the toggle button to ON.
  2. Enter test in the npm Script field.  

  1. In the Release section, switch the toggle Deploy to Cloud Foundry Space to ON.
  2. Provide the required information for your account and complete the job creation:
    • Enter the URL of your API endpoint in the API Endpoint field.
    • Enter the name of your Cloud Foundry organisation in the Org Name field.
    • Enter the name of your development space in the Space field.

You can get the values from your subaccount’s Overview page in the SAP BTP cockpit.

    • Select standard from the dropdown in the Deploy Type field.
    • Open the value help in the Credentials field and choose the credential cloud foundry that you created in the previous step.

    • Choose Create.

Create a GitHub webhook

  1. Navigate to the Repositories tab and choose the employee_CAP repository that you created. Under the Webhook Event Receiver tab, Go to Webhook Data section.
  2. In the Webhook Data section, find the Payload URL field and copy its value.

  1. Go to your repository on GitHub and open the Settings tab.
  2. From the navigation pane on the left, choose Webhooks → Add webhook.

 

Insert the data for your webhook:

  1. Paste the employee_CAP repository’s payload URL that you copied from the Webhook Data section in the Payload URL field.
  2. Select application/json from the dropdown in the Content type field.
  3. Paste the secret you created in Add a CI/CD job section (previously you copied) in the Secret field.
  4. Under Which events would you like to trigger this webhook, select Just the push event.
  5. Choose Add webhook.

 

Test your job

Note:   Make sure your project contains mta.ymal file If it is not there, usethe  command cds add mta
              Also, perform these commands before going to further steps:

  • npm install
  • npm install @sap/xssec
  • cds add xsuaa
  1. You have to trigger your job manually the first time after creation. Go back to the SAP Continuous Integration and Delivery application and navigate to the Jobs tab.
  2. From next every push to the main branch triggers this job automatically and deploys to cloud foundry.
  3. Choose the employee_CAP job and choose Run.

  1. Verify that a new tile appears in the Builds view. This tile should be marked as running.
  2. Wait until the job has finished and verify that the build tile is marked as successful.
  3. After Successful deployment you can see you application in the SAP BTP Cockpit.

Caution

  • While entering the data or copy pasting any url make sure there will be no space added it leads to mis configuration and leads to job failure.

 

 


Author: Administrator

Fri 04 Jul 2025

Category: SAP BTP
Comments: 0
Views: 265

There are no comments yet.

1000

Categories

Recent Blogs

Cloud Foundry Deployment Using CI/CD Pipeline
Category : SAP BTP
Fri 04 Jul 2025
0 Comments
SAP CAP Application Development
Category : SAP BTP
Fri 04 Jul 2025
1 Comments
Custom Headlines for Report (SE38)
Category : SAP ABAP
Mon 30 Jun 2025
0 Comments