Skip to content


We will now see how to build a CI/CD pipeline on Patr.

Step 1: Navigate to CI/CD

Navigate to the CI/CD section on Patr.

Step 2: Connect a GitHub account

Connect your Git Provider. Start by clicking on the Connect Git Provider button. You will then be prompted to log in with your GitHub account. CI-GitHub

Step 3: Activate a repository

Once you've logged in to your GitHub account, you'll be able to view all your GitHub repositories. GitHub-Repositories

Let's start with selecting the repository we want to setup builds for, and click on it.

Once opened, you'll see an Activate button. Click on it to activate the repository and select the required Machine Type.

Activate Repository

Step 4: Setup your CI Pipeline

Once activated, any new commits pushed to the repository will now be built by the Patr CI/CD pipeline.

Activated Repository

Now, in order to setup our CI/CD pipeline, we'll need to create a special file in our repository root directory called patr.yml.

This file can be generated from the Patr UI, in the Pipeline tab of the repository.

A sample patr.yml file is shown below.

kind: pipeline
name: Default

  - name: "Install Dependencies"
    image: node:latest
      - npm ci

  - name: "Run tests"
    image: node:latest
      - npm run test

  - name: "Build"
    image: node:latest
      - npm run build
      NODE_ENV: "production"

  - name: "Publish on Patr"
    image: node:latest
      - npm run publish

Let's break down the file above into parts.

First, we have the following:

kind: pipeline
name: Default

Then, we start by defining the steps in the steps: part.

Each step defined in the pipeline is a docker container that gets executed. For each step, the CI pipeline will create a new docker container, mount your code in the current working directory as a volume, and execute the commands defined in the commands: part.

This way, you can execute any command in the docker container that is required to build your application.

Additionally, because each step is a docker container, you can also mention certain steps of your application to deploy your website upon successful completion. Each step will only execute if the previous step has exited with a success status code (a zero status code), so your applications will only be deployed if all previous steps have completed successfully.

You can also use these steps to get alerts and notifications in case your build fails.