Connect SAP Continuous Integration and Delivery with Your Corporate Git
- How to set up SAP Continuous Integration and Delivery
- How to connect SAP Continuous Integration and Delivery with your corporate Git using SAP Connectivity service
- How to create and trigger a basic SAP Continuous Integration and Delivery job
Prerequisites
- You have an account on SAP Business Technology Platform. See Trial Accounts or Enterprise Accounts.
- You’re an administrator of your global account and Org Manager of your subaccount on SAP Business Technology Platform. See About Roles in the Cloud Foundry Environment.
- You’ve installed the Cloud Connector of the SAP Connectivity service. See SAP BTP Connectivity > Installation.
- You have an SAP Fiori project in the Cloud Foundry environment in a public Git repository in your corporate network, which is not directly accessible from the Internet.
- Step 1
Enable SAP Continuous Integration and Delivery, add the required permissions, and access the service.
-
In your subaccount in the SAP BTP cockpit, choose Services → Service Marketplace.
-
Search for
Continuous Integration & Delivery
and choose the appearing service tile.Note: If in the Service Marketplace, you can’t see the Continuous Integration & Delivery tile, you might need to add the required entitlements to your subaccount. See Configure Entitlements and Quotas from Your Global Account.
-
Choose Create.
-
In the New Instance or Subscription pop-up, select the Subscription plan and choose Create.
-
From the navigation pane, choose Security → Users.
Note: If you use an enterprise account, you need to be a User & Role Administrator of your subaccount to view the Security section. See Managing Subaccounts Using the Cockpit.
-
Choose the name of your user.
-
From the Role Collections section, choose … → Assign Role Collection.
-
From the dropdown list, select CICD Service Administrator and CICD Service Developer. Confirm your choice with Assign Role Collection.
-
Navigate back to your subaccount overview and from the navigation pane, choose Services → Service Marketplace.
-
Search for
Continuous Integration & Delivery
and choose the appearing service tile. -
Choose Go to Application.
As a result, the user interface of the SAP Continuous Integration and Delivery service opens.
-
- Step 2
Add your SAP BTP subaccount to the SAP Cloud Connector.
-
In the SAP Cloud Connector, choose Connector → Add Subaccount.
Note: If you haven’t added a subaccount to the Cloud Connector yet, the procedure is slightly different. In this case, you start at Define Subaccount and fill in the First Subaccount form. The required values, however, are the same.
-
In the Add Subaccount pop-up, enter the following information:
Note: You can find all information about your subaccount in your subaccount overview in the SAP BTP cockpit.
- Region: Enter the region in which your subaccount resides. To find the correct region, compare your API endpoint with Regions.
- Subaccount: Enter the ID of your subaccount.
- Display Name: Freely choose a name for your subaccount.
- Subaccount User: Enter the e-mail address that relates to your subaccount.
- Password: Enter the password for your subaccount.
- Location ID: Freely choose a location ID for your subaccount. You’ll need this ID for the connection with SAP Continuous Integration and Delivery.
- Description: Optionally, enter a description for your subaccount.
-
Choose Save.
-
- Step 3
In the SAP Connectivity service, add a system mapping and a resource.
-
From the navigation pane in the SAP Connectivity service, choose the display name of your subaccount → Cloud To On-Premise.
-
To map a new system, choose + (Add).
-
In the Add System Mapping pop-up, select Non-SAP System as Back-end Type and choose Next.
-
From the drop-down list, select the protocol of your on-premise Git server, and choose Next.
-
Enter your internal host and port, and choose Next.
-
For Virtual Host, enter
my-git
, and for Virtual Port, enter1080
.Thereby, you’ll create a virtual host that can be reached through
http://my-git:1080
. The virtual host is also needed to configure CI/CD jobs in SAP Continuous Integration and Delivery.Note: Even though the virtual host uses HTTP, the connection for the actual data transfer between the cloud connector and SAP Continuous Integration and Delivery is encrypted (HTTPS).
-
Choose Next.
-
As Principal Type, select None, and choose Next.
-
For Host In Request Header, select Use Internal Host, and choose Next.
-
Optionally, enter a description and choose Next.
-
In the summary, select Check Internal Host, and choose Finish.
-
Make sure that your new mapping is selected, and in the Resources Of my-git:1080 area, choose + (Add).
-
In the Add Resource pop-up, enter the path to your repository, for example
user/repository
out ofhttp://my-corporate-git/user/repository
. -
Select Active and Path And All Sub-Paths, and choose Save.
-
- Step 4
In SAP Continuous Integration and Delivery, configure credentials for your cloud connector and add your Git repository.
-
In SAP Continuous Integration and Delivery, go to the Credentials tab and choose + (Create credentials).
-
In the Create Credentials pop-up, enter the following values:
- Name: Freely choose a unique name for your credential. Only use lowercase letters, numbers, and hyphens, and a maximum of 253 characters.
- Description: Enter a meaningful description for your credential.
- Type: From the drop-down list, choose Cloud Connector.
- Location ID: Enter the location ID of your cloud connector. You can find it in the SAP BTP cockpit under Connectivity → Cloud Connectors.
-
Choose Create.
-
Switch to the Repositories tab and choose + (Add repository).
-
In the Add Repository pop-up, enter the following values:
- Name: Freely choose a unique name for your repository. We recommend using a name that refers to the actual repository in your source code management system.
- Clone URL: Enter a composition of the virtual host you’ve created in step 3.6 and the path of the resource you’ve created in step 3.13, for example
http://my-git:1080/user/repository
. Please make sure that you use the virtual host instead of the real host name and port of your on-premise system. - Credentials: If your repository isn’t private, leave this field empty.
- Cloud Connector: From the drop-down list, choose your Cloud Connector credential.
-
- Step 5
Configure a webhook between your GitHub repository and SAP Continuous Integration and Delivery to automate the builds of your job.
A webhook with GitHub allows you to automate SAP Continuous Integration and Delivery builds: Whenever you push changes to your GitHub repository, a webhook push event is sent to the service to trigger a build of the connected job.
The following graphic illustrates this flow:
-
In the WEBHOOK EVENT RECEIVER section of the Add Repository pane, choose GitHub as Type from the drop-down list.
-
In the Webhook Credential drop-down list, choose Create Credentials.
-
In the Create Credentials pop-up, enter a name for your credential, which is unique in your SAP BTP subaccount, for example
webhook
. -
Choose Generate next to Secret to generate a random token string.
Caution: Note down the secret as you won’t be able to see it again.
-
Choose Create.
-
Choose Add.
-
In the Repositories tab in SAP Continuous Integration and Delivery, choose your repository.
-
In your repository pane, choose … → Webhook Data.
As a result, the Webhook Creation pop-up opens.
-
In your project in GitHub, go to the Settings tab.
-
From the navigation pane, choose Webhooks.
-
Choose Add webhook.
-
Enter the Payload URL, Content type, and Secret from the Webhook Creation pop-up in SAP Continuous Integration and Delivery. For all other settings, leave the default values.
-
Choose Add webhook.
What's the purpose of configuring a webhook between your repository and SAP Continuous Integration and Delivery?
-
- Step 6
Configure a basic job for SAP Fiori projects in the Cloud Foundry environment.
-
In SAP Continuous Integration and Delivery, go to the Jobs tab and choose + (Create job).
-
In the General Information section of the Create Job pane, enter the following values:
- Job Name: Freely choose a unique name for your job.
- Repository: From the drop-down list, choose your repository.
- Branch: Enter the branch of your repository for which you want to configure your CI/CD job, for example,
main
. - Pipeline: From the drop-down list, choose SAP Fiori in the Cloud Foundry environment.
- Version: If you create a new job, the latest version is selected by default.
- State: To enable your job, choose ON.
-
In the Build Retention section, keep the default values.
-
In the Stages section, choose Job Editor as Configuration Mode.
-
For the Build stage, keep the default values.
-
For the Acceptance stage, enter the following values for the Deploy to Cloud Foundry Space step:
- Application Name: Enter a unique application name.
- API Endpoint: Enter the URL of your SAP BTP, Cloud Foundry API Endpoint. You can find it in the overview of your subaccount in the SAP BTP cockpit, under the Cloud Foundry Environment: tab.
- Org Name: Enter the name of your Cloud Foundry organization. You can also find it in the overview of your subaccount.
- Space: Enter the name of the Cloud Foundry space in which you want to test your application.
- Credentials: From the drop-down list, choose the SAP BTP credentials you created.
-
Switch all other stages off and choose Create.
Note: As this tutorial focuses on how to get started with SAP Continuous Integration and Delivery, we’ve decided to configure only a very basic CI/CD pipeline in it. For how to configure more elaborate ones, see Supported Pipelines.
-
To run your CI/CD pipeline, create and commit a code change in your GitHub project.
As a result, a build of the connected job is triggered and a new build tile appears in the Builds section of your job. If you choose it, the Build Stages view opens and you can watch the individual stages of your build run through.
Note: The pipeline run might take a few minutes.
-