7.3 KiB
7.3 KiB
SAP BTP CI/CD Reference
Overview
Continuous Integration (CI) and Continuous Delivery (CD) are complementary DevOps practices that automate application development, testing, and deployment on SAP BTP.
Core Concepts
Continuous Integration (CI)
- Frequent code integration into central repository
- Automated builds and tests on each commit
- Early error detection
- Prevents integration problems from accumulating
Continuous Delivery (CD)
- Extends CI with deployment automation
- Successfully tested changes ready for production
- Code built, tested, and packaged in deployable format
- Deploy at management's discretion
SAP Continuous Integration and Delivery
Service Type: BTP-native service with pre-configured pipelines
Advantages
| Feature | Benefit |
|---|---|
| Simplicity | Out-of-the-box pipelines, minimal configuration |
| Flexibility | Customizable pipelines, additional commands |
| Infrastructure | Built-in management, no server maintenance |
| SAP-Specific | Optimized for SAP technologies |
Supported Pipeline Types
| Pipeline | Use Case |
|---|---|
| Cloud Foundry Environment | SAP Fiori, CAP applications |
| SAP Fiori for ABAP Platform | Fiori apps on ABAP |
| SAP Integration Suite Artifacts | Integration content |
Setup Process
Step 1: Enable Service
- Open SAP BTP Cockpit
- Navigate to subaccount
- Enable "Continuous Integration & Delivery"
- Subscribe to the service
Step 2: Assign Roles
| Role | Permissions |
|---|---|
| Administrator | Full access, job management |
| Developer | Create/run jobs, view results |
Step 3: Configure Repository Credentials
Supported Repositories:
- GitHub
- GitLab
- Bitbucket
- Azure Repos
# Example credential configuration
credentials:
- name: github-credentials
type: basic
username: ${GITHUB_USER}
password: ${GITHUB_TOKEN}
Step 4: Create CI/CD Job
# .pipeline/config.yml for CAP application
general:
projectName: my-cap-app
buildTool: mta
stages:
Build:
mtaBuildParameters:
platform: cf
Additional Unit Tests:
npmExecuteScripts: true
npmScripts: ['test']
Release:
cloudFoundryDeploy: true
cfApiEndpoint: [https://api.cf.eu10.hana.ondemand.com](https://api.cf.eu10.hana.ondemand.com)
cfOrg: my-org
cfSpace: my-space
mtarFilePath: mta_archives/my-cap-app.mtar
Step 5: Configure Webhooks
Automate builds on push:
- Copy webhook URL from CI/CD service
- Add webhook in repository settings
- Select events (push, pull request)
Pipeline Configuration
CAP Node.js Pipeline
# .pipeline/config.yml
general:
buildTool: mta
stages:
Build:
mtaBuildParameters:
platform: cf
Additional Unit Tests:
npmExecuteScripts: true
npmScripts:
- test
Acceptance:
cfDeploy: true
cloudFoundryDeploy: true
cfApiEndpoint: [https://api.cf.eu10.hana.ondemand.com](https://api.cf.eu10.hana.ondemand.com)
cfOrg: my-org
cfSpace: dev
Release:
cfDeploy: true
cloudFoundryDeploy: true
cfApiEndpoint: [https://api.cf.eu10.hana.ondemand.com](https://api.cf.eu10.hana.ondemand.com)
cfOrg: my-org
cfSpace: prod
CAP Java Pipeline
general:
buildTool: mta
stages:
Build:
mtaBuildParameters:
platform: cf
mavenExecuteStaticCodeChecks: true
Additional Unit Tests:
mavenExecute: true
goals: ['test']
SAP Fiori Pipeline
general:
buildTool: npm
stages:
Build:
npmExecuteScripts: true
npmScripts: ['build']
Additional Unit Tests:
npmExecuteScripts: true
npmScripts: ['test']
karmaExecuteTests: true
ABAP CI/CD
gCTS Integration
# Pipeline for ABAP Cloud
stages:
Import:
abapEnvironmentPullGitRepo: true
repositoryName: my-software-component
Test:
abapEnvironmentRunATCCheck: true
atcConfig:
checkVariant: ABAP_CLOUD_DEVELOPMENT_DEFAULT
Release:
abapEnvironmentAssembleConfirm: true
ATC Integration
stages:
Quality:
abapEnvironmentRunATCCheck: true
atcConfig:
checkVariant: ABAP_CLOUD_DEVELOPMENT_DEFAULT
failOn: ERROR
priorityFilter:
- '1'
- '2'
Kyma CI/CD
Terraform Integration
# main.tf for Kyma provisioning
module "kyma" {
source = "github.com/SAP/terraform-module-kyma"
subaccount_id = var.subaccount_id
cluster_name = "my-kyma-cluster"
region = "eu-central-1"
}
Helm Deployment
stages:
Build:
containerBuild: true
dockerfilePath: Dockerfile
Deploy:
helmDeploy: true
helmValues:
- ./chart/values.yaml
kubeConfigPath: ${KUBECONFIG}
Security in CI/CD
Code Scanning
stages:
Security:
sonarQubeScan: true
sonarQubeConfig:
serverUrl: ${SONAR_URL}
projectKey: my-project
dependencyTrackUpload: true
fortifyScan: true
Secrets Management
# Using credentials
credentials:
- name: cf-credentials
type: usernamePassword
username: ${CF_USER}
password: ${CF_PASSWORD}
- name: hana-credentials
type: usernamePassword
username: ${HANA_USER}
password: ${HANA_PASSWORD}
Best Practices
Pipeline Design
- Keep pipelines fast (< 15 minutes ideal)
- Fail fast on critical issues
- Use parallel stages where possible
- Cache dependencies
Testing Strategy
stages:
Unit Tests:
# Fast, run on every commit
npmScripts: ['test:unit']
Integration Tests:
# Slower, run on PR merge
npmScripts: ['test:integration']
E2E Tests:
# Slowest, run before release
npmScripts: ['test:e2e']
Environment Strategy
| Environment | Trigger | Purpose |
|---|---|---|
| Development | Every push | Developer testing |
| QA | PR merge | QA testing |
| Staging | Release branch | Pre-production |
| Production | Manual approval | Live system |
Monitoring
Job Status
- View in CI/CD service UI
- Email notifications
- Webhook integrations
Metrics
- Build duration
- Success rate
- Test coverage
- Deployment frequency
Troubleshooting
| Issue | Cause | Solution |
|---|---|---|
| Build timeout | Long-running tests | Increase timeout, parallelize |
| Authentication failed | Expired credentials | Refresh tokens |
| Deployment failed | Resource quota | Check CF/Kyma limits |
| Test failures | Environment mismatch | Use consistent test data |
Learning Resources
| Resource | Description |
|---|---|
| "Exploring DevOps with SAP BTP" | SAP Learning course |
| "Efficient DevOps with SAP" | openSAP course |
| CI/CD Introduction Guide | Technical documentation |
Source Documentation
- CI/CD Overview: https://github.com/SAP-docs/btp-developer-guide/blob/main/docs/continuous-integration-and-delivery-ci-cd-fe74df5.md
- CI/CD Introduction: https://github.com/SAP-docs/btp-developer-guide/blob/main/docs/introducing-continuous-integration-and-delivery-ci-cd-8ee5353.md
- SAP CI/CD Service: https://help.sap.com/docs/continuous-integration-and-delivery