2-2同步

This commit is contained in:
2026-02-02 00:56:16 +08:00
parent 03e175b47c
commit 8ffe3e0e15
5 changed files with 99 additions and 69 deletions

View File

@@ -16,7 +16,7 @@ pipeline {
name: 'IMAGE_NAME',
description: 'sit 仓库镜像 (除非输入 CUSTOM_IMAGE, 否则使用这里的)',
registry: 'https://uswccr.ccs.tencentyun.com',
image: 'lessiesit/lessie-review-service',
image: 'lessiesit/lessie-email',
credentialId: 'dxin_img_hub_auth',
filter: '.*',
defaultTag: '',
@@ -26,7 +26,7 @@ pipeline {
string(
name: 'CUSTOM_IMAGE',
defaultValue: '',
description: '手输完整镜像<registry>/<namespace>/<repo>:<tag>,例如: uswccr.ccs.tencentyun.com/lessiesit/lessie-sourcing-agents:v0.0.1 (填充后,则忽略镜像仓库选择)'
description: '手输完整镜像<registry>/<namespace>/<repo>:<tag>,例如: uswccr.ccs.tencentyun.com/lessiesit/lessie-email:v0.0.1 (填充后,则忽略镜像仓库选择)'
)
booleanParam(
name: 'ROLLBACK_VERSION',
@@ -42,11 +42,11 @@ pipeline {
environment {
LARK_ROBOT = "4b8d66d0-c0f0-4587-b0e5-cff772cb3046" // ID
KUBECONFIG = credentials('k8s-test-config-admin') // k8s ID, Jenkins
Deployment_yaml = "${WORKSPACE}/lessie-ai/sit/s1/lessie-review-service.yaml"
Deployment_name = "sit-lessie-review-service"
Deployment_yaml = "${WORKSPACE}/lessie-ai/sit/s1/lessie-email.yaml"
Deployment_name = "s1-lessie-email"
K8s_namespace = "sit"
Pod_container_name = "lessie-review-service"
Pod_environment = "sit"
Pod_container_name = "lessie-email"
Pod_environment = "s1"
}
stages {
stage('回滚上版') {
@@ -86,7 +86,7 @@ pipeline {
def matcher = (customImage =~ imageRegex)
if (!matcher.matches()) {
error "CUSTOM_IMAGE 格式不正确,必须是 registry/namespace/repository:tag 格式\n" +
"示例: uswccr.ccs.tencentyun.com/lessiesit/lessie-sourcing-agents:v1.0.0\n" +
"示例: uswccr.ccs.tencentyun.com/lessie-ai-web:v1.0.0\n" +
"当前输入: ${customImage}"
}
@@ -188,21 +188,25 @@ pipeline {
sh """
echo "--- Deployment 状态 ---"
kubectl describe deployment ${Deployment_name} -n ${K8s_namespace} || true
echo " "
echo '--- Pod 列表 ---'
kubectl get pods -n ${K8s_namespace} -l "app=${Pod_container_name},environment=${Pod_environment}" -o wide || true
echo " "
echo "--- Pod 描述 (describe) ---"
for pod in \$(kubectl get pods -n ${K8s_namespace} -l "app=${Pod_container_name},environment=${Pod_environment}" -o jsonpath='{.items[*].metadata.name}'); do
echo "-- Pod 描述 \$pod --"
kubectl describe pod \$pod -n ${K8s_namespace} || true
done
echo " "
echo "--- 最近 200 行 Pod 日志 ---"
for pod in \$(kubectl get pods -n ${K8s_namespace} -l "app=${Pod_container_name},environment=${Pod_environment}" -o jsonpath='{.items[*].metadata.name}'); do
echo "-- logs \$pod --"
kubectl logs \$pod -n ${K8s_namespace} --tail=200 || true
done
echo " "
"""
error("=== Deployment 发布失败,请检查以上输出定位问题 ===")
}