|
| 1 | +# Tekton pipeline / task example |
| 2 | + |
| 3 | +## Files |
| 4 | + |
| 5 | +auth.yaml: (template) create secrets for github and docker registry and create the service account |
| 6 | +gitconfig: (template) data file for the gitconfig configmap. The config map is created by `kubectl create configmap promoteconfigmap --from-file=gitconfig` |
| 7 | + |
| 8 | +promotesecret.yaml: (template) create an access token secret for the github repository |
| 9 | +resources.yaml: (template) create pipeline resources for github and docker repository |
| 10 | + |
| 11 | +build-task.yaml: create a build push task |
| 12 | +servicepromote.yaml: (template)create a promote from service repo to env repo task |
| 13 | +servicepromotepipeline.yaml: create a pipeline that executes build, push and promote |
| 14 | +servicepromotepipelinerun.yaml: create a pipelinerun that executes the servicepromotepipeline |
| 15 | + |
| 16 | +promote.yaml: (template)create a promote from one env repo to another env repo task |
| 17 | +promoterun.yaml: create a taskrun that execute promote task |
| 18 | + |
| 19 | +## Build docker image with `service promote` command |
| 20 | + |
| 21 | +- clone this repository |
| 22 | +- run `docker build -t <image name> .` in repository root directory |
| 23 | +- run `docker tag <image name> <your docker hub id>/<image name>` toi tag the image |
| 24 | +- run `docker login` to login to the docker hub |
| 25 | +- run `docker push <your docker hub id>/<image name>` to push the image to the docker hub |
| 26 | + |
| 27 | +## Create Tekton resource |
| 28 | + |
| 29 | +- edit all yaml files marked as (template) and gitconfig file. `<xxx>` must be replaced with the real value |
| 30 | +- create a new namespace e.g. `kubectl create ns promote` |
| 31 | +- apply auth.yaml, promotesecret.yaml, resources.yaml, build-task.yaml, servicepromote.yaml and servicepromotepipelinerun.yaml in the namespace e.g. `kubectl -n <namespace> apply -f <yaml file name> |
| 32 | +- create a configmap by `kubectl create configmap promoteconfigmap --from-file=gitconfig -n <namespace>` |
| 33 | + |
| 34 | +## Execute pipeline |
| 35 | + |
| 36 | +- create the servicepromotepipelinerun by applying servicepromotepipelinerun.yaml e.g. `apply -n <namespace> apply -f servicepromotepipelinerun.yaml` |
0 commit comments