add:新增商机管理-客户管理页面
This commit is contained in:
163
Jenkinsfile
vendored
163
Jenkinsfile
vendored
@@ -28,7 +28,7 @@ pipeline {
|
||||
extensions : [
|
||||
[$class: 'RelativeTargetDirectory', relativeTargetDir: 'docker'],
|
||||
],
|
||||
userRemoteConfigs: [[credentialsId: 'jenkins', url: 'https://gitlab.fengchaoit.com/basic/buildscripts.git']]
|
||||
userRemoteConfigs: [[credentialsId: '82ba88dd-b6dd-46f0-8448-3cbd60bf15c2', url: 'https://gitea.zzmjart.com/mj/devopsscripts.git']]
|
||||
])
|
||||
sh "echo '拷贝Dockerfile文件'"
|
||||
sh "cp ./docker/front/Dockerfile ."
|
||||
@@ -49,9 +49,9 @@ pipeline {
|
||||
stage('推送镜像到镜像仓库') {
|
||||
steps {
|
||||
sh "echo '改镜像标签'"
|
||||
sh "docker tag $projectName:$targetVersion harbor.fengchaoit.com/$groupName/$projectName:$targetVersion"
|
||||
sh "docker tag $projectName:$targetVersion 172.31.127.251:8083/$groupName/$projectName:$targetVersion"
|
||||
sh "echo '镜像入库'"
|
||||
sh "docker push harbor.fengchaoit.com/$groupName/$projectName:$targetVersion"
|
||||
sh "docker push 172.31.127.251:8083/$groupName/$projectName:$targetVersion"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,57 +68,57 @@ pipeline {
|
||||
}
|
||||
|
||||
|
||||
stage('保存到发布版本目录'){
|
||||
when {
|
||||
expression { env.branch == "main" }
|
||||
}
|
||||
steps {
|
||||
sh "mkdir -p /projects/$groupName/$targetVersion/$projectName"
|
||||
sh "rm -f /projects/$groupName/$targetVersion/$projectName/*"
|
||||
sh "cp project/* /projects/$groupName/$targetVersion/$projectName/"
|
||||
script {
|
||||
if(Boolean.parseBoolean(proddeploy)) {
|
||||
sshPublisher(
|
||||
continueOnError: false,
|
||||
failOnError: true,
|
||||
publishers: [
|
||||
sshPublisherDesc(
|
||||
configName: env.branchConfig,
|
||||
transfers: [
|
||||
sshTransfer(
|
||||
cleanRemote: false,
|
||||
excludes: '',
|
||||
execCommand: [
|
||||
"echo 定位到项目位置",
|
||||
"cd /usr/local/fengchaoit/$projectName",
|
||||
"echo 授予启动脚本权限",
|
||||
"chmod +x ./apprun.sh",
|
||||
"echo 停止正在运行服务",
|
||||
"./apprun.sh remove",
|
||||
"echo 启动新构建服务",
|
||||
"./apprun.sh restart"
|
||||
].join('\n'),
|
||||
execTimeout: 120000,
|
||||
flatten: false,
|
||||
makeEmptyDirs: false,
|
||||
noDefaultExcludes: false,
|
||||
patternSeparator: '[, ]+',
|
||||
remoteDirectory: "/usr/local/fengchaoit/$projectName",
|
||||
remoteDirectorySDF: false,
|
||||
removePrefix: 'project',
|
||||
sourceFiles: 'project/*'
|
||||
)
|
||||
],
|
||||
usePromotionTimestamp: false,
|
||||
useWorkspaceInPromotion: false,
|
||||
verbose: true
|
||||
)
|
||||
]
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// stage('保存到发布版本目录'){
|
||||
// when {
|
||||
// expression { env.branch == "main" }
|
||||
// }
|
||||
// steps {
|
||||
// sh "mkdir -p /projects/$groupName/$targetVersion/$projectName"
|
||||
// sh "rm -f /projects/$groupName/$targetVersion/$projectName/*"
|
||||
// sh "cp project/* /projects/$groupName/$targetVersion/$projectName/"
|
||||
// script {
|
||||
// if(Boolean.parseBoolean(proddeploy)) {
|
||||
// sshPublisher(
|
||||
// continueOnError: false,
|
||||
// failOnError: true,
|
||||
// publishers: [
|
||||
// sshPublisherDesc(
|
||||
// configName: env.branchConfig,
|
||||
// transfers: [
|
||||
// sshTransfer(
|
||||
// cleanRemote: false,
|
||||
// excludes: '',
|
||||
// execCommand: [
|
||||
// "echo 定位到项目位置",
|
||||
// "cd /usr/local/fengchaoit/$projectName",
|
||||
// "echo 授予启动脚本权限",
|
||||
// "chmod +x ./apprun.sh",
|
||||
// "echo 停止正在运行服务",
|
||||
// "./apprun.sh remove",
|
||||
// "echo 启动新构建服务",
|
||||
// "./apprun.sh restart"
|
||||
// ].join('\n'),
|
||||
// execTimeout: 120000,
|
||||
// flatten: false,
|
||||
// makeEmptyDirs: false,
|
||||
// noDefaultExcludes: false,
|
||||
// patternSeparator: '[, ]+',
|
||||
// remoteDirectory: "/usr/local/fengchaoit/$projectName",
|
||||
// remoteDirectorySDF: false,
|
||||
// removePrefix: 'project',
|
||||
// sourceFiles: 'project/*'
|
||||
// )
|
||||
// ],
|
||||
// usePromotionTimestamp: false,
|
||||
// useWorkspaceInPromotion: false,
|
||||
// verbose: true
|
||||
// )
|
||||
// ]
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
stage('部署项目到服务器'){
|
||||
@@ -138,7 +138,7 @@ pipeline {
|
||||
excludes: '',
|
||||
execCommand: [
|
||||
"echo 定位到项目位置",
|
||||
"cd /usr/local/fengchaoit/WorkSpace/$projectName",
|
||||
"cd /opt/mingjiang/$projectName",
|
||||
"echo 授予启动脚本权限",
|
||||
"chmod +x ./apprun.sh",
|
||||
"echo 停止正在运行服务",
|
||||
@@ -151,7 +151,7 @@ pipeline {
|
||||
makeEmptyDirs: false,
|
||||
noDefaultExcludes: false,
|
||||
patternSeparator: '[, ]+',
|
||||
remoteDirectory: "/usr/local/fengchaoit/WorkSpace/$projectName",
|
||||
remoteDirectory: "/opt/mingjiang/$projectName",
|
||||
remoteDirectorySDF: false,
|
||||
removePrefix: 'project',
|
||||
sourceFiles: 'project/*'
|
||||
@@ -174,28 +174,37 @@ pipeline {
|
||||
}
|
||||
}
|
||||
post {
|
||||
success {
|
||||
script {
|
||||
if(env.branch == "main"){
|
||||
sh "curl -X POST -H \"Content-Type: application/json\" -d '{\"msg_type\":\"interactive\",\"card\":{\"config\":{},\"i18n_elements\":{\"zh_cn\":[{\"tag\":\"column_set\",\"flex_mode\":\"none\",\"horizontal_spacing\":\"default\",\"background_style\":\"default\",\"columns\":[{\"tag\":\"column\",\"elements\":[{\"tag\":\"div\",\"text\":{\"tag\":\"plain_text\",\"content\":\"${projectName}项目${targetVersion}版本打包成功,请及时获取备份\",\"text_size\":\"normal\",\"text_align\":\"left\",\"text_color\":\"default\"},\"icon\":{\"tag\":\"standard_icon\",\"token\":\"announce_filled\",\"color\":\"grey\"}}],\"width\":\"weighted\",\"weight\":1}]}]},\"i18n_header\":{\"zh_cn\":{\"title\":{\"tag\":\"plain_text\",\"content\":\"版本构建成功通知\"},\"subtitle\":{\"tag\":\"plain_text\",\"content\":\"${projectName}项目打包成功\"},\"template\":\"green\",\"ud_icon\":{\"tag\":\"standard_icon\",\"token\":\"msgcard-rectangle_outlined\"}}}}}}' https://open.feishu.cn/open-apis/bot/v2/hook/ecad4435-131f-4d49-ab2b-d12e95c9b245"
|
||||
} else if(env.branch == "dev" || env.branch == "test" || env.branch =~ /(^f_.*_dev$)|(^fix_.*_test$)/) {
|
||||
sh "curl -X POST -H \"Content-Type: application/json\" -d '{\"msg_type\":\"interactive\",\"card\":{\"config\":{},\"i18n_elements\":{\"zh_cn\":[{\"tag\":\"column_set\",\"flex_mode\":\"none\",\"horizontal_spacing\":\"default\",\"background_style\":\"default\",\"columns\":[{\"tag\":\"column\",\"elements\":[{\"tag\":\"div\",\"text\":{\"tag\":\"plain_text\",\"content\":\"${projectName}项目${targetVersion}版本打包成功且已部署到${env.branchConfig}环境,请及时查看验证\",\"text_size\":\"normal\",\"text_align\":\"left\",\"text_color\":\"default\"},\"icon\":{\"tag\":\"standard_icon\",\"token\":\"announce_filled\",\"color\":\"grey\"}}],\"width\":\"weighted\",\"weight\":1}]}]},\"i18n_header\":{\"zh_cn\":{\"title\":{\"tag\":\"plain_text\",\"content\":\"版本构建成功通知\"},\"subtitle\":{\"tag\":\"plain_text\",\"content\":\"${projectName}项目部署成功\"},\"template\":\"green\",\"ud_icon\":{\"tag\":\"standard_icon\",\"token\":\"msgcard-rectangle_outlined\"}}}}}}' https://open.feishu.cn/open-apis/bot/v2/hook/ecad4435-131f-4d49-ab2b-d12e95c9b245"
|
||||
} else {
|
||||
sh "curl -X POST -H \"Content-Type: application/json\" -d '{\"msg_type\":\"interactive\",\"card\":{\"config\":{},\"i18n_elements\":{\"zh_cn\":[{\"tag\":\"column_set\",\"flex_mode\":\"none\",\"horizontal_spacing\":\"default\",\"background_style\":\"default\",\"columns\":[{\"tag\":\"column\",\"elements\":[{\"tag\":\"div\",\"text\":{\"tag\":\"plain_text\",\"content\":\"${projectName}项目${env.branch}分支构建成功,非有效分支无法进行远程部署,请及时检查\",\"text_size\":\"normal\",\"text_align\":\"left\",\"text_color\":\"default\"},\"icon\":{\"tag\":\"standard_icon\",\"token\":\"announce_filled\",\"color\":\"grey\"}}],\"width\":\"weighted\",\"weight\":1}]}]},\"i18n_header\":{\"zh_cn\":{\"title\":{\"tag\":\"plain_text\",\"content\":\"版本构建成功通知\"},\"subtitle\":{\"tag\":\"plain_text\",\"content\":\"${projectName}项目构建成功\"},\"template\":\"green\",\"ud_icon\":{\"tag\":\"standard_icon\",\"token\":\"msgcard-rectangle_outlined\"}}}}}}' https://open.feishu.cn/open-apis/bot/v2/hook/ecad4435-131f-4d49-ab2b-d12e95c9b245"
|
||||
}
|
||||
}
|
||||
}
|
||||
failure {
|
||||
sh "curl -X POST -H \"Content-Type: application/json\" -d '{\"msg_type\":\"interactive\",\"card\":{\"config\":{},\"i18n_elements\":{\"zh_cn\":[{\"tag\":\"column_set\",\"flex_mode\":\"none\",\"horizontal_spacing\":\"default\",\"background_style\":\"default\",\"columns\":[{\"tag\":\"column\",\"elements\":[{\"tag\":\"div\",\"text\":{\"tag\":\"plain_text\",\"content\":\"${projectName}项目${env.branch}分支构建失败,请及时查看失败原因并修复\",\"text_size\":\"normal\",\"text_align\":\"left\",\"text_color\":\"default\"},\"icon\":{\"tag\":\"standard_icon\",\"token\":\"announce_filled\",\"color\":\"grey\"}}],\"width\":\"weighted\",\"weight\":1}]}]},\"i18n_header\":{\"zh_cn\":{\"title\":{\"tag\":\"plain_text\",\"content\":\"项目构建失败通知\"},\"subtitle\":{\"tag\":\"plain_text\",\"content\":\"${projectName}项目构建失败\"},\"template\":\"red\",\"ud_icon\":{\"tag\":\"standard_icon\",\"token\":\"close_outlined\"}}}}}}' https://open.feishu.cn/open-apis/bot/v2/hook/ecad4435-131f-4d49-ab2b-d12e95c9b245"
|
||||
}
|
||||
aborted {
|
||||
sh "curl -X POST -H \"Content-Type: application/json\" -d '{\"msg_type\":\"interactive\",\"card\":{\"config\":{},\"i18n_elements\":{\"zh_cn\":[{\"tag\":\"column_set\",\"flex_mode\":\"none\",\"horizontal_spacing\":\"default\",\"background_style\":\"default\",\"columns\":[{\"tag\":\"column\",\"elements\":[{\"tag\":\"div\",\"text\":{\"tag\":\"plain_text\",\"content\":\"${projectName}项目${env.branch}分支构建未成功,请及时查看失败原因并修复\",\"text_size\":\"normal\",\"text_align\":\"left\",\"text_color\":\"default\"},\"icon\":{\"tag\":\"standard_icon\",\"token\":\"announce_filled\",\"color\":\"grey\"}}],\"width\":\"weighted\",\"weight\":1}]}]},\"i18n_header\":{\"zh_cn\":{\"title\":{\"tag\":\"plain_text\",\"content\":\"项目构建未成功通知\"},\"subtitle\":{\"tag\":\"plain_text\",\"content\":\"${projectName}项目构建未成功\"},\"template\":\"orange\",\"ud_icon\":{\"tag\":\"standard_icon\",\"token\":\"warning_outlined\"}}}}}}' https://open.feishu.cn/open-apis/bot/v2/hook/ecad4435-131f-4d49-ab2b-d12e95c9b245"
|
||||
}
|
||||
// success {
|
||||
// script {
|
||||
// if(env.branch == "main"){
|
||||
// sh "curl -X POST -H \"Content-Type: application/json\" -d '{\"msg_type\":\"interactive\",\"card\":{\"config\":{},\"i18n_elements\":{\"zh_cn\":[{\"tag\":\"column_set\",\"flex_mode\":\"none\",\"horizontal_spacing\":\"default\",\"background_style\":\"default\",\"columns\":[{\"tag\":\"column\",\"elements\":[{\"tag\":\"div\",\"text\":{\"tag\":\"plain_text\",\"content\":\"${projectName}项目${targetVersion}版本打包成功,请及时获取备份\",\"text_size\":\"normal\",\"text_align\":\"left\",\"text_color\":\"default\"},\"icon\":{\"tag\":\"standard_icon\",\"token\":\"announce_filled\",\"color\":\"grey\"}}],\"width\":\"weighted\",\"weight\":1}]}]},\"i18n_header\":{\"zh_cn\":{\"title\":{\"tag\":\"plain_text\",\"content\":\"版本构建成功通知\"},\"subtitle\":{\"tag\":\"plain_text\",\"content\":\"${projectName}项目打包成功\"},\"template\":\"green\",\"ud_icon\":{\"tag\":\"standard_icon\",\"token\":\"msgcard-rectangle_outlined\"}}}}}}' https://open.feishu.cn/open-apis/bot/v2/hook/ecad4435-131f-4d49-ab2b-d12e95c9b245"
|
||||
// } else if(env.branch == "dev" || env.branch == "test" || env.branch =~ /(^f_.*_dev$)|(^fix_.*_test$)/) {
|
||||
// sh "curl -X POST -H \"Content-Type: application/json\" -d '{\"msg_type\":\"interactive\",\"card\":{\"config\":{},\"i18n_elements\":{\"zh_cn\":[{\"tag\":\"column_set\",\"flex_mode\":\"none\",\"horizontal_spacing\":\"default\",\"background_style\":\"default\",\"columns\":[{\"tag\":\"column\",\"elements\":[{\"tag\":\"div\",\"text\":{\"tag\":\"plain_text\",\"content\":\"${projectName}项目${targetVersion}版本打包成功且已部署到${env.branchConfig}环境,请及时查看验证\",\"text_size\":\"normal\",\"text_align\":\"left\",\"text_color\":\"default\"},\"icon\":{\"tag\":\"standard_icon\",\"token\":\"announce_filled\",\"color\":\"grey\"}}],\"width\":\"weighted\",\"weight\":1}]}]},\"i18n_header\":{\"zh_cn\":{\"title\":{\"tag\":\"plain_text\",\"content\":\"版本构建成功通知\"},\"subtitle\":{\"tag\":\"plain_text\",\"content\":\"${projectName}项目部署成功\"},\"template\":\"green\",\"ud_icon\":{\"tag\":\"standard_icon\",\"token\":\"msgcard-rectangle_outlined\"}}}}}}' https://open.feishu.cn/open-apis/bot/v2/hook/ecad4435-131f-4d49-ab2b-d12e95c9b245"
|
||||
// } else {
|
||||
// sh "curl -X POST -H \"Content-Type: application/json\" -d '{\"msg_type\":\"interactive\",\"card\":{\"config\":{},\"i18n_elements\":{\"zh_cn\":[{\"tag\":\"column_set\",\"flex_mode\":\"none\",\"horizontal_spacing\":\"default\",\"background_style\":\"default\",\"columns\":[{\"tag\":\"column\",\"elements\":[{\"tag\":\"div\",\"text\":{\"tag\":\"plain_text\",\"content\":\"${projectName}项目${env.branch}分支构建成功,非有效分支无法进行远程部署,请及时检查\",\"text_size\":\"normal\",\"text_align\":\"left\",\"text_color\":\"default\"},\"icon\":{\"tag\":\"standard_icon\",\"token\":\"announce_filled\",\"color\":\"grey\"}}],\"width\":\"weighted\",\"weight\":1}]}]},\"i18n_header\":{\"zh_cn\":{\"title\":{\"tag\":\"plain_text\",\"content\":\"版本构建成功通知\"},\"subtitle\":{\"tag\":\"plain_text\",\"content\":\"${projectName}项目构建成功\"},\"template\":\"green\",\"ud_icon\":{\"tag\":\"standard_icon\",\"token\":\"msgcard-rectangle_outlined\"}}}}}}' https://open.feishu.cn/open-apis/bot/v2/hook/ecad4435-131f-4d49-ab2b-d12e95c9b245"
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// failure {
|
||||
// sh "curl -X POST -H \"Content-Type: application/json\" -d '{\"msg_type\":\"interactive\",\"card\":{\"config\":{},\"i18n_elements\":{\"zh_cn\":[{\"tag\":\"column_set\",\"flex_mode\":\"none\",\"horizontal_spacing\":\"default\",\"background_style\":\"default\",\"columns\":[{\"tag\":\"column\",\"elements\":[{\"tag\":\"div\",\"text\":{\"tag\":\"plain_text\",\"content\":\"${projectName}项目${env.branch}分支构建失败,请及时查看失败原因并修复\",\"text_size\":\"normal\",\"text_align\":\"left\",\"text_color\":\"default\"},\"icon\":{\"tag\":\"standard_icon\",\"token\":\"announce_filled\",\"color\":\"grey\"}}],\"width\":\"weighted\",\"weight\":1}]}]},\"i18n_header\":{\"zh_cn\":{\"title\":{\"tag\":\"plain_text\",\"content\":\"项目构建失败通知\"},\"subtitle\":{\"tag\":\"plain_text\",\"content\":\"${projectName}项目构建失败\"},\"template\":\"red\",\"ud_icon\":{\"tag\":\"standard_icon\",\"token\":\"close_outlined\"}}}}}}' https://open.feishu.cn/open-apis/bot/v2/hook/ecad4435-131f-4d49-ab2b-d12e95c9b245"
|
||||
// }
|
||||
// aborted {
|
||||
// sh "curl -X POST -H \"Content-Type: application/json\" -d '{\"msg_type\":\"interactive\",\"card\":{\"config\":{},\"i18n_elements\":{\"zh_cn\":[{\"tag\":\"column_set\",\"flex_mode\":\"none\",\"horizontal_spacing\":\"default\",\"background_style\":\"default\",\"columns\":[{\"tag\":\"column\",\"elements\":[{\"tag\":\"div\",\"text\":{\"tag\":\"plain_text\",\"content\":\"${projectName}项目${env.branch}分支构建未成功,请及时查看失败原因并修复\",\"text_size\":\"normal\",\"text_align\":\"left\",\"text_color\":\"default\"},\"icon\":{\"tag\":\"standard_icon\",\"token\":\"announce_filled\",\"color\":\"grey\"}}],\"width\":\"weighted\",\"weight\":1}]}]},\"i18n_header\":{\"zh_cn\":{\"title\":{\"tag\":\"plain_text\",\"content\":\"项目构建未成功通知\"},\"subtitle\":{\"tag\":\"plain_text\",\"content\":\"${projectName}项目构建未成功\"},\"template\":\"orange\",\"ud_icon\":{\"tag\":\"standard_icon\",\"token\":\"warning_outlined\"}}}}}}' https://open.feishu.cn/open-apis/bot/v2/hook/ecad4435-131f-4d49-ab2b-d12e95c9b245"
|
||||
// }
|
||||
cleanup {
|
||||
sh "echo '清理无用空镜像'"
|
||||
sh "docker image prune -f"
|
||||
sh "var=\$(docker ps -a -q --filter \"status=exited\");if [ -n \"\$var\" ];then docker rm \$var; fi"
|
||||
cleanWs()
|
||||
sh '''
|
||||
echo "开始清理已停止容器......"
|
||||
# 1. 清理已停止的容器
|
||||
# -r 参数防止 xargs 在输入为空时报错
|
||||
docker ps -a -q --filter "status=exited" | xargs -r docker rm
|
||||
echo "清理已停止容器完成......"
|
||||
|
||||
echo "清理无用空镜像......"
|
||||
# 2. 清理无用的空镜像 (dangling images)
|
||||
docker image prune -f
|
||||
echo "无用空镜像清理完成"
|
||||
'''
|
||||
deleteDir()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user