Tekton is a cloud-native solution for building CI/CD systems which consists of Pipelines,Tasks,PipelineRuns,TaskRuns that can help us:
- Build chaincode images and push image after build is done
Tekton pipeline will be automatically installed with fabric-operator
Todo: Install tasks/pipelines for ChaincodeBuild
- Tekton-CI Serivce
- Minio Service
git-clone
task 0.3
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/git-clone/0.3/raw
kubectl apply -f ./task/minio-fetch/minio-fetch.yaml
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/docker-build/0.1/raw
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/kaniko/0.6/raw
- build with
kaniko
task (Recommended)
kubectl apply -f ./pipelines/chaincodebuild-kaniko.yaml
- build with
docker build
task
kubectl apply -f ./pipelines/chaincodebuild.yaml
This pipeline builds chaincode source code into a container image with srouce-fetch
and docker build
.
Now we supports two kind of sources in pipeline chaincodebuild
Parameter | Description | Default | Required |
---|---|---|---|
SOURCE |
The source type where chaincode code stores.Now supports minio,git | default minio . |
required |
SOURCE_MINIO_BUCKET |
minio's bucket name | default bestchains . |
required when using minio |
SOURCE_MINIO_OBJECT |
minio's object path | default "" | required when using minio |
SOURCE_MINIO_HOST |
minio host/domain to fetch (fabric-minio.baas-system.svc.cluster.local) | default fabric-minio.baas-system.svc.cluster.local . |
required when using minio |
SOURCE_MINIO_ACCESS_KEY |
the accessKey used to fetch minio object | default | required when using minio |
SOURCE_MINIO_SECRET_KEY |
the secretKey used to fetch minio object | default | required when using minio |
SOURCE_GIT_URL |
The git repo url where the source code resides | default | required when using git |
SOURCE_GIT_REFERENCE |
The branch, tag or SHA to checkout. | default | optional |
SOURCE_GIT_INIT_IMAGE |
The init image of git-clone | default | optional |
APP_IMAGE |
The chaincode name of the image to build | default | required |
DOCKERFILE |
The path of the dockerfile to execute | default ./Dockerfile |
required |
CONTEXT |
The path of the directory to use as context | default . . |
required |
INSECURE_REGISTRY |
Allows the user to push to an insecure registry that has been specified | default | optional |
When user needs to push image to a registry which needs authorization,you should create a push secret and reference it in workspace.
- create a docker config secret
- update the docker config file
- change the secret namespace to
PipelineRun Namespace
kubectl create secret generic dockerhub-secret --from-file=/root/.docker/config.json -n {Pipeline_Run_Namespace}
- reference it in
PipelineRun
reference here Sample with source git
workspaces:
- name: source-ws
subPath: source
persistentVolumeClaim:
claimName: sample-minio-kaniko-ws-pvc
- name: dockerconfig-ws
secret:
secretName: dockerhub-secret
- Sample for Task
minio-fetch
- Sample for Pipeline
chaincodebuild
- Sample for Pipeline
chaincodebuild-kaniko
(Not supported yet)