♻️ Add ci/cd
Signed-off-by: devad <cossjie@foxmail.com> Former-commit-id: 07bc45a09f3b9c23d42319aceb41782f56d22a46
This commit is contained in:
parent
b86bd44f0c
commit
844797ad07
|
@ -0,0 +1,106 @@
|
||||||
|
version: 2
|
||||||
|
name: api
|
||||||
|
description: ""
|
||||||
|
global:
|
||||||
|
concurrent: 1
|
||||||
|
param:
|
||||||
|
- ref: deploy_path
|
||||||
|
name: deploy_path
|
||||||
|
value: '"pcm-coordinator-api.yaml"'
|
||||||
|
required: false
|
||||||
|
type: STRING
|
||||||
|
hidden: false
|
||||||
|
- ref: nacos_host
|
||||||
|
name: nacos_host
|
||||||
|
value: '"10.206.0.12"'
|
||||||
|
required: false
|
||||||
|
type: STRING
|
||||||
|
hidden: false
|
||||||
|
- ref: secret_name
|
||||||
|
name: ""
|
||||||
|
value: '"jcce-aliyuncs"'
|
||||||
|
required: false
|
||||||
|
type: STRING
|
||||||
|
hidden: false
|
||||||
|
- ref: project_name
|
||||||
|
name: ""
|
||||||
|
value: '"pcm-coordinator-api"'
|
||||||
|
required: false
|
||||||
|
type: STRING
|
||||||
|
hidden: false
|
||||||
|
trigger:
|
||||||
|
webhook: gitlink@1.0.0
|
||||||
|
event:
|
||||||
|
- ref: create_tag
|
||||||
|
ruleset:
|
||||||
|
- param-ref: tag
|
||||||
|
operator: EQ
|
||||||
|
value: '""'
|
||||||
|
ruleset-operator: AND
|
||||||
|
workflow:
|
||||||
|
- ref: start
|
||||||
|
name: 开始
|
||||||
|
task: start
|
||||||
|
- ref: git_clone_0
|
||||||
|
name: git clone
|
||||||
|
task: git_clone@1.2.6
|
||||||
|
input:
|
||||||
|
remote_url: '"https://gitlink.org.cn/jcce-pcm/pcm-coordinator.git"'
|
||||||
|
ref: '"refs/heads/master"'
|
||||||
|
commit_id: '""'
|
||||||
|
depth: 1
|
||||||
|
needs:
|
||||||
|
- start
|
||||||
|
- ref: docker_image_build_0
|
||||||
|
name: docker镜像构建
|
||||||
|
task: docker_image_build@1.6.0
|
||||||
|
input:
|
||||||
|
docker_username: ((dev.docker_user))
|
||||||
|
docker_password: ((dev.docker_password))
|
||||||
|
image_name: '"registry.cn-hangzhou.aliyuncs.com/jcce/pcm-coordinator-api"'
|
||||||
|
image_tag: git_clone_0.commit_time
|
||||||
|
registry_address: '"registry.cn-hangzhou.aliyuncs.com"'
|
||||||
|
docker_build_path: git_clone_0.git_path
|
||||||
|
workspace: git_clone_0.git_path
|
||||||
|
image_clean: true
|
||||||
|
image_push: true
|
||||||
|
build_args: '""'
|
||||||
|
needs:
|
||||||
|
- shell_0
|
||||||
|
- ref: end
|
||||||
|
name: 结束
|
||||||
|
task: end
|
||||||
|
needs:
|
||||||
|
- kubectl_deploy_0
|
||||||
|
- ref: kubectl_deploy_0
|
||||||
|
name: kubectl部署资源
|
||||||
|
task: kubectl_deploy@1.1.0
|
||||||
|
input:
|
||||||
|
command: '"apply"'
|
||||||
|
resource_file_path: git_clone_0.git_path
|
||||||
|
certificate_authority_data: ((dev.k8s_cad))
|
||||||
|
server: '"https://119.45.100.73:6443"'
|
||||||
|
client_certificate_data: ((dev.k8s_ccd))
|
||||||
|
client_key_data: ((dev.k8s_ckd))
|
||||||
|
hosts: '""'
|
||||||
|
needs:
|
||||||
|
- docker_image_build_0
|
||||||
|
- ref: shell_0
|
||||||
|
name: shell
|
||||||
|
image: docker.jianmuhub.com/library/debian:buster-slim
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: '"registry.cn-hangzhou.aliyuncs.com/jcce/pcm-coordinator-api"'
|
||||||
|
IMAGE_TAG: git_clone_0.commit_time
|
||||||
|
SECRET_NAME: global.secret_name
|
||||||
|
NACOS_HOST: global.nacos_host
|
||||||
|
PROJECT_NAME: global.project_name
|
||||||
|
PROJECT_PATH: git_clone_0.git_path
|
||||||
|
script:
|
||||||
|
- cd ${PROJECT_PATH}
|
||||||
|
- sed -i "s#image_name#${IMAGE_NAME}:${IMAGE_TAG}#" ${PROJECT_NAME}.yaml
|
||||||
|
- sed -i "s#secret_name#${SECRET_NAME}#" ${PROJECT_NAME}.yaml
|
||||||
|
- sed -i "s#nacos_host#${NACOS_HOST}#" ${PROJECT_NAME}.yaml
|
||||||
|
- cat ${PROJECT_NAME}.yaml
|
||||||
|
needs:
|
||||||
|
- git_clone_0
|
||||||
|
|
|
@ -0,0 +1,106 @@
|
||||||
|
version: 2
|
||||||
|
name: rpc
|
||||||
|
description: ""
|
||||||
|
global:
|
||||||
|
concurrent: 1
|
||||||
|
param:
|
||||||
|
- ref: deploy_path
|
||||||
|
name: deploy_path
|
||||||
|
value: '"pcm-coordinator-rpc.yaml"'
|
||||||
|
required: false
|
||||||
|
type: STRING
|
||||||
|
hidden: false
|
||||||
|
- ref: nacos_host
|
||||||
|
name: nacos_host
|
||||||
|
value: '"10.206.0.12"'
|
||||||
|
required: false
|
||||||
|
type: STRING
|
||||||
|
hidden: false
|
||||||
|
- ref: secret_name
|
||||||
|
name: ""
|
||||||
|
value: '"jcce-aliyuncs"'
|
||||||
|
required: false
|
||||||
|
type: STRING
|
||||||
|
hidden: false
|
||||||
|
- ref: project_name
|
||||||
|
name: ""
|
||||||
|
value: '"pcm-coordinator-rpc"'
|
||||||
|
required: false
|
||||||
|
type: STRING
|
||||||
|
hidden: false
|
||||||
|
trigger:
|
||||||
|
webhook: gitlink@1.0.0
|
||||||
|
event:
|
||||||
|
- ref: create_tag
|
||||||
|
ruleset:
|
||||||
|
- param-ref: tag
|
||||||
|
operator: EQ
|
||||||
|
value: '""'
|
||||||
|
ruleset-operator: AND
|
||||||
|
workflow:
|
||||||
|
- ref: start
|
||||||
|
name: 开始
|
||||||
|
task: start
|
||||||
|
- ref: git_clone_0
|
||||||
|
name: git clone
|
||||||
|
task: git_clone@1.2.6
|
||||||
|
input:
|
||||||
|
remote_url: '"https://gitlink.org.cn/jcce-pcm/pcm-coordinator.git"'
|
||||||
|
ref: '"refs/heads/master"'
|
||||||
|
commit_id: '""'
|
||||||
|
depth: 1
|
||||||
|
needs:
|
||||||
|
- start
|
||||||
|
- ref: docker_image_build_0
|
||||||
|
name: docker镜像构建
|
||||||
|
task: docker_image_build@1.6.0
|
||||||
|
input:
|
||||||
|
docker_username: ((dev.docker_user))
|
||||||
|
docker_password: ((dev.docker_password))
|
||||||
|
image_name: '"registry.cn-hangzhou.aliyuncs.com/jcce/pcm-coordinator-rpc"'
|
||||||
|
image_tag: git_clone_0.commit_time
|
||||||
|
registry_address: '"registry.cn-hangzhou.aliyuncs.com"'
|
||||||
|
docker_build_path: git_clone_0.git_path
|
||||||
|
workspace: git_clone_0.git_path
|
||||||
|
image_clean: true
|
||||||
|
image_push: true
|
||||||
|
build_args: '""'
|
||||||
|
needs:
|
||||||
|
- shell_0
|
||||||
|
- ref: end
|
||||||
|
name: 结束
|
||||||
|
task: end
|
||||||
|
needs:
|
||||||
|
- kubectl_deploy_0
|
||||||
|
- ref: kubectl_deploy_0
|
||||||
|
name: kubectl部署资源
|
||||||
|
task: kubectl_deploy@1.1.0
|
||||||
|
input:
|
||||||
|
command: '"apply"'
|
||||||
|
resource_file_path: git_clone_0.git_path
|
||||||
|
certificate_authority_data: ((dev.k8s_cad))
|
||||||
|
server: '"https://119.45.100.73:6443"'
|
||||||
|
client_certificate_data: ((dev.k8s_ccd))
|
||||||
|
client_key_data: ((dev.k8s_ckd))
|
||||||
|
hosts: '""'
|
||||||
|
needs:
|
||||||
|
- docker_image_build_0
|
||||||
|
- ref: shell_0
|
||||||
|
name: shell
|
||||||
|
image: docker.jianmuhub.com/library/debian:buster-slim
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: '"registry.cn-hangzhou.aliyuncs.com/jcce/pcm-coordinator-rpc"'
|
||||||
|
IMAGE_TAG: git_clone_0.commit_time
|
||||||
|
SECRET_NAME: global.secret_name
|
||||||
|
NACOS_HOST: global.nacos_host
|
||||||
|
PROJECT_NAME: global.project_name
|
||||||
|
PROJECT_PATH: git_clone_0.git_path
|
||||||
|
script:
|
||||||
|
- cd ${PROJECT_PATH}
|
||||||
|
- sed -i "s#image_name#${IMAGE_NAME}:${IMAGE_TAG}#" ${PROJECT_NAME}.yaml
|
||||||
|
- sed -i "s#secret_name#${SECRET_NAME}#" ${PROJECT_NAME}.yaml
|
||||||
|
- sed -i "s#nacos_host#${NACOS_HOST}#" ${PROJECT_NAME}.yaml
|
||||||
|
- cat ${PROJECT_NAME}.yaml
|
||||||
|
needs:
|
||||||
|
- git_clone_0
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
metadata:
|
metadata:
|
||||||
name: pcm-participant-rpc-deployment
|
name: pcm-coordinator-rpc-deployment
|
||||||
namespace: jcce-system
|
namespace: jcce-system
|
||||||
labels:
|
labels:
|
||||||
k8s-app: pcm-participant-rpc
|
k8s-app: pcm-coordinator-rpc
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
k8s-app: pcm-participant-rpc
|
k8s-app: pcm-coordinator-rpc
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
name: pcm-participant-rpc
|
name: pcm-coordinator-rpc
|
||||||
labels:
|
labels:
|
||||||
k8s-app: pcm-participant-rpc
|
k8s-app: pcm-coordinator-rpc
|
||||||
spec:
|
spec:
|
||||||
hostAliases:
|
hostAliases:
|
||||||
- hostnames:
|
- hostnames:
|
||||||
|
@ -23,7 +23,7 @@ spec:
|
||||||
imagePullSecrets:
|
imagePullSecrets:
|
||||||
- name: secret_name
|
- name: secret_name
|
||||||
containers:
|
containers:
|
||||||
- name: pcm-participant-rpc
|
- name: pcm-coordinator-rpc
|
||||||
image: image_name
|
image: image_name
|
||||||
resources: {}
|
resources: {}
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
|
@ -53,12 +53,12 @@ apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
namespace: jcce-system
|
namespace: jcce-system
|
||||||
name: pcm-participant-rpc-service
|
name: pcm-coordinator-rpc-service
|
||||||
labels:
|
labels:
|
||||||
k8s-service: pcm-participant-rpc
|
k8s-service: pcm-coordinator-rpc
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
k8s-app: pcm-participant-rpc
|
k8s-app: pcm-coordinator-rpc
|
||||||
ports:
|
ports:
|
||||||
- name: web
|
- name: web
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
|
|
Loading…
Reference in New Issue