pipelines-as-code

module
Version: v0.0.0-...-954cc1b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2021 License: Apache-2.0

README

This documentation refers to the main developement branch, the documentation for the released version is here

Pipelines as Code

Container Repository on Quay codecov Go Report Card

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

Introduction

Pipelines as Code let you use the Pipelines as Code flow directly with 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.

Here is a video on how to get started with the tkn pac cli and its bootstrap command :

Getting started to Pipelines as Code

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 via a Prow style OWNER file.

  • tkn-pac plugin for Tekton CLI for managing pipelines-as-code repositories and bootstrapping

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 launch 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 for example installing on Github Enteprise.

For more detailled 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.

In order to enable the GitHub App provided by admin on your Git repository as documented here. Otherwise you can go to the Settings > Applications and then click on Configure button near the GitHub App you had created. In the Repository access section, select the repositories that you want to enable and have access to Pipelines-as-code.

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

$ git clone https://github.com/siamaksade/pipeline-as-code-demo
$ cd pipeline-as-code-demo
$ tkn pac repository create

? Enter the namespace where the pipeline should run (default: pipelines-as-code):  demo
? Enter the Git repository url containing the pipelines (default: https://github.com/siamaksade/pipeline-as-code-demo):
? Enter the target GIT branch (default: main):
? Enter the Git event type for triggering the pipeline:  pull_request
! Namespace demo is not created yet
? Would you like me to create the namespace demo? Yes
✓ Repository pipeline-as-code-demo-pull-request has been created in demo namespace
? Would you like me to create a basic PipelineRun file into the file .tekton/pull_request.yaml ? True
✓ A basic template has been created in /Users/ssadeghi/Projects/pipelines/pac-demo/.tekton/pull_request.yaml, feel free to customize it.
ℹ You can test your pipeline manually with : tkn-pac resolve -f .tekton/pull_request.yaml | kubectl create -f-
ℹ Don't forget to install the GitHub application into your repo https://github.com/siamaksade/pipeline-as-code-demo
✓ and we are done! enjoy :)))

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 Github application is the preferred method, Pipeline As Code supports Github Webhook and Bitbucket Cloud as well, see the INSTALL guide for reference

Usage Guide

The usage guide here offer a comprehenive documentatiuon on how to configure and use Pipeline As Code.

A walkthought video is available here.

Videos/Blog Posts

Directories

Path Synopsis
cmd
pkg
acl
apis/pipelinesascode/v1alpha1
Package v1alpha1 is the v1alpha1 version of the API.
Package v1alpha1 is the v1alpha1 version of the API.
generated/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
generated/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
generated/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
generated/clientset/versioned/typed/pipelinesascode/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
generated/clientset/versioned/typed/pipelinesascode/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
git
hub
test

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL