Skip to content

openshift-pipelines/pipelines-as-code

Repository files navigation

Pipelines-as-Code

Container Repository on GHC codecov Go Report Card E2E Tests

Pipelines-as-Code -- An opinionated CI based on OpenShift Pipelines / Tekton.

Full documentation for the stable version is available from https://pipelinesascode.com Documentation for the development branch is available here

Introduction

Pipelines-as-Code let you use the Pipelines-as-Code flow directly with Tekton and OpenShift Pipelines.

The goal of Pipelines-as-Code is to let you define your Tekton templates inside your source code repository and have the pipeline run and report the status of the execution when triggered by a Pull Request or a Push.

Pipelines-as-Code features:

  • Pull-request status support: When iterating over a Pull Request, status and control is done on the platform.

  • GitHub Checks API support to set the status of a PipelineRun including rechecks

  • GitHub Pull Request and Commit event support

  • Pull-request actions in comments such as /retest

  • Git events filtering and support for separate pipelines for each event

  • Automatic Task resolution in Pipelines (local Tasks, Tekton Hub and remote URLs)

  • Efficient use of GitHub blobs and objects API for retrieving configurations

  • ACL over a GitHub organization or with a Prow style OWNER file.

  • tkn-pac plug-in for Tekton CLI for managing pipelines-as-code repositories and bootstrapping.

  • GitLab, Bitbucket Server, Bitbucket Cloud and GitHub through Webhook support.

Installation Guide

The easiest way to get started is to use the tkn pac CLI and its bootstrap command.

Download and install first the tkn-pac CLI following these instructions.

Connected to your cluster execute the command :

-$ tkn pac bootstrap

and follow the questions and installation methods which will install Pipelines-as-Code on cluster and help you create a GitHub Application.

feel free to look over the --help to see the different options on how to install for example on GitHub Enterprise.

This getting started video will guide you thought the tkn-pac bootstrap flow using Kind :

Getting started to Pipelines-as-Code

For more details on the different installation method please follow this document for installing Pipelines-as-Code on OpenShift.

Getting Started

The flow for using pipelines as code generally begins with admin installing the Pipelines-as-Code infrastructure, creating a GitHub App and sharing the GitHub App URL across the organization for app teams to enable the app on their GitHub repositories.

Start creating a GitHub repository by going to this URL https://github.com/new, you will need to provide a name (eg: pac-demo) and check the "[ ] Add a README file" box before pressing the "Create Repository" button.

You are now able to enable the Pipelines-as-Code GitHub Application as created by the Admin onto your new repository by following this guide here.

Once you have enabled your GitHub App for your GitHub repository, you can use the Tekton CLI pac plug-in to bootstrap pipelines as code:

$ git clone https://github.com/youruser/pac-demo
$ cd pac-demo
$ tkn pac create repository
? Enter the Git repository url containing the pipelines (default: https://github.com/youruser/pac-demo):
? Please enter the namespace where the pipeline should run (default: pac-demo):
! Namespace pac-demo is not found
? Would you like me to create the namespace pac-demo? Yes
✓ Repository youruser-pac-demo has been created in pac-demo namespace
ℹ Directory .tekton has been created.
✓ A basic template has been created in .tekton/pipelinerun.yaml, feel free to customize it.
ℹ You can test your pipeline by pushing the generated template to your git repository

The above command would create a Repository CRD in your demo namespace which is used to determine where the PipelineRuns for your GitHub repository should run. It also generates an example pipeline in the .tekton folder. Commit and push the pipeline to your repo to start using pipelines as code.

Note that even if installing with GitHub application is the preferred installation method, Pipeline As Code supports other methods :

  • GitHub direct Webhook
  • GitLab public and private instances.
  • Bitbucket Cloud
  • Bitbucket Server

You can use the command tkn pac webhook to help you update webhooks on your repository. See the INSTALL guide for more details on each install method.

Usage Guide

The usage guide available here offer a comprehensive documentation on how to use and configure Pipeline As Code.

Contributing

We ❤️ our contributors!

If you want to help and contribute to the pipelines-as-code project, you can see the documentation here to get started: https://pipelinesascode.com/dev/ (and thank you).

Getting in touch

There are several ways to communicate with us:

Videos/Blog Posts