Managing the Application's Lifecycle with CI/CD Service

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

After completing this lesson, you will be able to:

  • Manage the application's lifecycle with CI/CD services

Use the Continuous Integration and Delivery (CI/CD) Services

Business Scenario

We're in the process of developing a cloud application based on a variety of SAP Technologies, from database services, to user interfaces, including SAP Cloud Application Programming Model (CAP), SAP Fiori, SAP Mobile Development Kit (MDK), and others. As the project becomes more complex, more developers will need to collaborate and contribute to the project. Therefore, an efficient way to enable continuous integration and delivery on the project is needed to ensure quality. Smooth development can be achieved with an automated build and testing repository. In this case, SAP Continuous Integration and Delivery service will be used to achieve that.

In this exercise, you will perform the following tasks:

  • Create a CI/CD job on your project.
  • Configure your CI/CD job to build, and deploy your application to a test Cloud Foundry environment.
  • Triggering an automated CI/CD build by submitting a change to your remote Git repository.

Prerequisites

  • You must first subscribe to the SAP Continuous Integration and Delivery service, and assign the required roles and permissions. See Initial Setup
  • You have successfully completed up to exercise Create user roles.
  • You have shared your project to a remote Git repository.
Note

Note that some of the services that this learning journey links to, can incur costs.

If you are concerned about charges, you can opt to skip the corresponding exercises and watch the simulation instead.

Exercise Options

You can perform this exercise in two ways:

  1. Live Environment – by using the instructions provided below, you can perform the steps in your SAP BTP account.
  2. Platform Simulation – follow the step-by-step instructions within the simulation.
Note
We strongly recommend to perform the steps in the live environment first.

The following simulation reproduces the full exercise execution:

Task 1: Enable Continuous Integration and Delivery (CI/CD)

Steps

  1. Enable Continuous Integration and Delivery (CI/CD).

    1. In the left panel, choose the CI/CD button.

    2. If you can't see the CI/CD icon, you can open the menuViewCI/CD.

    3. In the CI/CD panel, you should see your project. It should have no jobs yet, and a Create Job button. Choose the Create Job button.

      Note

      If you have not shared your project to a remote Git repository, you will get a notification message that will ask you to share your project.

    4. The Guided Development page displays. Scroll down to see the topic: Create a CI/CD Job, and expand Job Configuration.

    5. Choose the Configure Job button, and a new Job Configuration wizard opens to let you create and configure a new job.

    6. In the Job Name step, enter a unique job name.

    7. From the Pipeline dropdown list, select SAP Cloud Application Programming Model.

    8. Choose Next.

  2. In the Git Credentials step, add a repository and credentials.

    You will be storing your remote Git Repository to the SAP Continuous Integration and Delivery service so that it can retrieve your project via Git to do the build and deployment.

    Use the following values:

    FieldValue
    Repository name<of your choice>
    Credential<of your choice>
    Description<of your choice>

    1. You should not have any matching Git Repositories for selection yet, so select -- Add a Repository -- from the Git Repositories drop down list. Two new fields should appear: Repository Name and Git Credentials.

    2. Give the repository a unique name in the Repository Name field. This is the name to identify your repository that's stored in the SAP Continuous Integration and Delivery service.

    3. You should not have any Git credentials that you can use yet, so select -- Add Credentials -- from the drop down list.

    4. Give the credential a unique name that will be stored in the SAP Continuous Integration and Delivery service, for example: user-abc-github.

    5. You can also give some description to better describe the credential, for example User Abc's Github.com credentials.

    6. Enter the username and password / token. These two fields will be stored securely in the SAP Continuous Integration and Delivery service, and will be used by the service to access and retrieve project from your Git repository.

    7. Choose Next to continue to the next step.

  3. In the Acceptance step, perform the steps to create further credentials.

    This step allows you to specify the Cloud Foundry environment you wish this project to be deployed to for acceptance testing.

    1. Select Yes in the radio button.

    2. Enter the API Endpoint, Org Name, Space, and Cloud Foundry Credentials (You might need to specify).

    3. You should not have any Cloud Foundry credentials yet, so select -- Add Credentials -- from the dropdown list.

    4. Give the credential a unique name that will be stored in the SAP Continuous Integration and Delivery service, for example: user-abc-cf.

    5. You can also give some description to better describe the credential, for example User Abc's Cloud Foundry credentials.

    6. Enter the username and password / token. These two fields will be stored securely in the SAP Continuous Integration and Delivery service, and will be used by the service to deploy your application to the Cloud Foundry target that you have specified.

    7. Choose Next to continue to the next step.

  4. In the Release step, there is nothing to do.

    This step allows you to configure the deployment to Cloud Foundry and / or to Cloud Transport Management Service.

    1. In this exercise, we will not set up this job to release to Cloud Foundry, nor upload to Cloud Transport Management Service, so we can leave them as No and choose Finish to complete the job creation.

    2. Once the job creation is done, you should see a notification:

    3. You should see a job is now visible in the CI/CD panel. But at the moment, it will have no job run history.

  5. Add Webhook Data to your Git repository to allow automated build to be triggered whenever you submit changes to your remote Git repository:

    1. Choose the Overflow button beside the job name to open a context menu.

    2. Choose the View Webhook menu item.

      This opens a Webhook Data tab with the required details for adding webhook data.

    3. Go to your Git provider's settings, and add the provided webhook data.

    4. Once the webhook data is configured, you can now make changes and submit them to your remote Git repository.

    5. You will see a notification like this when you submit changes:

    6. You will see the job status changed from No build history to Build 1 with StatusRunning:

    7. Depending on your project size and your job configuration, the build will probably take at least 5 minutes or more. Once the build completed, you will receive a notification such as the following:

    8. Your job status in the CI/CD panel will be updated for example:

Reference Links: Services for Continuous Integration and Delivery (CI/CD)

You find more information about continuous integration and delivery here: Continuous Integration and Delivery

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

Login or Register