|

|  How to Integrate SAP Leonardo with CircleCI

How to Integrate SAP Leonardo with CircleCI

January 24, 2025

Discover how to seamlessly integrate SAP Leonardo with CircleCI, enhancing your workflow with automation and intelligent technologies in this step-by-step guide.

How to Connect SAP Leonardo to CircleCI: a Simple Guide

 

Prerequisites

 

  • Ensure you have a SAP Leonardo account set up with appropriate APIs enabled.
  •  

  • Sign up for a CircleCI account if you haven't already.
  •  

  • Install Node.js and npm on your local machine to run scripts locally if needed.

 

Step 1: Configuring SAP Leonardo API Access

 

  • Log into your SAP Leonardo account and navigate to the API section.
  •  

  • Generate an API key that CircleCI will use to communicate with SAP Leonardo.
  •  

  • Note down the API endpoint URL that you will interact with from CircleCI.

 

Step 2: Create a New CircleCI Project

 

  • Log into CircleCI and click on the "Add Projects" tab.
  •  

  • Select the repository where your SAP Leonardo integration code resides.
  •  

  • Follow the prompts to set up a new CircleCI project pipeline for your repository.

 

Step 3: Add Environment Variables in CircleCI

 

  • Navigate to your project settings in CircleCI.
  •  

  • Under "Environment Variables," add your SAP Leonardo API key and any other necessary credentials.
  •  

  • Example: Set a variable named SAP_API_KEY with your actual API key.

 

Step 4: Create a CircleCI Configuration File

 

  • Create a .circleci folder in the root of your repository.
  •  

  • Within this folder, create a config.yml file.
  •  

  • Copy and adapt the following basic configuration to suit your project needs:

 

version: 2.1

jobs:
  build:
    docker:
      - image: circleci/node:latest
    steps:
      - checkout
      - run:
          name: Install Dependencies
          command: npm install
      - run:
          name: Run Tests
          command: npm test
      - run:
          name: Deploy to SAP Leonardo
          command: |
            curl -X POST \
            https://api.sap.com/your-endpoint \
            -H "Authorization: Bearer $SAP_API_KEY" \
            -H "Content-Type: application/json" \
            -d @data.json

workflows:
  version: 2
  build-deploy:
    jobs:
      - build

 

Step 5: Test the Integration

 

  • Commit and push your updated configuration file to the repository.
  •  

  • Check CircleCI's dashboard to ensure your pipeline runs as expected.
  •  

  • Monitor logs for any errors during the API interaction phase with SAP Leonardo.

 

Step 6: Troubleshooting Common Issues

 

  • Ensure your API key is correctly set up and corresponds to the environment you're querying or updating.
  •  

  • Check CORS settings if you encounter issues with cross-origin requests.
  •  

  • Review CircleCI build logs for any errors related to Node.js dependencies and correct them accordingly.

 

Omi Necklace

The #1 Open Source AI necklace: Experiment with how you capture and manage conversations.

Build and test with your own Omi.

How to Use SAP Leonardo with CircleCI: Usecases

 

Automating Advanced Analytics and Deployment

 

  • SAP Leonardo is used to build and enhance machine learning models for predictive analytics purposes. These models are developed to process and analyze business data efficiently.
  •  

  • CircleCI is chosen to streamline the continuous integration and continuous delivery (CI/CD) pipeline, automating the deployment of machine learning models created with SAP Leonardo into production environments.

 

Integration of SAP Leonardo and CircleCI

 

  • Connect SAP Leonardo's Machine Learning API with CircleCI using webhooks to trigger deployment pipelines after model development.
  •  

  • Utilize custom scripts in CircleCI to automatically fetch the latest machine learning models and datasets from SAP Leonardo, ensuring the models used in production are up-to-date.

 

Benefits and Features

 

  • This integration enables automatic updates of machine learning models without manual intervention, reducing downtime and errors in production.
  •  

  • Facilitates easy rollback functionality in CircleCI, allowing developers to revert to previous versions of machine learning models if any issues occur.

 

Sample Script to Fetch SAP Leonardo Models

 


version: 2.1

jobs:
  fetch_ml_model:
    docker:
      - image: circleci/python:3.8
    steps:
      - checkout
      - run:
          name: Fetch ML Model
          command: |
            curl -X GET "https://api.sapleonardo.com/ml/model" \
                 -H "accept: application/json" \
                 -H "authorization: Bearer $SAP_LEONARDO_API_KEY" \
                 -o model.json

workflows:
  version: 2
  deploy_ml_model:
    jobs:
      - fetch_ml_model

 

 

Smart IoT Solutions Deployment

 

  • SAP Leonardo is leveraged for its IoT capabilities, enabling businesses to gather and analyze data from various connected devices to drive intelligent operations.
  •  

  • CircleCI is employed to manage the CI/CD pipeline, ensuring rapid deployment of IoT solutions and updates developed through SAP Leonardo, thus facilitating seamless integration and scaling of IoT applications.

 

Integration Workflow of SAP Leonardo and CircleCI

 

  • Configure CircleCI to trigger builds and deployments when changes are made to IoT application configurations or SAP Leonardo models, employing webhooks for real-time pipeline initiation.
  •  

  • Implement environment variables within CircleCI to securely handle API keys and sensitive information required to interact with SAP Leonardo's IoT services.

 

Advantages and Functionalities

 

  • This unified approach accelerates the deployment cycle of IoT applications, ensuring that the most efficient versions are always running, which enhances business agility and operational intelligence.
  •  

  • CircleCI facilitates automated testing of IoT applications, verifying that all components interact perfectly with SAP Leonardo's edge computing and analytics functionalities before going live.

 

Example CircleCI Configuration for IoT Application Deployment

 

version: 2.1

jobs:
  deploy_iot_application:
    docker:
      - image: circleci/node:12.18
    steps:
      - checkout
      - run:
          name: Deploy IoT Application
          command: |
            npm install
            npm test
            curl -X POST "https://api.sapleonardo.com/iot/deploy" \
                 -H "Content-Type: application/json" \
                 -H "Authorization: Bearer $SAP_LEONARDO_API_KEY" \
                 --data-binary @deployment-config.json

workflows:
  version: 2
  iot_deployment:
    jobs:
      - deploy_iot_application

 

Omi App

Fully Open-Source AI wearable app: build and use reminders, meeting summaries, task suggestions and more. All in one simple app.

Github →

OMI NECKLACE + OMI APP
First & only open-source AI wearable platform

a person looks into the phone with an app for AI Necklace, looking at notes Friend AI Wearable recorded a person looks into the phone with an app for AI Necklace, looking at notes Friend AI Wearable recorded
a person looks into the phone with an app for AI Necklace, looking at notes Friend AI Wearable recorded a person looks into the phone with an app for AI Necklace, looking at notes Friend AI Wearable recorded
online meeting with AI Wearable, showcasing how it works and helps online meeting with AI Wearable, showcasing how it works and helps
online meeting with AI Wearable, showcasing how it works and helps online meeting with AI Wearable, showcasing how it works and helps
App for Friend AI Necklace, showing notes and topics AI Necklace recorded App for Friend AI Necklace, showing notes and topics AI Necklace recorded
App for Friend AI Necklace, showing notes and topics AI Necklace recorded App for Friend AI Necklace, showing notes and topics AI Necklace recorded