Skip to content

A simple CI/CD pipeline built with Tekton that clones a Git repo, builds a Dockerfile and uploads the resulting image to a registry.

Notifications You must be signed in to change notification settings

felipecruz91/tekton-example-2

Repository files navigation

Tekton tutorial

A simple CI/CD pipeline built with Tekton that clones a Git repo, builds a Dockerfile and uploads the resulting image to a registry.

tutorial-pipeline-run

Installation

Install Tekton Core Components

kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml

Install Tekton Dashboard

kubectl apply --filename https://github.com/tektoncd/dashboard/releases/latest/download/tekton-dashboard-release.yaml

Assuming tekton-pipelines is the install namespace for the Dashboard, run the following command:

kubectl --namespace tekton-pipelines port-forward svc/tekton-dashboard 9097:9097

Visit http://localhost:9097 to access the Tekton Dashboard.

Run Locally

Clone the project

git clone https://github.com/felipecruz91/tekton-example-2

Go to the project directory

cd tekton-example-2

Environment Variables

To run this project in a corporate environment, you will need to configure the proxy settings in two places:

- name: httpsProxy
  value: "<YOUR_CORPORATE_PROXY>"
  - name: https_proxy
    value: "<YOUR_CORPORATE_PROXY>"

Secrets

You must create a secret to push your image to your desired image registry:

kubectl create secret docker-registry regcred \
                    --docker-server=<your-registry-server> \
                    --docker-username=<your-name> \
                    --docker-password=<your-pword> \
                    --docker-email=<your-email>

Create the pipeline resources such as the Git repository and the image:

kubectl apply -f pipeline-resources/

Create a service account that uses the regcred credentials to push the image to your registry:

kubectl apply -f tutorial-serviceaccount.yaml

Create a Task which defines the git input and image output introduced earlier:

kubectl apply -f build-docker-image-from-git-source.yaml

You are now ready for your first TaskRun!

A TaskRun binds the inputs and outputs to already defined PipelineResources, sets values for variable substitution parameters, and executes the Steps in the Task.

kubectl apply -f build-docker-image-from-git-source-task-run.yaml

A Pipeline defines an ordered series of Tasks that you want to execute along with the corresponding inputs and outputs for each Task.

kubectl apply -f tutorial-pipeline.yaml

Finally, run the pipeline:

kubectl apply -f tutorial-pipeline-run-1.yaml

About

A simple CI/CD pipeline built with Tekton that clones a Git repo, builds a Dockerfile and uploads the resulting image to a registry.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published