How to Use Project “Piper” Docker Images for CI/CD with Azure DevOps
Project “Piper”, SAP’s open-source solution for continuous integration and delivery, does not only contain a shared library with steps, scenarios, and utilities for Jenkins pipelines but also a set of Docker images for implementing CI/CD best practice processes. However, just like our shared library, these images were quite limited to Jenkins and typical project “Piper” use cases. But what if you want to use your own CI tool, such as Azure DevOps, together with an SAP-specific pipeline?
If that’s the case, we have good news for you: We’ve started to rework and decouple our Docker images so that as a first result, you can use project “Piper” out-of-the-box together with Azure DevOps. We now provide a CI/CD pipeline with build, test, and deploy steps for classical SAP UI5 applications on Azure DevOps in the Cloud Foundry environment.
How can you use our CI/CD pipeline?
- In your project sources, create a yml-file named azure-pipelines.yml and copy the following code into it:
# Starter pipeline # Start with a minimal pipeline that you can customize to build and deploy your code. # Add steps that build, run tests, deploy, and more: # https://aka.ms/yaml name: cd-openui5-sample-app resources: containers: - container: mta image: 'ppiper/mta-archive-builder:latest' options: --user 0:0 - container: cfcli image: 'ppiper/cf-cli' options: --user 0:0 --privileged - container: node image: 'geekykaran/headless-chrome-node-docker:latest' options: --privileged trigger: - master stages: - stage: build displayName: Build MTA for SAP Cloud Platform jobs: - job: build pool: vmImage: 'ubuntu-latest' container: mta steps: - bash: 'mtaBuild --build-target CF --mtar MySampleApp.mtar build' - publish: $(System.DefaultWorkingDirectory)/. artifact: WebApp - stage: test displayName: Run Karma Test Suite jobs: - job: test pool: vmImage: 'ubuntu-latest' container: node steps: - bash: 'cd MySampleApp && npm config set @sap:registry "https://npm.sap.com" && npm install && npm run-script test' - publish: $(System.DefaultWorkingDirectory)/. artifact: TestResult - stage: deploy displayName: Deployment to SAP Cloud Platform (cf) jobs: - job: deploy pool: vmImage: 'ubuntu-latest' container: cfcli steps: - download: current artifact: WebApp - bash: 'cf login -u "$(CF-USER)" -p "$(CF-PASSWORD)" -a "$(CF-API)" -o "$(CF-ORG)" -s "$(CF-SPACE)" && cf deploy $(Pipeline.Workspace)/WebApp/MySampleApp.mtar -f'
- In Azure DevOps, define variables for the secrets in the code (CF-USER, CF-PASSWORD, CF-API, CF-ORG, CF-SPACE).
Done! And the greatest thing about it? You can extend your pipeline by adding any desired Docker container.
Do you want to know how others have experienced working with our adapted Docker images? We’re currently writing a blog post about our collaboration with the customer who initiated our rework. Stay tuned!
Edit: Here’s the follow-up blog post: Project “Piper” and Azure DevOps: Successful Collaboration with ‘delaware’
Are you new to CI/CD by SAP? Have a look at Continuous Integration and Delivery by SAP.
Are you interested in SAP’s CI/CD offerings? See SAP Solutions for Continuous Integration and Delivery.