构建部署拆分成两个job
This commit is contained in:
35
SCM/初版本/deploy_image_s1_lessie_go_api.groovy
Normal file
35
SCM/初版本/deploy_image_s1_lessie_go_api.groovy
Normal file
@@ -0,0 +1,35 @@
|
||||
pipeline {
|
||||
agent any
|
||||
parameters {
|
||||
imageTag(
|
||||
name: 'IMAGE_NAME',
|
||||
description: '此处是 sit 命名空间内的镜像',
|
||||
registry: 'https://uswccr.ccs.tencentyun.com',
|
||||
image: 'lessiesit/lessie-sourcing-agents',
|
||||
credentialId: 'dxin_img_hub_auth',
|
||||
filter: '.*',
|
||||
verifySsl: true
|
||||
)
|
||||
}
|
||||
environment {
|
||||
// 将 kubeconfig 凭证路径赋值给 KUBECONFIG 环境变量,凭证 ID 与 Jenkins 中配置的一致
|
||||
KUBECONFIG = credentials('k8s-test-config-admin')
|
||||
}
|
||||
stages {
|
||||
stage('部署') {
|
||||
steps {
|
||||
script {
|
||||
// 提取纯标签(去掉附加的Label信息)
|
||||
// def pureTag = params.IMAGE_NAME.split(' ')[0]
|
||||
// echo "开始部署镜像:uswccr.ccs.tencentyun.com/lessietest/lessie-sourcing-agents:${pureTag}"
|
||||
// 部署命令(如kubectl、docker run等)
|
||||
sh """
|
||||
kubectl apply -f lessie-sourcing-agents.yaml
|
||||
"""
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user