Skip to main content

Celonis Product Documentation

Advanced version control with Github
Welcome

The Celonis Studio has a very useful version control system but you might want to implement a more specific process fitting to your companies' needs. In this example, we show you how to implement Github code version control with Celonis Studio Content.

Installation

The application consists of three main parts:

  1. The Git Control Room package.

  2. Python scripts that run in the ML Workbench, your local computer or other user-specified location.

  3. Optional automation that runs in Github, Bamboo or similar.

A possible setup could be to have a “main branch app”, the current version in your sandbox and in your production team. The scripts and Git Control Room are set up in your sandbox.

Python scripts
  • The automatic Control Room generator generates your interface of packages to merge automatically based on the available packages.

  • The GitSync creates the commits and (optionally) pull requests.

Secrets setup

Choose the secrets management of your company's choice to ensure compliance, for example, you could run the scripts locally on your computer and save the encrypted API tokens on your local machine.

Note

You will soon be able to use the Application Key of the MLWB but this is not currently supported. Use a "human api key" created from the "profile" section within the EMS (click your user icon in the top-right corner).

To set your token as a hidden file in the MLWB:

  1. Create a new file and add contentcli = {"API_TOKEN": "YOUR-API-TOKEN-HERE"}

  2. Change the file extension to .config.py.

  3. If you have followed the naming conventions given in steps 1 and 2, the notebook provided will find the information it requires.

Script preparation
  1. Download the scripts (add dropdown link) to add them to your MLWB as Python notebooks.

  2. Upload the package_github-integration-control-room.zip.

  3. Change the variables in Controlroom auto-creator; to exclude certain packages, add the key packagesToHide.

    1. Change the variables in Github Sync:

      teamUrl (automatically chosen if run in MLWB)

  4. Change the variables in Github Sync:

    1. teamUrl (automatically chosen if run in MLWB).

    2. repoName

    3. appRegistry (stores tuples of the apps you want to support {“key”:”name”} of where you want to push to)

  5. If your organization uses a different way to interact with Git, see your internal documentation for how to connect to this git system; in this example, github.com is used.

  6. Push the github-integration-control-room for the first time into your Team; you can use and adapt the following command, as long as the zip file is in your current active directory (usually root):

    !TEAM_URL=$teamUrl API_TOKEN=$apiToken content-cli push package -f package_github-integration-control-room.zip!

  7. Publish the package once (and any time you change the content of, for example, the skills within it).

Git Control Room package

To connect the skills to the scripts:

  1. In Resources/Generate Control Room assign in the action “Execute ML Notebook” the correct Notebook you just created.

  2. Repeatr the Resources/Trigger Git sync.

  3. In the Trigger Git Sync Skill, you also need to add the possible target apps.

Note

Add and understandable name and then the key you want to send to the MLWB. Make sure it is the same as you defined in appRegistry.

Github actions (optional)

You can adding continuous integration in Github to push the app every time something changes in the main branch on the respective path.

  1. Use the example code.

  2. Add repository secrets TRY_INTEGRATION_PRODUCTIVE_API_KEY TRY_INTEGRATION_API_KEY with the respective repo key.

  3. Run.

Note

When running this action, the repo already needs to exist. You can either create/push manually or simply run the action here once without the --overwrite command.

Example code

name: Continuous integration of Supply Chain App
# Controls when the action will run. 

on:
  push: 
    branches: [ main ] # Will run on every merge to main
    paths:
    - 'studio-packages/supply-chain/**'
  # Allows you to run this workflow manually from the Actions tab

  workflow_dispatch:
jobs:
  prepare-and-push-package:
    runs-on: self-hosted
    continue-on-error: true
    steps:
      - name: Setup Node
        uses: actions/setup-node@v2.1.5
        with:
          node-version: "10.17.0"
          registry-url: https://npm.pkg.github.com
          scope: "@celonis"
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2
      
      - uses: papeloto/action-zip@v1
        with:
          files: studio-packages/supply-chain
          dest: package_app.zip
      
      
      - name: Install content cli
        run: npm install @celonis/content-cli -g
        env:
          NODE_AUTH_TOKEN: ${{secrets.CELOBOT_GITHUB_TOKEN}}
          
      - name: Push App to Sandbox Team
        run: content-cli push package --overwrite -f "package_app.zip"
        env:
          TEAM_URL: "https://tpl-git-integration-v1.try.celonis.cloud/"
          API_TOKEN: "${{secrets.TRY_INTEGRATION_API_KEY}}"
          
      - name: Push App to Produtive Team
        run: content-cli push package --overwrite -f "package_app.zip"
        env:
          TEAM_URL: "https://tpl-git-integration-productive-team-v1.try.celonis.cloud/"
          API_TOKEN: "${{secrets.TRY_INTEGRATION_PRODUCTIVE_API_KEY}}"

Tip

The actions have been split here into separate apps for improved push performance. You could create an action that pushes all apps.

Use and testing

See the Celosphere session to view how a use case example would work. You can test the scripts best when running them within the MLWB and setting example input in the first cell.

Feedback

We would love to hear your feedback: servicedesk@celonis.com