SAP implements tooling for continuous delivery in opensource project "
Piper". The goal of project "Piper" is to substantially ease setting up continuous delivery in your project using SAP technologies.
For more information about project “Piper” and the other CI and CD offerings by SAP, see
Overview of SAP Offerings for CI and CD.
Configuring project piper in your Jenkins server is explained in this
blog.
SAP Integration Suite has contributed not only many
Jenkins pipelines, but also many piper library steps, which helps you to create your own CI/CD pipeline, automating various tasks.
For example, in the case of SAP Integration Suite capability “Cloud Integration”, we can automate below scenario
- Update the integration flow design time configuration parameter.
- Deploy an integration flow.
- Get the service endpoint of the deployed integration flow.
- Invoke the service endpoint with the HTTP request.
- Get message processing log (MPL) status of the integration flow.
- If the MPL status is completed in previous step, download integration flow artifact from design time.
- Store integration flow artifact in the GitHub repository.
Let’s understand all the Piper commands provided for SAP Integration Suite capabilities, mainly Cloud Integration and API Management.
SAP Cloud Integration Piper Steps
Piper Step Name |
Description |
Documentation Link |
Pipeline Example |
integrationArtifactDeploy
|
Deploy an integration flow in to the SAP Cloud Integration runtime
|
|
|
integrationArtifactDownload
|
Download integration flow runtime artefact
|
|
|
integrationArtifactGetMplStatus
|
Get the MPL status of an integration flow
|
|
|
integrationArtifactGetServiceEndpoint
|
Get an deployed integration flow service endpoint
|
|
|
integrationArtifactResource
|
Add, Delete or Update an resource file of integration flow design time artifact
|
|
|
integrationArtifactUnDeploy
|
Undeploy a integration flow
|
|
|
integrationArtifactUpdateConfiguration
|
Update integration flow configuration parameter
|
|
|
integrationArtifactUpload
|
Upload or Update an integration flow design time artifact
|
|
|
integrationArtifactTransport
|
Integration Package transport using the SAP Content Agent Service
|
|
|
SAP API Management piper steps
Piper Step Name |
Description |
Documentation Link |
Pipeline Example |
apiProxyDownload
|
Download a specific API Proxy from the API Portal
|
|
|
apiKeyValueMapDownload
|
Download a specific Key Value Map from the API Portal
|
|
|
apiProxyUpload
|
Upload an api proxy artifact in to the API Portal
|
|
|
Going forward, more piper steps would be contributed for both Cloud Integration and API Management.
Now let’s take an example of consuming Cloud Integration piper command "integrationArtifactDeploy" in the Jenkins server.
This involves below steps:
- Creating Jenkins pipeline project in GitHub which consumes cloud integration piper command
- Configure Cloud Integration API service key in the Jenkins server as security credentials
- Configure the piper library in the Global pipeline libraries
- Creating new pipeline project in Jenkins based on pipeline script from SCM approach.
- Running pipeline project and verifying results
Creating Jenkins pipeline project in GitHub which consumes Cloud Integration piper command
Let’s consume integrationArtifactDeploy piper command which is responsible for deploying an integration flow in to the Cloud Integration runtime.
First step is to create GitHub repository as shown below
Repository has directory called .pipeline and file Jenkinsfile. Jenkins file has the groovy script code, which has logic to invoke the integrationArtifactDeploy piper command
Here “
integrationArtifactDeploy script: this” line executes the cloud integration piper command
.pipeline has the config.yaml file which provide input arguments for the integrationArtifactDeploy piper command
Here we pass the integration flow ID which has to be deployed and the API service key details which is configured in the Jenkins system as security credential.
Configure Cloud integration API service key in the Jenkins server as security credentials
API service key need to be configured as Jenkins credentials so that all pipeline projects can use it.
Select the Manage Jenkins configuration option in the Jenkins server home page.
Select the Manage Credentials option
Select the Global credentials
Copy the service key JSON text from the SAP BTP account cockpit, this can be found in below location.
SAP BTP Cockpit Subaccount home page -> instances and subscriptions -> instance name (API plan)
->Service keys ( view and copy the json text)
Create new credentials of type secret text under add credentials option, paste the service key text under secret text input box and save it.
The same ID used here need to be passed as input for cpiApiServiceKeyCredentialsId configuration parameter in the config.yml file as shown below
Configure the piper library in the Global pipeline libraries
Provide the piper library runtime configuration in the Jenkins configuration -> Global pipeline libraries section.
Creating new pipeline project in Jenkins based on pipeline script from SCM approach.
Select new Item -> pipeline project and provide the project name
Configure the repository URL, branch to pull and script file name as shown below
Click on save/apply to save the project. This step will create Jenkins pipeline project to pull the SCM repository configured in the GitHub and execute the Jenkins file which has logic to execute the SAP cloud integration piper command.
Running pipeline project and verifying results
This step involves build and running the Jenkins pipeline project and verify the SAP cloud integration piper command execution results.
Click on build now and see the latest build results
If you select the specific build and check the console output, you can validate weather piper command successfully executed or not!
You can combine these piper commands and build a complex scenario, where you can manage the end to end lifecycle of an integration flow artefact for CI/CD, starting from configure to deploy, check execution status, download and store in git etc.
If you want to build your own custom piper command for Integration Suite, you can contribute to opensource SAP Project Piper (
https://www.project-piper.io/) and follow the
developer guide for building your own custom shared library steps.
Below is the example hello World piper command sample, which you can refer to build it in your own forked piper GitHub repository from piper master repository ( i.e.
https://github.com/SAP/jenkins-library) and test in Jenkins server.
Hello world example step development commits, which show the workflow:
https://github.com/marcusholl/jenkins-library/commits/helloWorld
Pipeline to build and run the code in a Jenkins:
https://github.com/marcusholl/helloWorld/blob/main/Jenkinsfile#L10
Example of a groovy wrapper with username, Password credentials:
https://github.com/SAP/jenkins-library/blob/master/vars/cloudFoundryCreateSpace.groovy