Merge remote-tracking branch 'origin/dev-cq' into dev-cq

This commit is contained in:
76164 2024-07-22 14:44:25 +08:00
commit 3cd132b3b2
14 changed files with 290 additions and 46 deletions

161
scripts/deploy.sh Normal file
View File

@ -0,0 +1,161 @@
#!/bin/sh
export deploy_path=/opt/builds/${JOB_NAME}/${BUILD_NUMBER}
echo "--------moveFile start--------------"
rm -rf $deploy_path
mkdir -p $deploy_path
cd $deploy_path
rm -rf *.jar
echo "workspace is ${WORKSPACE}"
mv ${WORKSPACE}/sgzb-auth/target/sgzb-auth.jar $deploy_path
mv ${WORKSPACE}/sgzb-gateway/target/sgzb-gateway.jar $deploy_path
mv ${WORKSPACE}/sgzb-modules/sgzb-system/target/sgzb-modules-system.jar $deploy_path
mv ${WORKSPACE}/sgzb-modules/sgzb-base/target/sgzb-modules-base.jar $deploy_path
mv ${WORKSPACE}/sgzb-modules/sgzb-file/target/sgzb-modules-file.jar $deploy_path
mv ${WORKSPACE}/sgzb-modules/sgzb-material/target/sgzb-modules-material.jar $deploy_path
chmod 777 *.jar
echo "--------moveFile end--------------"
export sgzb_auth_enable=true
export sgzb_gateway_enable=true
export sgzb_modules_system_enable=true
export sgzb_modules_base_enable=true
export sgzb_modules_file_enable=false
export sgzb_modules_material_enable=true
export sgzb_auth_jar=sgzb-auth.jar
export sgzb_gateway_jar=sgzb-gateway.jar
export sgzb_modules_system_jar=sgzb-modules-system.jar
export sgzb_modules_base_jar=sgzb-modules-base.jar
export sgzb_modules_file_jar=sgzb-modules-file.jar
export sgzb_modules_material_jar=sgzb-modules-material.jar
export sgzb_auth_port=39200
export sgzb_gateway_port=38080
export sgzb_modules_system_port=39201
export sgzb_modules_base_port=39301
export sgzb_modules_file_port=39300
export sgzb_modules_material_port=39302
if($auth_service_enable);then
echo "--------auth开始启动--------------"
echo "--------删除auth开始--------------"
P_ID=`ps -ef | grep -w $sgzb_auth_jar | grep -v "grep" | awk '{print $2}'`
if [ "$P_ID" == "" ]; then
echo "===auth service process not exists or stop success"
else
kill -9 $P_ID
echo "auth service killed success"
fi
nohup /usr/lib/jvm/jdk1.8.0_381/bin/java -jar $sgzb_auth_jar >/dev/null 2>&1 &
sgzb_auth_pid=`lsof -i:$sgzb_auth_port|grep "LISTEN"|awk '{print $2}'`
until [ -n "$sgzb_auth_pid" ]
do
sgzb_auth_pid=`lsof -i:$sgzb_auth_port|grep "LISTEN"|awk '{print $2}'`
done
echo "auth service pid is $sgzb_auth_pid"
echo "--------auth_service 启动成功--------------"
fi
if($sgzb_gateway_enable);then
echo "--------gateway 开始启动--------------"
echo "--------删除gateway开始--------------"
P_ID=`ps -ef | grep -w $sgzb_gateway_jar | grep -v "grep" | awk '{print $2}'`
if [ "$P_ID" == "" ]; then
echo "===gateway process not exists or stop success"
else
kill -9 $P_ID
echo "gateway killed success"
fi
nohup /usr/lib/jvm/jdk1.8.0_381/bin/java -jar $sgzb_gateway_jar >/dev/null 2>&1 &
sgzb_gateway_pid=`lsof -i:$sgzb_gateway_port|grep "LISTEN"|awk '{print $2}'`
until [ -n "$sgzb_gateway_pid" ]
do
sgzb_gateway_pid=`lsof -i:$sgzb_gateway_port|grep "LISTEN"|awk '{print $2}'`
done
echo "gateway pid is $sgzb_gateway_pid"
echo "--------gateway 启动成功--------------"
fi
if($sgzb_modules_system_enable);then
echo "--------sgzb_modules_system 开始启动--------------"
echo "--------删除sgzb_modules_system开始--------------"
P_ID=`ps -ef | grep -w $sgzb_modules_system_jar | grep -v "grep" | awk '{print $2}'`
if [ "$P_ID" == "" ]; then
echo "===sgzb_modules_system process not exists or stop success"
else
kill -9 $P_ID
echo "sgzb_modules_system killed success"
fi
echo "--------sgzb_modules_system开始部署--------------"
nohup /usr/lib/jvm/jdk1.8.0_381/bin/java -jar $sgzb_modules_system_jar >/dev/null 2>&1 &
sgzb_modules_system_pid=`lsof -i:$sgzb_modules_system_port|grep "LISTEN"|awk '{print $2}'`
until [ -n "$sgzb_modules_system_pid" ]
do
sgzb_modules_system_pid=`lsof -i:$sgzb_modules_system_port|grep "LISTEN"|awk '{print $2}'`
done
echo "sgzb_modules_system pid is $sgzb_modules_system_pid"
echo "--------sgzb_modules_system 启动成功--------------"
fi
if($sgzb_modules_base_enable);then
echo "--------sgzb_modules_base 开始启动--------------"
echo "--------删除sgzb_modules_base开始--------------"
P_ID=`ps -ef | grep -w $sgzb_modules_base_jar | grep -v "grep" | awk '{print $2}'`
if [ "$P_ID" == "" ]; then
echo "===sgzb_modules_base process not exists or stop success"
else
kill -9 $P_ID
echo "sgzb_modules_base killed success"
fi
echo "--------sgzb_modules_base开始部署--------------"
nohup /usr/lib/jvm/jdk1.8.0_381/bin/java -jar $sgzb_modules_base_jar >/dev/null 2>&1 &
sgzb_modules_base_pid=`lsof -i:$sgzb_modules_base_port|grep "LISTEN"|awk '{print $2}'`
until [ -n "$sgzb_modules_base_pid" ]
do
sgzb_modules_base_pid=`lsof -i:$sgzb_modules_base_port|grep "LISTEN"|awk '{print $2}'`
done
echo "sgzb_modules_base pid is $sgzb_modules_base_pid"
echo "--------sgzb_modules_base 启动成功--------------"
fi
if($sgzb_modules_file_enable);then
echo "--------sgzb_modules_file 开始启动--------------"
echo "--------删除sgzb_modules_file开始--------------"
P_ID=`ps -ef | grep -w $sgzb_modules_file_jar | grep -v "grep" | awk '{print $2}'`
if [ "$P_ID" == "" ]; then
echo "===sgzb_modules_file process not exists or stop success"
else
kill -9 $P_ID
echo "sgzb_modules_file killed success"
fi
echo "--------sgzb_modules_file开始部署--------------"
nohup /usr/lib/jvm/jdk1.8.0_381/bin/java -jar $sgzb_modules_file_jar >/dev/null 2>&1 &
sgzb_modules_file_pid=`lsof -i:$sgzb_modules_file_port|grep "LISTEN"|awk '{print $2}'`
until [ -n "$sgzb_modules_file_pid" ]
do
sgzb_modules_file_pid=`lsof -i:$sgzb_modules_file_port|grep "LISTEN"|awk '{print $2}'`
done
echo "sgzb_modules_file pid is $sgzb_modules_file_pid"
echo "--------sgzb_modules_file 启动成功--------------"
fi
if($sgzb_modules_material_enable);then
echo "--------sgzb_modules_material 开始启动--------------"
echo "--------删除sgzb_modules_material开始--------------"
P_ID=`ps -ef | grep -w $sgzb_modules_material_jar | grep -v "grep" | awk '{print $2}'`
if [ "$P_ID" == "" ]; then
echo "===sgzb_modules_material process not exists or stop success"
else
kill -9 $P_ID
echo "sgzb_modules_material killed success"
fi
echo "--------sgzb_modules_material开始部署--------------"
nohup /usr/lib/jvm/jdk1.8.0_381/bin/java -jar $sgzb_modules_material_jar >/dev/null 2>&1 &
sgzb_modules_material_pid=`lsof -i:$sgzb_modules_material_port|grep "LISTEN"|awk '{print $2}'`
until [ -n "$sgzb_modules_material_pid" ]
do
sgzb_modules_material_pid=`lsof -i:$sgzb_modules_material_port|grep "LISTEN"|awk '{print $2}'`
done
echo "sgzb_modules_material pid is $sgzb_modules_material_pid"
echo "--------sgzb_modules_material 启动成功--------------"
fi

4
scripts/moveFile.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/sh
echo "--------moveFile start--------------"
#cp -rf ${WORKSPACE}/scripts/sonar-project.properties ${WORKSPACE}

79
scripts/pipeline.sh Normal file
View File

@ -0,0 +1,79 @@
pipeline {
agent any
environment {
// 设置自定义JDK路径因为每个项目可能需要不同版本的jdk
JAVA_HOME = '/usr/lib/jvm/jdk1.8.0_381'
JOBNAME="${JOB_NAME}"
JENKINS_NODE_COOKIE = "dontKillMe"
}
stages {
stage('Check out') {
steps {
withCredentials([usernamePassword(credentialsId: 'f7070987-9b49-4ae1-af6d-53a3bf26799b', passwordVariable: 'Max@2023', usernameVariable: 'bonus')]) {
checkout([
$class: 'GitSCM',
branches: [[name: '*/dev-cq']],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: '']],
submoduleCfg: [],
userRemoteConfigs: [[url: 'http://192.168.0.56:3000/bonus/devicesmgt.git']]
])
}
}
}
stage('Move file') {
steps {
echo 'move file start!'
sh 'chmod 777 ${WORKSPACE}/scripts/*'
// 如果需要拷贝文件,打开并编写以下脚本
// sh '${WORKSPACE}/scripts/moveFile.sh'
}
}
stage('Build') {
steps {
echo 'build start!'
sh 'env JAVA_HOME=$JAVA_HOME /usr/local/src/apache-maven-3.9.4/bin/mvn clean package'
}
}
stage('Sonar scan') {
steps {
script {
echo 'sonar scan start!'
def scannerHome = tool 'sonar-scanner'
withSonarQubeEnv('sonarqube-server') {
sh "/usr/local/sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner " +
"-Dsonar.projectKey=${JOB_NAME} " +
"-Dsonar.projectName=${JOB_NAME} " +
"-Dsonar.sourceEncoding=UTF-8 " +
"-Dsonar.language=java " +
"-Dsonar.projectVersion=1.0 " +
"-Dsonar.sources=. " +
"-Dsonar.java.source=1.8 " +
"-Dsonar.java.target=1.8 " +
"-Dsonar.scm.disabled=true " +
"-Dsonar.exclusions=test/**,node_modules/**,static/**,**/*.js,**/*.html,**/*.css,**/*.jar " +
"-Dsonar.java.binaries=**/target/classes"
}
}
}
}
stage('Deploy') {
steps {
echo 'deploy start!'
sh '''BUILD_ID=DONTKILLME sh ${WORKSPACE}/scripts/deploy.sh'''
}
}
stage('Dingding') {
steps {
echo 'Dingding start!'
script {
def webhookUrl = 'https://oapi.dingtalk.com/robot/send?access_token=eae0af98514a0db9a9a0d5cd8e337d13e7c16cd81d4a90b503e465a573020add' //替换为你自己的钉钉机器人Webhook地址
def message = "${JOB_NAME} TEST已完成: ${env.BUILD_URL} \n 到Sonarqube查看问题http://192.168.0.56:9000/dashboard?id=${JOB_NAME} \n 查看新包: http://192.168.0.56/${JOB_NAME}/${BUILD_NUMBER} "
echo "${message}"
sh "curl -H 'Content-Type: application/json' -d '{\"msgtype\": \"text\", \"text\": {\"content\": \"${message}\"}, \"at\": {\"atMobiles\": [\"张三,李四\"], \"isAtAll\": true}}' ${webhookUrl}"
}
}
}
}
}

View File

@ -1,6 +1,6 @@
# Tomcat
server:
port: 29200
port: 39200
# Spring
spring:
@ -9,17 +9,17 @@ spring:
name: sgzb-auth
profiles:
# 环境配置
active: sgzb_cloud_dev
active: sgzb_cloud_dev_cq
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
namespace: sgzb_cloud_dev
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cq
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
namespace: sgzb_cloud_dev
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cq
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -1,6 +1,6 @@
# Tomcat
server:
port: 28080
port: 38080
# Spring Boot Actuator V2中风险漏洞处理禁止远程端口访问
management:
@ -15,7 +15,7 @@ spring:
name: sgzb-gateway
profiles:
# 环境配置
active: sgzb_cloud_dev
active: sgzb_cloud_dev_cq
cloud:
loadbalancer:
# 关闭Ribbon的负载均衡器
@ -27,12 +27,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
namespace: sgzb_cloud_dev
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cq
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
namespace: sgzb_cloud_dev
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cq
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -1,6 +1,6 @@
# Tomcat
server:
port: 29301
port: 39301
# Spring
spring:
@ -9,7 +9,7 @@ spring:
name: sgzb-base
profiles:
# 环境配置
active: sgzb_cloud_dev
active: sgzb_cloud_dev_cq
cloud:
loadbalancer:
# 关闭Ribbon的负载均衡器
@ -21,12 +21,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
namespace: sgzb_cloud_dev
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cq
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
namespace: sgzb_cloud_dev
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cq
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -1,6 +1,6 @@
# Tomcat
server:
port: 9300
port: 39300
# 腾讯云cos
tencent:
@ -31,17 +31,17 @@ spring:
name: sgzb-file
profiles:
# 环境配置
active: sgzb_cloud_dev
active: sgzb_cloud_dev_cq
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev
namespace: sgzb_cloud_dev_cq
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev
namespace: sgzb_cloud_dev_cq
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -9,17 +9,17 @@ spring:
name: sgzb-gen
profiles:
# 环境配置
active: sgzb_cloud_dev
active: sgzb_cloud_dev_cq
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev
namespace: sgzb_cloud_dev_cq
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev
namespace: sgzb_cloud_dev_cq
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -9,17 +9,17 @@ spring:
name: sgzb-job
profiles:
# 环境配置
active: sgzb_cloud_dev
active: sgzb_cloud_dev_cq
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev
namespace: sgzb_cloud_dev_cq
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev
namespace: sgzb_cloud_dev_cq
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -1,6 +1,6 @@
# Tomcat
server:
port: 29302
port: 39302
# Spring
spring:
@ -9,7 +9,7 @@ spring:
name: sgzb-material
profiles:
# 环境配置
active: sgzb_cloud_dev
active: sgzb_cloud_dev_cq
cloud:
loadbalancer:
# 关闭Ribbon的负载均衡器
@ -21,12 +21,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
namespace: sgzb_cloud_dev
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cq
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
namespace: sgzb_cloud_dev
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cq
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -9,17 +9,17 @@ spring:
name: sgzb-settlement
profiles:
# 环境配置
active: sgzb_cloud_dev
active: sgzb_cloud_dev_cq
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev
namespace: sgzb_cloud_dev_cq
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev
namespace: sgzb_cloud_dev_cq
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -1,6 +1,6 @@
# Tomcat
server:
port: 29201
port: 39201
# Spring
spring:
@ -13,7 +13,7 @@ spring:
name: sgzb-system
profiles:
# 环境配置
active: sgzb_cloud_dev
active: sgzb_cloud_dev_cq
cloud:
loadbalancer:
# 关闭Ribbon的负载均衡器
@ -25,12 +25,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
namespace: sgzb_cloud_dev
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cq
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
namespace: sgzb_cloud_dev
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cq
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -420,7 +420,7 @@
</el-col>
<el-col :span="12">
<el-form-item label="库管员" prop="keeperUserId">
<el-form-item label="库管员">
<el-select
v-model="form.keeperUserId"
filterable

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 192.168.0.14:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 192.168.0.14:8848
# 配置文件格式
file-extension: yml
# 共享配置