首先通过PipelineResource定义源代码的配置信息,存放在 swurtmp-git-resource.yaml 文件中,
type 指定了类型为 git。
apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
name: swurtmp-git-resource
namespace: swurtmp-harbor
spec:
type: git
params:
- name: url
value: http://duanmin:******@git.siwill.com/SW-BDP/swurtmp.git
- name: revision
value: master
第二个资源存放前端源码的git数据源,存放在git-ui-resource.yaml文件中:
apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
name: git-ui-resource
namespace: swurtmp-harbor
spec:
type: git
params:
- name: url
value: http://duanmin:******@git.siwill.com/SW-BDP/metromanage.git
- name: revision
value: master
如果git仓库不是公开的,需要定义账号密码信息,存放在 swurtmp-git-secret.yaml 文件中,
annotations 中的 tekton.dev/git-0 指定了将此账号密码信息应用于哪个域名下的git仓库。
apiVersion: v1
kind: Secret
metadata:
name: swurtmp-git-secret
namespace: swurtmp-harbor
annotations:
tekton.dev/git-0: http://git.siwill.com
type: kubernetes.io/basic-auth
stringData:
username: duanmin
password: "******"
新建第三和第四个资源,由于dubbo项目,提供方和消费方的服务是分开的,所以分别新建两个
资源文件image-provider-resource.yaml和image-consumer-resource.yaml,用于镜像仓库地址资
源配置,type 指定了类型是 image。
#image-provider-resource.yaml
apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
name: provider-image-resource
namespace: swurtmp-harbor
spec:
type: image
params:
- name: url
value: 192.168.20.69/swurtmp/provider
#image-consumer-resource.yaml
apiVersion: tekton.dev/v1alpha1