Developing with SAP Extension Suite

Configuring Stages of the CI/CD Pipeline

Objectives
After completing this lesson, you will be able to:

After completing this lesson, you will be able to:

  • Configure stages of the CI/CD pipeline

Configure the Stages of a CI/CD Pipeline: Exercise Overview

Scenario

You have connected your SAP Continuous Integration and Delivery service to your GitHub repository and have created a job that is going to take care of automated build and deployment. Now the job needs to know what steps it needs to perform. The definition of steps that need to be performed is done using a so-called pipeline. The configuration syntax of the pipeline that you are going to configure is based on SAP's Open-Source Project Piper1. The pipeline configuration is done within your project.

Task Flow

In this exercise, you will configure stages of a project "Piper" pipeline.

Prerequisite

You have enabled your application for CI/CD.

Watching the Simulation and/or Performing the Steps

Note
In this exercise you find a simulation and a list of all steps, displayed in the simulation. Performing the steps below allows you to follow the simulation in your own trial account.

Configure the Stages of a CI/CD Pipeline

Exercise

Configure the Stages of a CI/CD Pipeline

Start Exercise

Task 1: Configure Stages of a CI/CD Pipeline

Steps

  1. Configure Stages of a CI/CD Pipeline.

    1. In the GitHub repository of your project (or in SAP Business Application Studio), execute the following command in a terminal session: cds add pipeline

    2. Navigate into the .pipeline folder and open the config.yml file, and replace everything with the following configuration:

      Code snippet
      ###
       # This file configures the project "Piper" pipeline of your project.
       # For a reference of the configuration concept and available options, please have a look into its documentation. 
      # 
      # The documentation for the most recent pipeline version can always be found at:
      # https://sap.github.io/jenkins-library/ 
      # 
      # This is a YAML-file. YAML is an indentation-sensitive file format. Please make sure to properly indent changes to it. 
      ### 
      
      ### General project setup
      ---
       general:
          pipeline: "sap-cloud-sdk" 
          buildTool: "mta"
       stages:
          Build:
             mavenExecuteStaticCodeChecks: false
             npmExecuteLint: false
          Additional Unit Tests:
             npmExecuteScripts: false
             karmaExecuteTests: false
          Release:
             cloudFoundryDeploy: true
             tmsUpload: false
          steps:
            cloudFoundryDeploy:
              cloudFoundry: 
                apiEndpoint: "https://api.cf.eu10.hana.ondemand.com"
                org: "myOrg"
                space: "mySpace"
                credentialsId: "cfdeploy"
                appName: ""
              mtaDeployParameters: "-f --version-rule ALL"
           artifactPrepareVersion:
              versioningType: "cloud_noTag"
      Copy code
    3. Replace the placeholders "myOrg", "mySpace" and "apiEndpoint" with the values of the space in the SAP BTP, Cloud Foundry environment to which you want to deploy.credentialsId is the name of the credential you have created in the CI/CD Service for the SAP BTP access. In previous parts, you named it cfdeploy.

      You can get the values for myOrg, mySpace, and apiEndpoint from your subaccount overview in the SAP BTP cockpit:

      Or just run command CF TARGET in the Terminal in SAP Business Application Studio. Use the values to replace the placeholders as described above.

  2. Commit your changes to GitHub.

    If you have added the new folder and file in the Business Application Studio, you can do so by opening a new terminal from the new .pipeline folder and then by performing the following steps:

    1. Navigate into the .pipeline directory:

      Use the command: cd .pipeline

    2. Add all recent changes into the git staging area:

      Use the command: git add -A

    3. Create a new commit with the staged changes and push it to the remote repository:

      Code snippet
      
      git commit -m "new pipeline"
      git push
      Copy code

Result

You have configured your CI/CD pipeline. Finally, you will have to verify the success of your build.

Reference Links: Configuring Stages of the CI/CD Pipeline

For your convenience, this section contains the external references in this lesson.

If links are used multiple times within the text, only the first location is mentioned in the reference table.

Reference Links: CI/CD Pipeline

Ref#SectionContext text fragmentBrief descriptionLink
1Configure the Stages of a CI/CD Pipelineis based on SAP's Open-Source Project Piper.Project Piperhttps://www.project-piper.io/

Save progress to your learning plan by logging in or creating an account