SAP Commerce
SAP Commerce Cloud CI/CD Pipeline: Setup and Best Practices

A team deploying SAP Commerce Cloud once a month is not being cautious. It is accumulating risk. Large, infrequent deployments carry more changes, more potential conflicts, and more pressure when something goes wrong. In contrast, teams deploying multiple times per week ship smaller changesets, catch issues earlier, and build confidence in their release process.
Getting to frequent, reliable deployments in SAP Commerce Cloud requires a well-designed CI/CD pipeline. This is more complex than in typical web applications because of SAP Commerce’s build system, type system migrations, and the interplay between code and data (ImpEx). This guide covers the pipeline design, tooling, and operational practices that make continuous delivery practical for SAP Commerce projects.
Why CI/CD Matters More for SAP Commerce
SAP Commerce projects have characteristics that make CI/CD both harder and more important than in typical applications.
Long build times. A full SAP Commerce build (compiling all extensions, running the platform build) can take 15-30 minutes. Without pipeline optimization, developers wait too long for feedback.
Type system migrations. Changes to items.xml files require database schema updates (system update). If two developers modify the type system in conflicting ways, the conflict is only visible at system update time, not at compile time.
Data-code coupling. SAP Commerce relies heavily on ImpEx for data setup, content, and configuration. Code changes often require corresponding data changes, and the two must deploy together in the right order.
Environment complexity. CCv2 provides multiple managed environments (dev, staging, production) with specific characteristics around scaling, data, and connectivity. The pipeline must manage builds and deployments across these environments.
These factors mean that ad-hoc deployment processes break down faster in SAP Commerce than in simpler applications. Investing in CI/CD infrastructure pays dividends throughout the project lifecycle.
SAP Commerce Cloud Build System Overview
Understanding how CCv2 builds work is prerequisite to designing a good pipeline.
The Build Process
When you trigger a build in CCv2:
- The platform pulls your source code from the configured repository (the
repositorysection ofmanifest.json). - It resolves and downloads the SAP Commerce platform artifact and any configured AddOns or third-party libraries.
- It runs the Ant build process, compiling all extensions declared in
manifest.json(which generateslocalextensions.xmlat build time). - It packages the result into a Docker image that will be deployed to Kubernetes pods.
The build configuration lives in manifest.json, which specifies the commerce version, extensions, aspects (storefront, backoffice, backgroundProcessing), AddOns, properties, and web tests.
Build Triggers
CCv2 builds can be triggered through the Cloud Portal UI, the CCv2 REST API, or the SAP Commerce Cloud CLI tool. For CI/CD, the REST API or CLI tool is the integration point. Your CI pipeline triggers a CCv2 build, polls for completion, and then triggers a deployment to the target environment.
Build Limitations
CCv2 has build concurrency limits (typically one or two concurrent builds per subscription). This means you cannot run parallel builds for multiple branches simultaneously without queuing. Factor this into your pipeline design: feature branch builds may need to queue behind each other.
Source Code Management Strategy
Branching Model
For SAP Commerce projects, a simplified Git Flow works well:
main (or master) – always deployable. Represents the current production state. Protected with required reviews and passing CI checks.
develop – integration branch where feature branches merge. Represents the next release candidate. Deployed to the development environment automatically.
feature/* – short-lived branches for individual features or stories. Branch from develop, merge back via pull request.
release/* – created from develop when a release is being prepared. Only bug fixes and release-specific configuration changes go here. Merges to both main and develop upon release.
hotfix/* – created from main for urgent production fixes. Merges back to both main and develop.
The key discipline: keep feature branches short-lived (days, not weeks). Long-lived feature branches diverge from develop, and the merge becomes risky, especially when type system changes are involved.
Monorepo vs. Multi-repo
SAP Commerce projects typically work best as a monorepo containing all custom extensions, storefront code, configuration, and ImpEx scripts. A monorepo ensures that code changes and their corresponding data changes are committed atomically. Multi-repo setups (separate repos for backend and frontend, or per-extension repos) create coordination overhead that is rarely justified.
If you are using Composable Storefront (headless), the frontend deserves its own repository with its own pipeline, since it deploys independently. The backend SAP Commerce code remains in a monorepo.
Type System Change Discipline
Changes to items.xml files are the most dangerous changes in SAP Commerce. They alter the database schema and can cause data loss if done incorrectly. Establish these rules:
- Never remove an attribute from
items.xmlwithout a migration plan for existing data. - Never change an attribute type (e.g., from String to Integer) on an existing attribute. Create a new attribute and migrate data.
- Review all
items.xmlchanges with heightened scrutiny in pull requests. - Test type system changes by running
ant updatesystemin CI against a database with realistic data.
Build Automation Pipeline
Pipeline Stages
A well-structured SAP Commerce CI/CD pipeline has these stages:
Stage 1: Code Quality (runs in CI, 2-5 minutes)
- Compilation check –
ant clean allin a local CI runner (not CCv2) to verify the code compiles. This is faster than waiting for a CCv2 build. - Static analysis – SonarQube or similar tools scanning for code quality issues, security vulnerabilities, and coding standard violations.
- Dependency check – verify no unauthorized or vulnerable third-party libraries have been introduced.
This stage runs on every push to any branch and provides fast feedback to developers.
Stage 2: Automated Tests (runs in CI, 10-20 minutes)
- Unit tests – standard JUnit tests for service-layer logic, populators, strategies, and utility classes.
- Integration tests – tests that require the SAP Commerce application context (Spring context, type system). These use
ServicelayerTestorServicelayerTransactionalTestas base classes. - API tests – tests against the OCC API endpoints, verifying request/response contracts.
More on testing strategy below.
Stage 3: CCv2 Build (triggered after merge to develop/release/main, 15-30 minutes)
- Trigger CCv2 build via the REST API or CLI.
- Poll for build completion.
- Verify build success.
- Store build code for deployment.
Stage 4: Deployment (automated to dev/staging, gated for production)
- Trigger deployment of the build to the target environment.
- Run post-deployment health checks.
- Execute smoke tests.
- Notify the team of deployment status.
Stage 5: Post-Deployment Validation
- Run end-to-end tests against the deployed environment.
- Verify critical business flows (search, browse, add to cart, checkout).
- Check monitoring dashboards for anomalies.
Pipeline Tooling
Most SAP Commerce teams use one of:
- Jenkins – widely used in enterprise SAP environments, highly configurable, requires maintenance.
- GitLab CI – good integration with GitLab repositories, YAML-based pipeline configuration.
- Azure DevOps – natural fit if your CCv2 subscription uses Azure infrastructure.
- GitHub Actions – increasingly popular, good for teams already on GitHub.
The choice of CI tool matters less than the pipeline design. Any of these tools can implement the stages described above.
Automated Testing Layers
Testing SAP Commerce applications effectively requires a layered approach, because different types of problems are caught at different levels.
Unit Tests
Unit tests for SAP Commerce code should follow standard Java unit testing practices:
- Mock dependencies using Mockito or similar frameworks.
- Test service-layer classes, populators, converters, strategies, and interceptors in isolation.
- Focus on business logic, edge cases, and error handling.
- Aim for fast execution (the full unit test suite should run in under 5 minutes).
The SAP Commerce-specific challenge: much of the business logic lives in services that depend on ModelService, FlexibleSearchService, and other platform services. Use constructor injection (not field injection with @Resource) to make these dependencies mockable.
Integration Tests
SAP Commerce integration tests run within the platform’s Spring context and can access the type system, database, and platform services. They are essential for testing:
- Flexible Search queries – verify that custom queries return correct results with realistic data.
- Interceptors – validate, prepare, and remove interceptors that fire on model lifecycle events.
- Type system behavior – verify that custom types, relations, and enums behave as expected.
- ImpEx imports – verify that ImpEx scripts execute without errors.
Integration tests are slower than unit tests (they require platform bootstrap) but catch a class of bugs that unit tests cannot: Flexible Search syntax errors, missing Spring bean definitions, and type system misconfigurations.
API Tests
For headless projects, API testing is critical. We have had excellent results using the Karate framework for SAP Commerce OCC API testing. Karate’s advantages for this use case:
- Readable syntax – non-developers (QA, business analysts) can understand and contribute to test scenarios.
- Built-in assertions – JSON path matching, schema validation, and response code assertions without boilerplate.
- Data-driven testing – parameterize tests with different products, customers, and scenarios.
- Performance testing – Karate’s Gatling integration allows reusing functional tests as performance tests.
Write API tests for every custom OCC endpoint and for critical standard flows (product search, cart operations, checkout). These tests serve double duty as regression tests and API documentation.
UI Tests
For projects using Composable Storefront, end-to-end UI tests using Cypress or Playwright verify the full stack. Keep these tests focused on critical paths:
- Search and navigation
- Product detail page rendering
- Add to cart and cart management
- Checkout flow (guest and registered)
- Account management (login, registration, order history)
UI tests are inherently slower and more brittle than lower-level tests. Maintain a small, focused suite rather than attempting to cover every page.
Environment Management in CCv2
Environment Topology
A standard CCv2 subscription includes:
- Development (d1) – lower resources, used for development team testing. Automatically deployed from the
developbranch. - Staging (s1) – production-like resources, used for pre-release validation. Deployed from
release/*branches. - Production (p1) – live environment. Deployed from
mainafter staging validation.
Some subscriptions include additional environments. Use them for dedicated performance testing or UAT (User Acceptance Testing).
Data Management Across Environments
One of the hardest CI/CD challenges in SAP Commerce is managing data across environments. Production data drifts from staging data over time as business users create content, promotions, and catalog changes.
Strategies:
- Regular data refreshes – periodically copy production data to staging. CCv2 provides data backup and restore capabilities. This ensures staging reflects real-world data volumes and content.
- Idempotent ImpEx – write ImpEx scripts that can be run multiple times without error. Use
UPDATEwith[unique=true]rather thanINSERT. UseINSERT_UPDATEwhen appropriate. - Environment-specific properties – use
manifest.jsonproperty overrides or environment-specific property files for configuration that differs between environments (API endpoints, feature flags, integration credentials).
Deployment Strategies
Standard CCv2 Deployment
CCv2 deployments follow a rolling update pattern:
- New pods are started with the new build.
- Health checks verify the new pods are ready.
- Traffic is gradually shifted to new pods.
- Old pods are terminated.
During deployment, both old and new versions handle traffic simultaneously for a brief period. Ensure your code handles this gracefully: database schema changes must be backward-compatible with the previous code version.
Database Migrations and System Update
The ant updatesystem step (which applies type system changes to the database) runs during deployment. This is a critical phase:
- Schema changes are applied (new tables, new columns, altered columns).
- Essential data and project data ImpEx scripts run.
- Content and sample data may run depending on configuration.
For large databases, type system changes can take significant time. Adding an index to a table with millions of rows may lock the table for minutes. Plan these changes carefully and communicate expected deployment duration to stakeholders.
Hotfix Procedures
When production issues require an urgent fix:
- Create a
hotfix/*branch frommain. - Implement and test the fix.
- Run the CI pipeline (abbreviated if time-critical, but never skip automated tests entirely).
- Trigger a CCv2 build and deploy to staging for verification.
- Deploy to production.
- Merge the hotfix branch back to both
mainanddevelop.
Define the hotfix process before you need it. A documented, rehearsed procedure avoids panic-driven mistakes.
ImpEx Management in CI/CD
ImpEx files are a major source of deployment failures. Establishing conventions around ImpEx management prevents many issues.
Categorization
Organize ImpEx files by their purpose and execution context:
- Essential data – required for the system to function (user groups, basic configuration, workflow templates). Runs on every system update.
- Project data – business data that is part of the codebase (site configuration, content pages, CMS components). Runs on every system update.
- Sample data – data for development and testing only. Never runs in production.
- Migration scripts – one-time data migrations (renaming attributes, moving data between types). Run once and then removed or disabled.
Idempotency
Every ImpEx script that runs on system update must be idempotent. Running it twice should produce the same result as running it once. This means:
- Use
INSERT_UPDATEinstead ofINSERTfor data that might already exist. - Use
REMOVEcarefully, check that the item exists before attempting removal. - Use conditional logic (
#% if:) for environment-specific data. - Test ImpEx scripts by running them twice in a row in your local environment.
Ordering
ImpEx execution order matters. CMS components must be created before the content slots that reference them. Products must exist before stock levels reference them. In SAP Commerce, execution order is controlled by file naming conventions: files prefixed with essentialdata run before those prefixed with projectdata, and within each category, files are processed in alphabetical order based on their names in the extension’s resources directory. Use numbered file naming (e.g., essentialdata-01-sites.impex, projectdata-01-content-pages.impex, projectdata-02-cms-components.impex) to enforce a predictable sequence.
Code Quality Gates
Static Analysis
Configure SonarQube (or a comparable tool) with SAP Commerce-specific rules:
- Flexible Search injection – detect string concatenation in Flexible Search queries (SQL injection risk).
- Model service usage – flag direct model saves without proper interceptor context.
- Hardcoded values – detect hardcoded catalog versions, site IDs, and other environment-specific values.
- Spring bean best practices – detect field injection (prefer constructor injection), detect unused beans.
Security Scanning
Run dependency vulnerability scanning (OWASP Dependency Check, Snyk, or similar) on every build. SAP Commerce bundles many third-party libraries, and your custom extensions add more. A known vulnerability in a transitive dependency should block the pipeline.
Code Review
Automated checks complement but do not replace human review. Establish pull request review requirements:
- At least one reviewer for standard changes.
- Two reviewers for type system changes, security-sensitive code, and payment/checkout modifications.
- Architecture review for new extensions, new integrations, or significant refactoring.
Monitoring Post-Deployment
Health Checks
Implement health check endpoints that verify:
- Database connectivity
- Solr connectivity
- External service availability (payment providers, ERP integration)
- Cache warm-up status
CCv2 uses these health checks for pod readiness. The pipeline should also query them after deployment to verify the environment is healthy.
Smoke Tests
Automated smoke tests run immediately after deployment to verify critical functionality:
- Homepage loads without errors
- Product search returns results
- A product can be added to cart
- Checkout page renders (even if you don’t complete a transaction)
- Backoffice login works
Keep smoke tests fast (under 2 minutes) and reliable. A flaky smoke test that triggers false alarms erodes trust in the pipeline.
Rollback Procedures
When a deployment causes issues:
- Identify the problem – check monitoring dashboards, application logs, and error rates.
- Decide: rollback or fix forward – if the fix is trivial, fixing forward (deploying a corrected build) may be faster. If the problem is complex or data-corrupting, rollback.
- Rollback mechanism – CCv2 supports redeploying a previous build. This handles code rollback, but does not reverse database schema changes. This is why backward-compatible schema changes are essential.
Practice rollbacks in non-production environments. A rollback procedure that has never been tested is a rollback procedure that will not work when you need it.
Common CI/CD Pitfalls
Pitfall 1: No Local Build Verification
Developers pushing code without running a local build. The CI pipeline catches the compilation error 20 minutes later, blocking other team members. Enforce local build verification through pre-commit hooks or developer discipline.
Pitfall 2: Ignoring Flaky Tests
A test that fails intermittently is not a minor annoyance – it is a pipeline reliability problem. Flaky tests train the team to ignore failures, which means real failures also get ignored. Fix or quarantine flaky tests immediately.
Pitfall 3: Manual Steps in the Pipeline
Any step that requires a human to click a button, run a command, or copy a value introduces delay and error risk. Automate everything except the production deployment approval gate.
Pitfall 4: No Pipeline-as-Code
Storing pipeline configuration in the CI tool’s UI rather than in the repository. This makes the pipeline impossible to version, review, or reproduce. Store all pipeline configuration (Jenkinsfile, .gitlab-ci.yml, GitHub Actions workflows) in the repository alongside the application code.
Pitfall 5: Testing Only the Happy Path
Automated tests that only verify success scenarios miss the failures that cause production incidents. Test error handling, timeout behavior, invalid input, and concurrent access. The bugs that reach production are almost always in the paths nobody tested.
Building the Pipeline Incrementally
You do not need to implement everything in this guide at once. A phased approach:
Phase 1 (Week 1-2): Set up basic pipeline with compilation check, unit tests, and automated CCv2 build trigger on merge to develop.
Phase 2 (Week 3-4): Add integration tests, static analysis, and automated deployment to the development environment.
Phase 3 (Month 2): Add API tests, smoke tests, and automated staging deployment. Implement code quality gates as merge requirements.
Phase 4 (Month 3+): Add performance tests, security scanning, and production deployment automation with approval gates.
Each phase delivers incremental value. Phase 1 alone catches the majority of “it doesn’t compile” and “the tests are broken” issues that slow teams down.
For teams that want guidance on pipeline design and implementation, our SAP Commerce consulting services include DevOps and CI/CD advisory. We draw on patterns from our portfolio of enterprise implementations to help teams establish pipelines that balance rigor with velocity.



