2024-06-19 16:38:12 +08:00
|
|
|
pipeline {
|
2024-06-20 09:13:12 +08:00
|
|
|
parameters {
|
2024-06-20 09:28:34 +08:00
|
|
|
choice choices: ['all', 'ui', 'service'], description: 'all - 前端和后端 ; ui - 仅发版前端 ; service - 仅发版后端', name: 'publish_type'
|
2024-06-20 09:13:12 +08:00
|
|
|
}
|
2024-06-19 16:38:12 +08:00
|
|
|
agent any
|
|
|
|
stages {
|
|
|
|
stage('拉取源码') {
|
|
|
|
steps {
|
|
|
|
checkout scmGit(branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[credentialsId: 'd62224c5-69cf-474a-8845-c2c2bbe1fc00', url: 'https://git.jsspisoft.com/ry-das.git']])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('编译UI') {
|
2024-06-20 09:28:34 +08:00
|
|
|
when {
|
2024-06-20 09:29:55 +08:00
|
|
|
expression { params.publish_type == "ui" || params.publish_type == "all" }
|
2024-06-20 09:28:34 +08:00
|
|
|
}
|
2024-06-19 16:38:12 +08:00
|
|
|
steps {
|
|
|
|
nodejs(cacheLocationStrategy: workspace(), configId: '8e356590-2fee-4f1f-b0e9-5cea43299887', nodeJSInstallationName: 'nodejs202122') {
|
|
|
|
dir("$WORKSPACE/ui/dasadmin") {
|
|
|
|
sh "npm install"
|
|
|
|
sh "npm run build"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('编译后端') {
|
2024-06-20 09:28:34 +08:00
|
|
|
when {
|
2024-06-20 09:29:55 +08:00
|
|
|
expression { params.publish_type == "service" || params.publish_type == "all" }
|
2024-06-20 09:28:34 +08:00
|
|
|
}
|
2024-06-19 16:38:12 +08:00
|
|
|
steps {
|
2024-06-19 16:59:09 +08:00
|
|
|
withMaven(globalMavenSettingsConfig: 'bab2e7fd-587c-4284-9bd8-6b97dfeb2fab', jdk: 'jdk17', maven: 'maven396') {
|
2024-06-19 16:48:57 +08:00
|
|
|
dir("$WORKSPACE/das") {
|
2024-06-19 17:26:45 +08:00
|
|
|
sh 'mvn -DskipTests -am clean package'
|
2024-06-19 16:38:12 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-06-20 09:52:49 +08:00
|
|
|
|
|
|
|
stage('发版前端') {
|
|
|
|
when {
|
|
|
|
expression { params.publish_type == "ui" || params.publish_type == "all" }
|
|
|
|
}
|
|
|
|
steps {
|
2024-06-20 10:23:22 +08:00
|
|
|
dir("$WORKSPACE/ui/dasadmin") {
|
2024-06-20 11:02:13 +08:00
|
|
|
sh "sudo rsync -av --delete dist/ root@192.168.109.195:/das/ui/"
|
2024-06-20 10:52:21 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('发版后端') {
|
|
|
|
when {
|
|
|
|
expression { params.publish_type == "service" || params.publish_type == "all" }
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
dir("$WORKSPACE/das") {
|
2024-06-20 12:10:22 +08:00
|
|
|
sh 'sudo rsync -av target/das-1.0.0-release.jar root@192.168.109.195:/das/app/'
|
2024-06-20 11:56:45 +08:00
|
|
|
sh 'sudo ssh -t root@192.168.109.195 systemctl restart das'
|
2024-06-20 09:52:49 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-06-19 16:38:12 +08:00
|
|
|
}
|
|
|
|
}
|