|
|
@@ -17,7 +17,7 @@ properties([
|
|
|
classpath: [],
|
|
|
sandbox: true,
|
|
|
script:
|
|
|
- 'return["java","ui"]'
|
|
|
+ 'return["java"]'
|
|
|
]
|
|
|
]
|
|
|
],
|
|
|
@@ -38,14 +38,8 @@ properties([
|
|
|
script: [
|
|
|
classpath: [],
|
|
|
sandbox: true,
|
|
|
- script:
|
|
|
- ''' if (modulePrefix.equals("java")){
|
|
|
- return["storlead-centre-api"]
|
|
|
- }
|
|
|
- else if(modulePrefix.equals("ui")){
|
|
|
- return["sp-user-center"]
|
|
|
- }
|
|
|
- '''
|
|
|
+ script:
|
|
|
+ 'return["storlead-api"]'
|
|
|
]
|
|
|
]
|
|
|
]
|
|
|
@@ -111,13 +105,13 @@ pipeline {
|
|
|
if (params.profile == "test") {
|
|
|
SWARM_INIT_REPLICAS_NUM = 1
|
|
|
SERVER_HOST = "test1.storlead.com"
|
|
|
- API_PORT = 10060
|
|
|
- API_REMOTE_DEBUG_PORT = 10061
|
|
|
+ API_PORT = 18060
|
|
|
+ API_REMOTE_DEBUG_PORT = 18061
|
|
|
SERVER_HOST_NAME = "test1"
|
|
|
} else if (params.profile == "prod") {
|
|
|
SERVER_HOST = "110.41.82.21"
|
|
|
- API_PORT = 10060
|
|
|
- API_REMOTE_DEBUG_PORT = 10061
|
|
|
+ API_PORT = 18060
|
|
|
+ API_REMOTE_DEBUG_PORT = 18061
|
|
|
SERVER_HOST_NAME = "node1"
|
|
|
}
|
|
|
}
|
|
|
@@ -132,75 +126,75 @@ pipeline {
|
|
|
}
|
|
|
|
|
|
echo "处理MODULE_NAMESPACE_RESTFUL"
|
|
|
- //把 module 名 从 sp-xxx 变成 xxx 也就是 项目 的 namespace
|
|
|
- if (API_NAMESPACE_RESTFUL == "storlead-centre-api") {
|
|
|
+// //把 module 名 从 sp-xxx 变成 xxx 也就是 项目 的 namespace
|
|
|
+ //if (API_NAMESPACE_RESTFUL == "storlead-mail-api") {
|
|
|
API_NAMESPACE_RESTFUL = "api"
|
|
|
- }
|
|
|
+ //}
|
|
|
echo "处理镜像推送"
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- stage('Node 编译') {
|
|
|
-
|
|
|
- when {
|
|
|
- environment name: 'modulePrefix', value: 'ui'
|
|
|
- }
|
|
|
- agent {
|
|
|
- docker {
|
|
|
-// image "registry-vpc.cn-shenzhen.aliyuncs.com/storlead/node:19-alpine"
|
|
|
- image "node:20-alpine"
|
|
|
- args '-v /app:/app/:z -v /etc/localtime:/etc/localtime:ro -u root'
|
|
|
- reuseNode true
|
|
|
- }
|
|
|
- }
|
|
|
- steps {
|
|
|
- withCredentials([
|
|
|
- usernamePassword(credentialsId: 'storleadHW', usernameVariable: 'usernameHW', passwordVariable: 'passwordHW'),
|
|
|
- usernamePassword(credentialsId: 'storlead', usernameVariable: 'username', passwordVariable: 'password')
|
|
|
- ]) {
|
|
|
- script {
|
|
|
- echo "发布 UI 代码"
|
|
|
-
|
|
|
- def remote = [:]
|
|
|
- remote.allowAnyHosts = true
|
|
|
- remote.name = "${SERVER_HOST}"
|
|
|
- remote.host = "${SERVER_HOST}"
|
|
|
- remote.port = 53023
|
|
|
- remote.user = username
|
|
|
- remote.password = password
|
|
|
-
|
|
|
- if (params.profile == "prod") {
|
|
|
- remote.port = 22
|
|
|
- remote.user = "root"
|
|
|
- remote.user = usernameHW
|
|
|
- remote.password = passwordHW
|
|
|
- }
|
|
|
- if(params.module == 'sp-user-mobile-center') {
|
|
|
- sh """cd ${params.modulePrefix}/${params.module} && npm install && npm run build:${params.profile}"""
|
|
|
- } else {
|
|
|
- sh """cd ${params.modulePrefix}/${params.module} && npm install && npm run ${params.profile}"""
|
|
|
- }
|
|
|
-
|
|
|
-// sh """cd ${params.modulePrefix}/${params.module} && npm run ${params.profile}"""
|
|
|
-
|
|
|
- sshCommand remote: remote, command: "mkdir -p /app/sp/ui/app-centre/${params.profile}/${params.module}"
|
|
|
-
|
|
|
- sshCommand remote: remote, command: "rm -rf /app/sp/ui/app-centre/${params.profile}/${params.module}/dist/*"
|
|
|
-
|
|
|
-
|
|
|
- echo "/app/sp/ui/sales/${params.profile}/${params.module}/*"
|
|
|
-
|
|
|
- sshPut remote: remote, from: "${params.modulePrefix}/${params.module}/dist/", into: "/app/sp/ui/app-centre/${params.profile}/${params.module}/"
|
|
|
-
|
|
|
- echo "${params.modulePrefix}/${params.module}/dist/,/app/sp/ui/app-centre/${params.profile}/${params.module}/"
|
|
|
-
|
|
|
- sshCommand remote: remote, command: "cp -rf /app/sp/ui/app-centre/${params.profile}/${params.module}/dist/* /app/sp/ui/app-centre/${params.profile}/${params.module}/"
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// stage('Node 编译') {
|
|
|
+//
|
|
|
+// when {
|
|
|
+// environment name: 'modulePrefix', value: 'ui'
|
|
|
+// }
|
|
|
+// agent {
|
|
|
+// docker {
|
|
|
+// // image "registry-vpc.cn-shenzhen.aliyuncs.com/storlead/node:19-alpine"
|
|
|
+// image "node:20-alpine"
|
|
|
+// args '-v /app:/app/:z -v /etc/localtime:/etc/localtime:ro -u root'
|
|
|
+// reuseNode true
|
|
|
+// }
|
|
|
+// }
|
|
|
+// steps {
|
|
|
+// withCredentials([
|
|
|
+// usernamePassword(credentialsId: 'storleadHW', usernameVariable: 'usernameHW', passwordVariable: 'passwordHW'),
|
|
|
+// usernamePassword(credentialsId: 'storlead', usernameVariable: 'username', passwordVariable: 'password')
|
|
|
+// ]) {
|
|
|
+// script {
|
|
|
+// echo "发布 UI 代码"
|
|
|
+//
|
|
|
+// def remote = [:]
|
|
|
+// remote.allowAnyHosts = true
|
|
|
+// remote.name = "${SERVER_HOST}"
|
|
|
+// remote.host = "${SERVER_HOST}"
|
|
|
+// remote.port = 53023
|
|
|
+// remote.user = username
|
|
|
+// remote.password = password
|
|
|
+//
|
|
|
+// if (params.profile == "prod") {
|
|
|
+// remote.port = 22
|
|
|
+// remote.user = "root"
|
|
|
+// remote.user = usernameHW
|
|
|
+// remote.password = passwordHW
|
|
|
+// }
|
|
|
+// if(params.module == 'sp-user-mobile-center') {
|
|
|
+// sh """cd ${params.modulePrefix}/${params.module} && npm install && npm run build:${params.profile}"""
|
|
|
+// } else {
|
|
|
+// sh """cd ${params.modulePrefix}/${params.module} && npm install && npm run ${params.profile}"""
|
|
|
+// }
|
|
|
+//
|
|
|
+// // sh """cd ${params.modulePrefix}/${params.module} && npm run ${params.profile}"""
|
|
|
+//
|
|
|
+// sshCommand remote: remote, command: "mkdir -p /app/sp/ui/app-centre/${params.profile}/${params.module}"
|
|
|
+//
|
|
|
+// sshCommand remote: remote, command: "rm -rf /app/sp/ui/app-centre/${params.profile}/${params.module}/dist/*"
|
|
|
+//
|
|
|
+//
|
|
|
+// echo "/app/sp/ui/sales/${params.profile}/${params.module}/*"
|
|
|
+//
|
|
|
+// sshPut remote: remote, from: "${params.modulePrefix}/${params.module}/dist/", into: "/app/sp/ui/app-centre/${params.profile}/${params.module}/"
|
|
|
+//
|
|
|
+// echo "${params.modulePrefix}/${params.module}/dist/,/app/sp/ui/app-centre/${params.profile}/${params.module}/"
|
|
|
+//
|
|
|
+// sshCommand remote: remote, command: "cp -rf /app/sp/ui/app-centre/${params.profile}/${params.module}/dist/* /app/sp/ui/app-centre/${params.profile}/${params.module}/"
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
stage('Maven 编译') {
|
|
|
when {
|
|
|
@@ -298,9 +292,17 @@ pipeline {
|
|
|
placement:
|
|
|
constraints:
|
|
|
- 'node.hostname == ${SERVER_HOST_NAME}'
|
|
|
+
|
|
|
+ resources:
|
|
|
+ limits:
|
|
|
+ memory: 2G
|
|
|
+ reservations:
|
|
|
+ memory: 512M
|
|
|
+
|
|
|
update_config:
|
|
|
parallelism: 1
|
|
|
delay: 1m
|
|
|
+
|
|
|
restart_policy:
|
|
|
condition: on-failure
|
|
|
# 最多连续重试3次如果仍然失败则放弃重试
|
|
|
@@ -314,6 +316,7 @@ pipeline {
|
|
|
environment:
|
|
|
- "TZ=Asia/Shanghai"
|
|
|
- "SPRING_PROFILES_ACTIVE=${params.profile}"
|
|
|
+ - "JAVA_OPTS=-Xms512m -Xmx1024m"
|
|
|
volumes:
|
|
|
- /app:/app
|
|
|
- /mnt/vdb/storlead:/mnt/vdb/storlead
|
|
|
@@ -321,7 +324,7 @@ pipeline {
|
|
|
- "${API_PORT}:${API_PORT}"
|
|
|
- "${API_REMOTE_DEBUG_PORT}:${API_REMOTE_DEBUG_PORT}"
|
|
|
networks:
|
|
|
- - vonedao_net
|
|
|
+ - ${ARTIFACTID}
|
|
|
extra_hosts:
|
|
|
- "www.storlead.com:172.18.194.161"
|
|
|
- "node1:110.41.82.21"
|
|
|
@@ -330,7 +333,8 @@ pipeline {
|
|
|
- "test1.storlead.com:172.18.194.168"
|
|
|
- "test2.storlead.com:172.18.194.163"
|
|
|
networks:
|
|
|
- vonedao_net:
|
|
|
+ ${ARTIFACTID}:
|
|
|
+ driver: overlay
|
|
|
external: true
|
|
|
' > ${params.module}-${params.profile}-stack.yml
|
|
|
"""
|
|
|
@@ -352,4 +356,4 @@ pipeline {
|
|
|
|
|
|
}
|
|
|
|
|
|
-}
|
|
|
+}
|