Skip to content

Latest commit

 

History

History
73 lines (53 loc) · 2.44 KB

DEVELOPMENT.md

File metadata and controls

73 lines (53 loc) · 2.44 KB

Development guide

Local Kubernetes Cluster with Tekton

To setup a local development environment for Tekton based CI and CD pipelines hosted in this repo, the first step is to run Tekton in a local cluster.

There are several options available, minikube, kind and k3c are good options to run a kubernetes cluster on your laptop. If you have go 1.14+ and docker installed, you can use the automated script for kind:

# Install Kind if not installed yet
GO111MODULE="on" go get sigs.k8s.io/[email protected]

# Delete any pre-existing Tekton cluster
kind delete cluster --name tekton

# Install the new cluster
./hack/tekton_in_kind.sh

If the deployment was successful, you should see a message:

Tekton Dashboard available at http://localhost:9097”

Tekton Based CI

Setting up a working CI with a local cluster requires using a service like smee to forward GitHub webhooks to the service in your local cluster.

In the following steps we use smee. You will need npm to install the client. You will also need tkn installed to run the webhook creation task.

# Install the smee client
npm install -g smee-client

You will use webhooks triggered by your personal fork of the tektoncd/plumbing repo and forward them the cluster running on your laptop.

Create a GitHub personal token with admin:repo_hook permissions at least. This will be used to create the webhook.

Run the script below to deploy Tekton CI on the local kind cluster:

./hack/tekton_ci.sh -u <github-user> -t <github-token> -o <github-org> -r <github-repo>

Push or sync a PR to your fork, and watch the pipelines running in your cluster. You can use redeliver from the GitHub webhook UI to resend and event and re-trigger pipelines.

This guide does not include setting up status updates back to GitHub. If you need those for development, you'll need to ensure that:

  • Install resources under tekton/resources to deploy the tekton-events event listener
  • Configure Tekton send cloud events to the tekton-events event listener like on the dogfooding cluster.
  • Create the secret needed by the GitHub update jobs to update status checks.

See also _CONTRIBUTING.md.