Connect a Git repository, write .pipeline/config.yml with multi-environment stages, and gate production with manual approval.
Deploying from a developer's laptop is fragile — it depends on local tool versions, CF login state, and network reliability. A proper CI/CD pipeline runs builds in a clean environment, runs tests before deploying, and deploys to multiple environments in sequence. SAP Build Code's CI/CD service is a first-class BTP product that integrates natively with Cloud Foundry and Git, so you don't have to manage Jenkins infrastructure yourself.
| Feature | Detail |
|---|---|
| Predefined pipeline stages | Init, Build, Test, Compliance, Deploy |
| SAP-curated Docker images | Pre-installed with mbt, CF CLI, node, java |
| Git integration | GitHub, GitLab, Bitbucket, Azure DevOps |
| Credential store | Encrypted secrets (CF login, service keys) |
| Blue-green deploy support | Native integration with MTA CF Plugin |
| Audit log | Full run history with logs per stage |
main).pipeline/config.ymlAdd this file to the root of your repository:
# .pipeline/config.yml
general:
buildTool: mta
service:
name: my-cap-app
stages:
Build:
mtaBuildTool: cloudMbt # use mbt from the SAP Build Code image
Unit-Tests:
run: true
npmRunScript: test
Lint:
run: true
npmRunScript: lint
Integration-Tests:
run: false # enable when you have integration tests
Deploy-to-Dev:
cfTargets:
- apiEndpoint: 'https://api.cf.eu10.hana.ondemand.com'
org: my-company-dev
space: dev
credentialsId: cf-dev-credentials
mtaDeployParameters: '-f'
Deploy-to-Test:
cfTargets:
- apiEndpoint: 'https://api.cf.eu10.hana.ondemand.com'
org: my-company-test
space: test
credentialsId: cf-test-credentials
mtaDeployParameters: '-f'
runTests: true
Deploy-to-Prod:
cfTargets:
- apiEndpoint: 'https://api.cf.eu10.hana.ondemand.com'
org: my-company-prod
space: production
credentialsId: cf-prod-credentials
mtaDeployParameters: '--strategy blue-green'
manualConfirmation: true # human gate before prod deploy
In CI/CD Service → Credentials → Add:
- Type: Basic Authentication
- Name: cf-prod-credentials
- Username: technical user email
- Password: technical user password
The pipeline uses these credentials for cf login — they are never exposed in pipeline logs.
The pipeline triggers automatically on push to the configured branch. You can also trigger manually from the CI/CD UI.
Pipeline stages run in order:
Init → Build → Unit-Tests → Lint → Deploy-to-Dev → Deploy-to-Test → [Approval] → Deploy-to-Prod
If any stage fails, the pipeline stops and notifies you via email (configurable).
If your team already uses GitHub Actions, you can replicate the same flow:
# .github/workflows/deploy.yml
name: Deploy CAP App
on:
push:
branches: [main]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/devcontainers/base:ubuntu
steps:
- uses: actions/checkout@v4
- name: Install tools
run: |
npm install -g mbt
wget -q "https://packages.cloudfoundry.org/stable?release=linux64-binary&version=v8&source=github" -O /tmp/cf.tgz
tar -xzf /tmp/cf.tgz -C /usr/local/bin
cf install-plugin multiapps -f
- name: Build MTA
run: mbt build -t ./
- name: CF Login
run: |
cf api ${{ vars.CF_API }}
cf auth "${{ secrets.CF_USER }}" "${{ secrets.CF_PASSWORD }}"
cf target -o "${{ vars.CF_ORG }}" -s "${{ vars.CF_SPACE }}"
- name: Deploy
run: cf deploy *.mtar -f
Store CF_USER and CF_PASSWORD in GitHub Secrets, org/space/API in Variables.
| Mistake | Fix |
|---|---|
| Committing CF credentials to the repo | Use CI secrets / credential store |
| No test stage before deploy | Tests must run before any CF deploy |
| Deploying directly to prod on every push | Gate prod deploys with manual approval |
| Using personal user accounts as CI credentials | Create a technical CF user with minimal roles |
| No rollback step | Document the rollback command and who can run it |
You can connect a Git repository to SAP Build Code CI/CD, write a .pipeline/config.yml with build, test, and multi-environment deploy stages, add CF credentials securely, and gate production deployments with a manual approval step.