/poc-tekton

Primary LanguageNixMIT LicenseMIT

This is an experimental project with Tekton and Nix.

The goal is to define a Pipeline to build and deploy a Go application.

Requirements

  • A Kubernetes cluster
  • Tekton Pipelines is already deployed

Getting Started

Deploy tasks

We first need to deploy some tasks

$ kubectl apply -f ci/task-build-docker-image.yaml
$ kubectl apply -f ci/task-check-deploy.yaml

We then need to add a task to update the digest resource. This is a workaround (see tektoncd/catalog#68 and tektoncd/pipeline#216)

$ kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/0b48da8e336a4214aff46af242658dc056199b1c/update-image-digests/image-digest-updater.yaml
$ kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/0b48da8e336a4214aff46af242658dc056199b1c/update-image-digests/update-image-digests.yaml

Deploy and run the pipeline

We can now create the pipeline:

$ kubectl apply -f ci/pipeline.yaml

To push to an authenticated registry, we need to expose a Docker config.json file to n2k8s. See https://github.com/nlewo/n2k8s#authentication for details.

$ kubectl create configmap docker-config --from-file=~/.docker/config.json

We can finally run the Pipeline:

$ kubectl apply -f ci/pipeline-run.yaml

Display logs

To display the logs of the Pipeline run with the Tekton CLI:

$ tkn pipelinerun logs hello-world-pipeline-run -f

At the end, we should be able to get a http respond from the web application:

$ curl $(kubectl get svc hello-world -o jsonpath="{.status.loadBalancer.ingress[*].hostname}")
hello world