CI/CD with CircleCI

Use the kalix orb to use CircleCI with your Kalix project. The orb supports commands for installing, authenticating, and invoking the Kalix CLI.


To use the kalix orb, you’ll need to:

  • Enable CircleCI new tab for your source code repository containing the source code you want to deploy

  • Enable and activate pipelinesnew tab in the CircleCI project (Project Settings → Advanced Settings)

  • Create a service token for your project

  • Get the name or preferably UUID of your project, which can be obtained by running kalix projects list

Create an authentication context

The kalix orb expects the authentication token and project ID as parameters. CircleCI context new tab allows you to store the authentication token and project ID values securely using a context.

In your CircleCI account, create a context new tab and:

  1. Store the authentication token as KALIX_TOKEN.

  2. Store the project ID as KALIX_PROJECT.

With the authentication variables saved, you can use them in your project configuration.

Create a workflow

Follow these steps to create a workflow to invoke the kalix orb for your project:

  1. Create a folder named .circleci at the root of the project folder.

  2. Create a file named config.yml in the .circleci folder.

  3. Open config.yml for editing and add the CircleCI version:

    version: 2.1
  4. Reference the orb:

      kalix: lightbend/kalix@1.0.0
  5. Add a job that creates an image and invokes orb commands. For example, to deploy a service named my-service:

          - image: 'cimg/base:stable'
          - checkout
          - kalix/install (1)
          - kalix/exec: (2)
              cmd: services deploy my-service cimg/base:stable
    1 The kalix/install command installs the Kalix CLI for your CircleCI job and configures it using the KALIX_TOKEN and KALIX_PROJECT environment variables set in the CircleCI context.
    2 The kalix/exec command executes any command from the Kalix CLI. Do not precede commands with kalix.
  6. Add a workflow new tab to schedule the job and give it access to the context storing the authentication variables. For example, with a refresh token and project ID stored in kalix-context:

      version: 1
          - run-kalix
          - kalix-context

    By default, CircleCI jobs are triggered by any push to the repository. See the documentation for scheduling new tab a workflow.

  7. Save .config.yml.