Your First Workflow in Kraken CI

Michal Nowikowski
4 min readJun 15, 2021

--

Kraken CI is a new Continuous Integration tool. It is a modern, open-source, on-premise CI/CD system that is highly scalable and focused on testing. It is licensed under Apache 2.0 license. Its source code is available on Kraken CI GitHub page.

This tutorial is the second installment of the series of articles about Kraken CI. Part 1, Kraken CI, New Kid on the CI block, presented the installation of Kraken. This time we will cover how to prepare a workflow for a simple Python project.

The workflow will:

  1. fetch sources from GitHub,
  2. run tests using Pytest,
  3. build a wheel package,
  4. upload built package to Kraken’s artifacts storage.

Here we are using fresh Kraken installation using Docker Compose with built-in Kraken Agent running in Docker container. Installation procedure details can be found in part 1 or in the installation manual from https://kraken.ci project web page.

Project Preparation

Details about a new project setup in Kraken CI can be found in the previous article, part 1 as well.

Here, in short, let’s do:

  1. Create a project with a name: Demo
  2. Create a branch with a name: main
  3. Use a pre-created stage and rename it to: Hello World

Stage Hello World

The stage should look as follows:

And the original workflow schema code looks as follows:

Now let’s try if it works. Click Run CI Flow button.

Logs from the job with echo Hello World

Git Repo Checkout Step

Ok, let’s start extending our schema to make it more real life. First, let’s add a step for checking out a Git repository:

Now run new CI flow. The output should look like this:

Logs from the job with git clone

The logs show that the repository has been cloned and ls -al shows sample-project-python folder.

Run Tests Step

Now let’s replace the step with listing the current directory with something more interesting, like running tests. Kraken provides several built-in tools for running tests. In the case of our Python sample project, we will use pytest built-in tool.

Change the steps in schema editor, save it and run new CI flow. And the job output should be:

Logs from the job with running Pytest

Building Step

So if tests succeeded we could build a package of our Python project. Add step for building a wheel package using project’s setup.py script:

Now run CI flow again. The output should look as follows:

Logs from the job with packaging step with error

It seems that there is missing a package that provides wheel support for Python. Let’s install it.

New output with building:

Logs from the job with successful deps installation and package building

Storing Artifacts Step

The results of building the sample project are two packages:

  • dist/sampleproject-2.0.0-py3-none-any.whl
  • dist/sampleproject-2.0.0.tar.gz

We could store it Kraken storage and make it available for user for downloading. For that purpose there is another built-in tool: artifacts.

And the job output:

Logs from the job with storing build artifacts

Here the log shows that artifacts have been stored. Now, as they were marked as public in artifacts step, they are available in the UI:

The Run page, Artifacts tab

This is it. In this installment we learn how to clone Git repository, how to run tests using Pytest, how to install dependencies and how to build artifacts and store them in Kraken’s storage. More about Kraken CI you can find on https://kraken.ci.

--

--

Michal Nowikowski
Michal Nowikowski

Written by Michal Nowikowski

Kraken CI Founder. I’m software engineer focused on full-stack programming and improving software processes.

No responses yet