From 92a05a715cb9f7740c7504d0ed71bc0c994fac52 Mon Sep 17 00:00:00 2001
From: weir <1261174789@qq.com>
Date: Fri, 23 Jul 2021 00:26:40 +0800
Subject: [PATCH 01/12] =?UTF-8?q?1.=20=E5=8D=87=E7=BA=A7Lombok=E6=8F=92?=
=?UTF-8?q?=E4=BB=B6(mvn=20package=20=20=E6=8A=A5=E9=94=99=20)=202.=20?=
=?UTF-8?q?=E5=88=9D=E7=89=88Jenkins=E6=96=87=E4=BB=B6=E5=AF=BC=E5=85=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Jenkinsfile | 110 +++++++++++++++++++++++++++++++++++++
yudao-dependencies/pom.xml | 2 +-
2 files changed, 111 insertions(+), 1 deletion(-)
create mode 100644 Jenkinsfile
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 000000000..681fea90f
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1,110 @@
+pipeline {
+ agent {
+ node {
+ label 'maven'
+ }
+ }
+
+ parameters {
+ string(name:'TAG_NAME',defaultValue: '',description:'')
+ }
+
+ environment {
+ // DockerHub 凭证 ID(登录您的 DockerHub)
+ DOCKER_CREDENTIAL_ID = 'dockerhub-id'
+ // GitHub 凭证 ID (推送 tag 到 GitHub 仓库)
+ GITHUB_CREDENTIAL_ID = 'github-id'
+ // kubeconfig 凭证 ID (访问接入正在运行的 Kubernetes 集群)
+ KUBECONFIG_CREDENTIAL_ID = 'demo-kubeconfig'
+ // 镜像的推送
+ REGISTRY = 'docker.io'
+ // DockerHub 账号名
+ DOCKERHUB_NAMESPACE = 'docker_username'
+ // GitHub 账号名
+ GITHUB_ACCOUNT = 'https://gitee.com/zhijiantianya/ruoyi-vue-pro'
+ // 应用名称
+ APP_NAME = 'yudao-admin-server'
+ }
+
+ stages {
+ stage ('checkout scm') {
+ steps {
+ checkout(scm)
+ }
+ }
+
+ stage ('unit test') {
+ steps {
+ container ('maven') {
+ sh 'mvn clean -gs `pwd`/configuration/settings.xml test'
+ }
+ }
+ }
+
+ stage ('build & push') {
+ steps {
+ container ('maven') {
+ sh 'mvn -Dmaven.test.skip=true -gs `pwd`/configuration/settings.xml clean package'
+ sh 'docker build -f Dockerfile-online -t $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:SNAPSHOT-$BRANCH_NAME-$BUILD_NUMBER .'
+ withCredentials([usernamePassword(passwordVariable : 'DOCKER_PASSWORD' ,usernameVariable : 'DOCKER_USERNAME' ,credentialsId : "$DOCKER_CREDENTIAL_ID" ,)]) {
+ sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'
+ sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:SNAPSHOT-$BRANCH_NAME-$BUILD_NUMBER'
+ }
+ }
+ }
+ }
+
+ stage('push latest'){
+ when{
+ branch 'master'
+ }
+ steps{
+ container ('maven') {
+ sh 'docker tag $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:SNAPSHOT-$BRANCH_NAME-$BUILD_NUMBER $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:latest '
+ sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:latest '
+ }
+ }
+ }
+
+ stage('deploy to dev') {
+ when{
+ branch 'master'
+ }
+ steps {
+ input(id: 'deploy-to-dev', message: 'deploy to dev?')
+ kubernetesDeploy(configs: 'deploy/dev-ol/**', enableConfigSubstitution: true, kubeconfigId: "$KUBECONFIG_CREDENTIAL_ID")
+ }
+ }
+ stage('push with tag'){
+ when{
+ expression{
+ return params.TAG_NAME =~ /v.*/
+ }
+ }
+ steps {
+ container ('maven') {
+ input(id: 'release-image-with-tag', message: 'release image with tag?')
+ withCredentials([usernamePassword(credentialsId: "$GITHUB_CREDENTIAL_ID", passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
+ sh 'git config --global user.email "kubesphere@yunify.com" '
+ sh 'git config --global user.name "kubesphere" '
+ sh 'git tag -a $TAG_NAME -m "$TAG_NAME" '
+ sh 'git push http://$GIT_USERNAME:$GIT_PASSWORD@github.com/$GITHUB_ACCOUNT/devops-java-sample.git --tags --ipv4'
+ }
+ sh 'docker tag $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:SNAPSHOT-$BRANCH_NAME-$BUILD_NUMBER $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:$TAG_NAME '
+ sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:$TAG_NAME '
+ }
+ }
+ }
+ stage('deploy to production') {
+ when{
+ expression{
+ return params.TAG_NAME =~ /v.*/
+ }
+ }
+ steps {
+ input(id: 'deploy-to-production', message: 'deploy to production?')
+ kubernetesDeploy(configs: 'deploy/prod-ol/**', enableConfigSubstitution: true, kubeconfigId: "$KUBECONFIG_CREDENTIAL_ID")
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml
index 5556b6be2..42adcdf8a 100644
--- a/yudao-dependencies/pom.xml
+++ b/yudao-dependencies/pom.xml
@@ -41,7 +41,7 @@
7.2.6.RELEASE
0.1.16
- 1.16.14
+ 1.18.12
1.4.1.Final
5.6.1
2.2.7
From 3fc6be2e320f1c18aac135facda44f7f280497a6 Mon Sep 17 00:00:00 2001
From: weir <1261174789@qq.com>
Date: Sat, 24 Jul 2021 13:56:24 +0800
Subject: [PATCH 02/12] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=83=A8=E7=BD=B2?=
=?UTF-8?q?=E8=84=9A=E6=9C=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
bin/deploy.sh | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/bin/deploy.sh b/bin/deploy.sh
index ce295c7c1..2a48893a8 100644
--- a/bin/deploy.sh
+++ b/bin/deploy.sh
@@ -8,7 +8,7 @@ set -e
DATE=$(date +%Y%m%d%H%M)
# 基础路径
-BASE_PATH=/work/projects/yudao-admin-server
+BASE_PATH=/media/pi/KINGTON/data/work/projects/yudao-admin-server
# 编译后 jar 的地址。部署时,Jenkins 会上传 jar 包到该目录下
SOURCE_PATH=$BASE_PATH/build
# 服务名称。同时约定部署服务的 jar 包名字也为它。
@@ -24,11 +24,11 @@ HEAP_ERROR_PATH=$BASE_PATH/heapError
JAVA_OPS="-Xms512m -Xmx512m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=$HEAP_ERROR_PATH"
# SkyWalking Agent 配置
-export SW_AGENT_NAME=$SERVER_NAME
-export SW_AGENT_COLLECTOR_BACKEND_SERVICES=192.168.0.84:11800
-export SW_GRPC_LOG_SERVER_HOST=192.168.0.84
-export SW_AGENT_TRACE_IGNORE_PATH="Redisson/PING,/actuator/**,/admin/**"
-export JAVA_AGENT=-javaagent:/work/skywalking/apache-skywalking-apm-bin/agent/skywalking-agent.jar
+#export SW_AGENT_NAME=$SERVER_NAME
+#export SW_AGENT_COLLECTOR_BACKEND_SERVICES=192.168.0.84:11800
+#export SW_GRPC_LOG_SERVER_HOST=192.168.0.84
+#export SW_AGENT_TRACE_IGNORE_PATH="Redisson/PING,/actuator/**,/admin/**"
+#export JAVA_AGENT=-javaagent:/work/skywalking/apache-skywalking-apm-bin/agent/skywalking-agent.jar
# 备份
function backup() {
@@ -159,7 +159,7 @@ function deploy() {
# 启动 Java 服务
start
# 健康检查
- healthCheck
+# healthCheck
}
deploy
From b4f2e6b12a4d4246b37720ee167bab7623515f4d Mon Sep 17 00:00:00 2001
From: weir <1261174789@qq.com>
Date: Sat, 24 Jul 2021 14:43:09 +0800
Subject: [PATCH 03/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A5=E5=BF=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
yudao-admin-server/src/main/resources/logback-spring.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/yudao-admin-server/src/main/resources/logback-spring.xml b/yudao-admin-server/src/main/resources/logback-spring.xml
index 5bc181fd2..eba05d64a 100644
--- a/yudao-admin-server/src/main/resources/logback-spring.xml
+++ b/yudao-admin-server/src/main/resources/logback-spring.xml
@@ -70,6 +70,7 @@
+
From 919eca95f98f046509d7a5155e1523b6754a2742 Mon Sep 17 00:00:00 2001
From: weir <1261174789@qq.com>
Date: Sun, 25 Jul 2021 01:24:50 +0800
Subject: [PATCH 04/12] =?UTF-8?q?=E6=B7=BB=E5=8A=A0Jenkinsfile?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Jenkinsfile | 91 ++++---------------
.../src/main/resources/logback-spring.xml | 1 -
yudao-admin-ui/Jenkinsfile | 41 +++++++++
3 files changed, 58 insertions(+), 75 deletions(-)
create mode 100644 yudao-admin-ui/Jenkinsfile
diff --git a/Jenkinsfile b/Jenkinsfile
index 681fea90f..318d4cb92 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,12 +1,10 @@
+#!groovy
pipeline {
- agent {
- node {
- label 'maven'
- }
- }
+
+ agent any
parameters {
- string(name:'TAG_NAME',defaultValue: '',description:'')
+ string(name: 'TAG_NAME', defaultValue: '', description: '')
}
environment {
@@ -24,87 +22,32 @@ pipeline {
GITHUB_ACCOUNT = 'https://gitee.com/zhijiantianya/ruoyi-vue-pro'
// 应用名称
APP_NAME = 'yudao-admin-server'
+ // 应用部署路径
+ APP_DEPLOY_BASE_DIR = '/media/pi/KINGTON/data/work/projects/'
}
stages {
- stage ('checkout scm') {
+ stage('检出') {
steps {
- checkout(scm)
+ git url: "https://gitee.com/will-we/ruoyi-vue-pro.git",
+ branch: "devops"
}
}
- stage ('unit test') {
+ stage('构建') {
steps {
- container ('maven') {
- sh 'mvn clean -gs `pwd`/configuration/settings.xml test'
- }
+ sh 'mvn clean package -Dmaven.test.skip=true'
}
}
- stage ('build & push') {
+ stage('部署') {
steps {
- container ('maven') {
- sh 'mvn -Dmaven.test.skip=true -gs `pwd`/configuration/settings.xml clean package'
- sh 'docker build -f Dockerfile-online -t $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:SNAPSHOT-$BRANCH_NAME-$BUILD_NUMBER .'
- withCredentials([usernamePassword(passwordVariable : 'DOCKER_PASSWORD' ,usernameVariable : 'DOCKER_USERNAME' ,credentialsId : "$DOCKER_CREDENTIAL_ID" ,)]) {
- sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'
- sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:SNAPSHOT-$BRANCH_NAME-$BUILD_NUMBER'
- }
- }
+ sh 'cp -f ' + ' bin/deploy.sh ' + "${env.APP_DEPLOY_BASE_DIR}" + "${env.APP_NAME}"
+ sh 'cp -f ' + "${env.APP_NAME}" + '/target/*.jar ' + "${env.APP_DEPLOY_BASE_DIR}" + "${env.APP_NAME}" +'/build/'
+ archiveArtifacts "${env.APP_NAME}" + '/target/*.jar'
+ sh 'chmod +x ' + "${env.APP_DEPLOY_BASE_DIR}" + "${env.APP_NAME}" + '/deploy.sh'
+ sh 'bash ' + "${env.APP_DEPLOY_BASE_DIR}" + "${env.APP_NAME}" + '/deploy.sh'
}
}
-
- stage('push latest'){
- when{
- branch 'master'
- }
- steps{
- container ('maven') {
- sh 'docker tag $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:SNAPSHOT-$BRANCH_NAME-$BUILD_NUMBER $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:latest '
- sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:latest '
- }
- }
- }
-
- stage('deploy to dev') {
- when{
- branch 'master'
- }
- steps {
- input(id: 'deploy-to-dev', message: 'deploy to dev?')
- kubernetesDeploy(configs: 'deploy/dev-ol/**', enableConfigSubstitution: true, kubeconfigId: "$KUBECONFIG_CREDENTIAL_ID")
- }
- }
- stage('push with tag'){
- when{
- expression{
- return params.TAG_NAME =~ /v.*/
- }
- }
- steps {
- container ('maven') {
- input(id: 'release-image-with-tag', message: 'release image with tag?')
- withCredentials([usernamePassword(credentialsId: "$GITHUB_CREDENTIAL_ID", passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
- sh 'git config --global user.email "kubesphere@yunify.com" '
- sh 'git config --global user.name "kubesphere" '
- sh 'git tag -a $TAG_NAME -m "$TAG_NAME" '
- sh 'git push http://$GIT_USERNAME:$GIT_PASSWORD@github.com/$GITHUB_ACCOUNT/devops-java-sample.git --tags --ipv4'
- }
- sh 'docker tag $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:SNAPSHOT-$BRANCH_NAME-$BUILD_NUMBER $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:$TAG_NAME '
- sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:$TAG_NAME '
- }
- }
- }
- stage('deploy to production') {
- when{
- expression{
- return params.TAG_NAME =~ /v.*/
- }
- }
- steps {
- input(id: 'deploy-to-production', message: 'deploy to production?')
- kubernetesDeploy(configs: 'deploy/prod-ol/**', enableConfigSubstitution: true, kubeconfigId: "$KUBECONFIG_CREDENTIAL_ID")
- }
- }
}
}
\ No newline at end of file
diff --git a/yudao-admin-server/src/main/resources/logback-spring.xml b/yudao-admin-server/src/main/resources/logback-spring.xml
index eba05d64a..5bc181fd2 100644
--- a/yudao-admin-server/src/main/resources/logback-spring.xml
+++ b/yudao-admin-server/src/main/resources/logback-spring.xml
@@ -70,7 +70,6 @@
-
diff --git a/yudao-admin-ui/Jenkinsfile b/yudao-admin-ui/Jenkinsfile
new file mode 100644
index 000000000..5cb6d70e2
--- /dev/null
+++ b/yudao-admin-ui/Jenkinsfile
@@ -0,0 +1,41 @@
+#!groovy
+pipeline {
+
+ agent any
+
+ tools { nodejs "nodejs" }
+
+ parameters {
+ string(name: 'TAG_NAME', defaultValue: '', description: '')
+ }
+
+ environment {
+ APP_NAME = 'yudao-admin-ui'
+ NGINX_WORKDIR = '/home/pi/mydata/nginx/html/'
+ }
+
+ stages {
+ stage('检出') {
+ steps {
+ git url: "https://gitee.com/will-we/ruoyi-vue-pro.git",
+ branch: "devops"
+ }
+ }
+
+ stage('构建') {
+ steps {
+ sh 'cnpm --prefix '+ "${env.APP_NAME}" +' install'
+ sh 'cnpm --prefix '+ "${env.APP_NAME}" +' run build:demo1024'
+ }
+ }
+
+ stage('部署') {
+ steps {
+ sh 'cp -rf ' + "${env.APP_NAME}" + '/dist/. ' + "${env.NGINX_WORKDIR}"
+ sh 'tar -zcvf ' + "${env.APP_NAME}" + '/'+ "${env.APP_NAME}" + '.tar.gz ' + "${env.APP_NAME}" + '/dist/'
+ archiveArtifacts "${env.APP_NAME}" + '/'+ "${env.APP_NAME}" + '.tar.gz'
+ //TODO 考虑刷新缓存的问题
+ }
+ }
+ }
+}
From b5695494c2cdd9b1ff0b98e27eed5fddef7419c3 Mon Sep 17 00:00:00 2001
From: weir <1261174789@qq.com>
Date: Sun, 25 Jul 2021 11:38:18 +0800
Subject: [PATCH 05/12] =?UTF-8?q?Jenkinsfile=20=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
yudao-admin-ui/Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/yudao-admin-ui/Jenkinsfile b/yudao-admin-ui/Jenkinsfile
index 5cb6d70e2..06a4ba34e 100644
--- a/yudao-admin-ui/Jenkinsfile
+++ b/yudao-admin-ui/Jenkinsfile
@@ -25,7 +25,7 @@ pipeline {
stage('构建') {
steps {
sh 'cnpm --prefix '+ "${env.APP_NAME}" +' install'
- sh 'cnpm --prefix '+ "${env.APP_NAME}" +' run build:demo1024'
+ sh 'cnpm --prefix '+ "${env.APP_NAME}" +' run build:prod'
}
}
From d5997c4dc0c1e3268441fa69e835326bc13b65a9 Mon Sep 17 00:00:00 2001
From: weir <1261174789@qq.com>
Date: Sun, 25 Jul 2021 16:24:45 +0800
Subject: [PATCH 06/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=89=8D=E7=AB=AF?=
=?UTF-8?q?=E9=83=A8=E7=BD=B2=E8=B7=AF=E5=BE=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../controller/job/InfJobController.java | 37 +++++++++++++++----
yudao-admin-ui/.env.production | 2 +
yudao-admin-ui/Jenkinsfile | 4 +-
3 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/job/InfJobController.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/job/InfJobController.java
index 1cd3c8dc7..2fe29304d 100644
--- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/job/InfJobController.java
+++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/job/InfJobController.java
@@ -1,19 +1,25 @@
package cn.iocoder.yudao.adminserver.modules.infra.controller.job;
+import cn.iocoder.yudao.adminserver.modules.infra.controller.job.vo.job.*;
+import cn.iocoder.yudao.adminserver.modules.infra.convert.job.InfJobConvert;
+import cn.iocoder.yudao.adminserver.modules.infra.dal.dataobject.job.InfJobDO;
+import cn.iocoder.yudao.adminserver.modules.infra.service.job.InfJobService;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.framework.quartz.core.util.CronUtils;
-import cn.iocoder.yudao.adminserver.modules.infra.controller.job.vo.job.*;
-import cn.iocoder.yudao.adminserver.modules.infra.convert.job.InfJobConvert;
-import cn.iocoder.yudao.adminserver.modules.infra.dal.dataobject.job.InfJobDO;
-import cn.iocoder.yudao.adminserver.modules.infra.service.job.InfJobService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
+import org.quartz.Scheduler;
import org.quartz.SchedulerException;
+import org.quartz.impl.StdScheduler;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor;
+import org.springframework.scheduling.config.ScheduledTask;
+import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -22,10 +28,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@@ -39,6 +42,15 @@ public class InfJobController {
@Resource
private InfJobService jobService;
+ @Autowired
+ private SchedulerFactoryBean schedulerFactoryBean;
+
+ @Autowired
+ private StdScheduler stdScheduler;
+
+ @Autowired
+ private ScheduledAnnotationBeanPostProcessor scheduledAnnotationBeanPostProcessor;
+
@PostMapping("/create")
@ApiOperation("创建定时任务")
@PreAuthorize("@ss.hasPermission('infra:job:create')")
@@ -111,6 +123,15 @@ public class InfJobController {
@PreAuthorize("@ss.hasPermission('infra:job:query')")
public CommonResult> getJobPage(@Valid InfJobPageReqVO pageVO) {
PageResult pageResult = jobService.getJobPage(pageVO);
+ Scheduler scheduler = schedulerFactoryBean.getScheduler();
+ Set scheduledTasks = scheduledAnnotationBeanPostProcessor.getScheduledTasks();
+ Iterator scheduledTaskIterator = scheduledTasks.iterator();
+ while (scheduledTaskIterator.hasNext()) {
+ System.err.println("=================================");
+ ScheduledTask scheduledTask = scheduledTaskIterator.next();
+ scheduledAnnotationBeanPostProcessor.postProcessAfterInitialization(scheduledTask, scheduledTask.toString());
+ System.err.println("=================================");
+ }
return success(InfJobConvert.INSTANCE.convertPage(pageResult));
}
diff --git a/yudao-admin-ui/.env.production b/yudao-admin-ui/.env.production
index e00052eb6..850530aca 100644
--- a/yudao-admin-ui/.env.production
+++ b/yudao-admin-ui/.env.production
@@ -3,3 +3,5 @@ ENV = 'production'
# 芋道管理系统/生产环境
VUE_APP_BASE_API = '/prod-api'
+# 静态资源地址
+PUBLIC_PATH = 'yudao-admin'
diff --git a/yudao-admin-ui/Jenkinsfile b/yudao-admin-ui/Jenkinsfile
index 06a4ba34e..68490b579 100644
--- a/yudao-admin-ui/Jenkinsfile
+++ b/yudao-admin-ui/Jenkinsfile
@@ -10,7 +10,7 @@ pipeline {
}
environment {
- APP_NAME = 'yudao-admin-ui'
+ APP_NAME = 'yudao-admin'
NGINX_WORKDIR = '/home/pi/mydata/nginx/html/'
}
@@ -31,7 +31,7 @@ pipeline {
stage('部署') {
steps {
- sh 'cp -rf ' + "${env.APP_NAME}" + '/dist/. ' + "${env.NGINX_WORKDIR}"
+ sh 'cp -rf ' + "${env.APP_NAME}" + '/dist/. ' + "${env.NGINX_WORKDIR}" + "${env.APP_NAME}"
sh 'tar -zcvf ' + "${env.APP_NAME}" + '/'+ "${env.APP_NAME}" + '.tar.gz ' + "${env.APP_NAME}" + '/dist/'
archiveArtifacts "${env.APP_NAME}" + '/'+ "${env.APP_NAME}" + '.tar.gz'
//TODO 考虑刷新缓存的问题
From 9482b3b220e628f7713ff8ab04575b436ff60ee5 Mon Sep 17 00:00:00 2001
From: weir <1261174789@qq.com>
Date: Sun, 25 Jul 2021 18:59:20 +0800
Subject: [PATCH 07/12] =?UTF-8?q?1.=20=E4=BF=AE=E6=94=B9=E6=97=A5=E5=BF=97?=
=?UTF-8?q?=202.=E5=9B=9E=E9=80=80=E6=8F=90=E4=BA=A4=E6=B5=8B=E8=AF=95?=
=?UTF-8?q?=E4=BB=A3=E7=A0=81=203.=20=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Jenkinsfile | 7 ++++
.../controller/job/InfJobController.java | 37 ++++---------------
.../src/main/resources/logback-spring.xml | 2 +-
3 files changed, 16 insertions(+), 30 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 318d4cb92..bf5ad821a 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -36,6 +36,13 @@ pipeline {
stage('构建') {
steps {
+ // TODO 解决多环境链接、密码不同配置临时方案
+ sh 'if [ ! -d "' + "${env.HOME}" + '/resources" ];then\n' +
+ ' echo "配置文件不存在无需修改"\n' +
+ 'else\n' +
+ ' cp -rf /home/pi/resources/*.yaml ' + "${env.APP_NAME}" + '/src/main/resources\n' +
+ ' echo "配置文件替换"\n' +
+ 'fi'
sh 'mvn clean package -Dmaven.test.skip=true'
}
}
diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/job/InfJobController.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/job/InfJobController.java
index 2fe29304d..1cd3c8dc7 100644
--- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/job/InfJobController.java
+++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/job/InfJobController.java
@@ -1,25 +1,19 @@
package cn.iocoder.yudao.adminserver.modules.infra.controller.job;
-import cn.iocoder.yudao.adminserver.modules.infra.controller.job.vo.job.*;
-import cn.iocoder.yudao.adminserver.modules.infra.convert.job.InfJobConvert;
-import cn.iocoder.yudao.adminserver.modules.infra.dal.dataobject.job.InfJobDO;
-import cn.iocoder.yudao.adminserver.modules.infra.service.job.InfJobService;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.framework.quartz.core.util.CronUtils;
+import cn.iocoder.yudao.adminserver.modules.infra.controller.job.vo.job.*;
+import cn.iocoder.yudao.adminserver.modules.infra.convert.job.InfJobConvert;
+import cn.iocoder.yudao.adminserver.modules.infra.dal.dataobject.job.InfJobDO;
+import cn.iocoder.yudao.adminserver.modules.infra.service.job.InfJobService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
-import org.quartz.Scheduler;
import org.quartz.SchedulerException;
-import org.quartz.impl.StdScheduler;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor;
-import org.springframework.scheduling.config.ScheduledTask;
-import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -28,7 +22,10 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
-import java.util.*;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@@ -42,15 +39,6 @@ public class InfJobController {
@Resource
private InfJobService jobService;
- @Autowired
- private SchedulerFactoryBean schedulerFactoryBean;
-
- @Autowired
- private StdScheduler stdScheduler;
-
- @Autowired
- private ScheduledAnnotationBeanPostProcessor scheduledAnnotationBeanPostProcessor;
-
@PostMapping("/create")
@ApiOperation("创建定时任务")
@PreAuthorize("@ss.hasPermission('infra:job:create')")
@@ -123,15 +111,6 @@ public class InfJobController {
@PreAuthorize("@ss.hasPermission('infra:job:query')")
public CommonResult> getJobPage(@Valid InfJobPageReqVO pageVO) {
PageResult pageResult = jobService.getJobPage(pageVO);
- Scheduler scheduler = schedulerFactoryBean.getScheduler();
- Set scheduledTasks = scheduledAnnotationBeanPostProcessor.getScheduledTasks();
- Iterator scheduledTaskIterator = scheduledTasks.iterator();
- while (scheduledTaskIterator.hasNext()) {
- System.err.println("=================================");
- ScheduledTask scheduledTask = scheduledTaskIterator.next();
- scheduledAnnotationBeanPostProcessor.postProcessAfterInitialization(scheduledTask, scheduledTask.toString());
- System.err.println("=================================");
- }
return success(InfJobConvert.INSTANCE.convertPage(pageResult));
}
diff --git a/yudao-admin-server/src/main/resources/logback-spring.xml b/yudao-admin-server/src/main/resources/logback-spring.xml
index 5bc181fd2..8c85ad493 100644
--- a/yudao-admin-server/src/main/resources/logback-spring.xml
+++ b/yudao-admin-server/src/main/resources/logback-spring.xml
@@ -65,7 +65,7 @@
-
+
From 03b52bfb2e72b72f9cdca1bfa413a0709131e384 Mon Sep 17 00:00:00 2001
From: weir <1261174789@qq.com>
Date: Sun, 25 Jul 2021 19:08:01 +0800
Subject: [PATCH 08/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
yudao-admin-ui/Jenkinsfile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/yudao-admin-ui/Jenkinsfile b/yudao-admin-ui/Jenkinsfile
index 68490b579..fec52131e 100644
--- a/yudao-admin-ui/Jenkinsfile
+++ b/yudao-admin-ui/Jenkinsfile
@@ -10,7 +10,7 @@ pipeline {
}
environment {
- APP_NAME = 'yudao-admin'
+ APP_NAME = 'yudao-admin-ui'
NGINX_WORKDIR = '/home/pi/mydata/nginx/html/'
}
@@ -31,6 +31,7 @@ pipeline {
stage('部署') {
steps {
+ sh 'mkdir -p ' + "${env.NGINX_WORKDIR}" + "${env.APP_NAME}"
sh 'cp -rf ' + "${env.APP_NAME}" + '/dist/. ' + "${env.NGINX_WORKDIR}" + "${env.APP_NAME}"
sh 'tar -zcvf ' + "${env.APP_NAME}" + '/'+ "${env.APP_NAME}" + '.tar.gz ' + "${env.APP_NAME}" + '/dist/'
archiveArtifacts "${env.APP_NAME}" + '/'+ "${env.APP_NAME}" + '.tar.gz'
From 25a82f07c7a7700a322b0af2732091bae61a93ed Mon Sep 17 00:00:00 2001
From: weir <1261174789@qq.com>
Date: Sun, 25 Jul 2021 19:43:31 +0800
Subject: [PATCH 09/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B7=AF=E5=BE=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Jenkinsfile | 2 +-
yudao-admin-ui/Jenkinsfile | 7 ++++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index bf5ad821a..38789a064 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -40,7 +40,7 @@ pipeline {
sh 'if [ ! -d "' + "${env.HOME}" + '/resources" ];then\n' +
' echo "配置文件不存在无需修改"\n' +
'else\n' +
- ' cp -rf /home/pi/resources/*.yaml ' + "${env.APP_NAME}" + '/src/main/resources\n' +
+ ' cp -rf ' + "${env.HOME}" + '/resources/*.yaml ' + "${env.APP_NAME}" + '/src/main/resources\n' +
' echo "配置文件替换"\n' +
'fi'
sh 'mvn clean package -Dmaven.test.skip=true'
diff --git a/yudao-admin-ui/Jenkinsfile b/yudao-admin-ui/Jenkinsfile
index fec52131e..2736815dc 100644
--- a/yudao-admin-ui/Jenkinsfile
+++ b/yudao-admin-ui/Jenkinsfile
@@ -10,7 +10,8 @@ pipeline {
}
environment {
- APP_NAME = 'yudao-admin-ui'
+ APP_NAME = 'yudao-admin'
+ APP_PACKAGE='yudao-admin-ui'
NGINX_WORKDIR = '/home/pi/mydata/nginx/html/'
}
@@ -24,8 +25,8 @@ pipeline {
stage('构建') {
steps {
- sh 'cnpm --prefix '+ "${env.APP_NAME}" +' install'
- sh 'cnpm --prefix '+ "${env.APP_NAME}" +' run build:prod'
+ sh 'cnpm --prefix '+ "${env.APP_PACKAGE}" +' install'
+ sh 'cnpm --prefix '+ "${env.APP_PACKAGE}" +' run build:prod'
}
}
From 51a22da644545892e4bda8821db24daf01436543 Mon Sep 17 00:00:00 2001
From: weir <1261174789@qq.com>
Date: Sun, 25 Jul 2021 20:45:54 +0800
Subject: [PATCH 10/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B7=AF=E5=BE=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
yudao-admin-ui/Jenkinsfile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/yudao-admin-ui/Jenkinsfile b/yudao-admin-ui/Jenkinsfile
index 2736815dc..968363fa3 100644
--- a/yudao-admin-ui/Jenkinsfile
+++ b/yudao-admin-ui/Jenkinsfile
@@ -33,8 +33,8 @@ pipeline {
stage('部署') {
steps {
sh 'mkdir -p ' + "${env.NGINX_WORKDIR}" + "${env.APP_NAME}"
- sh 'cp -rf ' + "${env.APP_NAME}" + '/dist/. ' + "${env.NGINX_WORKDIR}" + "${env.APP_NAME}"
- sh 'tar -zcvf ' + "${env.APP_NAME}" + '/'+ "${env.APP_NAME}" + '.tar.gz ' + "${env.APP_NAME}" + '/dist/'
+ sh 'cp -rf ' + "${env.APP_PACKAGE}" + '/dist/. ' + "${env.NGINX_WORKDIR}" + "${env.APP_NAME}"
+ sh 'tar -zcvf ' + "${env.APP_NAME}" + '/'+ "${env.APP_NAME}" + '.tar.gz ' + "${env.APP_PACKAGE}" + '/dist/'
archiveArtifacts "${env.APP_NAME}" + '/'+ "${env.APP_NAME}" + '.tar.gz'
//TODO 考虑刷新缓存的问题
}
From cb1fa73a4b1fb3f3986df7a7ab9051497e17e399 Mon Sep 17 00:00:00 2001
From: weir <1261174789@qq.com>
Date: Sun, 25 Jul 2021 23:31:13 +0800
Subject: [PATCH 11/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B7=AF=E5=BE=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
yudao-admin-ui/.env.production | 3 +--
yudao-admin-ui/Jenkinsfile | 5 +++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/yudao-admin-ui/.env.production b/yudao-admin-ui/.env.production
index 850530aca..59e977414 100644
--- a/yudao-admin-ui/.env.production
+++ b/yudao-admin-ui/.env.production
@@ -3,5 +3,4 @@ ENV = 'production'
# 芋道管理系统/生产环境
VUE_APP_BASE_API = '/prod-api'
-# 静态资源地址
-PUBLIC_PATH = 'yudao-admin'
+
diff --git a/yudao-admin-ui/Jenkinsfile b/yudao-admin-ui/Jenkinsfile
index 968363fa3..cd20133e1 100644
--- a/yudao-admin-ui/Jenkinsfile
+++ b/yudao-admin-ui/Jenkinsfile
@@ -32,10 +32,11 @@ pipeline {
stage('部署') {
steps {
+ sh 'rm -f ' + "${env.APP_NAME}" + '/'+ "${env.APP_NAME}" + '.tar.gz'
sh 'mkdir -p ' + "${env.NGINX_WORKDIR}" + "${env.APP_NAME}"
sh 'cp -rf ' + "${env.APP_PACKAGE}" + '/dist/. ' + "${env.NGINX_WORKDIR}" + "${env.APP_NAME}"
- sh 'tar -zcvf ' + "${env.APP_NAME}" + '/'+ "${env.APP_NAME}" + '.tar.gz ' + "${env.APP_PACKAGE}" + '/dist/'
- archiveArtifacts "${env.APP_NAME}" + '/'+ "${env.APP_NAME}" + '.tar.gz'
+ sh 'tar -zcvf ' + "${env.APP_PACKAGE}" + '/'+ "${env.APP_PACKAGE}" + '.tar.gz ' + "${env.APP_PACKAGE}" + '/dist/'
+ archiveArtifacts "${env.APP_PACKAGE}" + '/'+ "${env.APP_PACKAGE}" + '.tar.gz'
//TODO 考虑刷新缓存的问题
}
}
From 91baf4185eb512cd05f8e864a9bbe0449c0d6172 Mon Sep 17 00:00:00 2001
From: weir <1261174789@qq.com>
Date: Tue, 27 Jul 2021 21:42:08 +0800
Subject: [PATCH 12/12] =?UTF-8?q?=E4=BA=8C=E7=BA=A7=E9=83=A8=E7=BD=B2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
yudao-admin-ui/.env.production | 4 ++++
yudao-admin-ui/Jenkinsfile | 12 ++++++------
yudao-admin-ui/src/router/index.js | 1 +
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/yudao-admin-ui/.env.production b/yudao-admin-ui/.env.production
index 59e977414..5c64ef413 100644
--- a/yudao-admin-ui/.env.production
+++ b/yudao-admin-ui/.env.production
@@ -3,4 +3,8 @@ ENV = 'production'
# 芋道管理系统/生产环境
VUE_APP_BASE_API = '/prod-api'
+# 根据服务器或域名修改
+PUBLIC_PATH = 'http://you_ip.cn/yudao-admin/'
+# 二级部署路径
+VUE_APP_APP_NAME ='yudao-admin'
diff --git a/yudao-admin-ui/Jenkinsfile b/yudao-admin-ui/Jenkinsfile
index cd20133e1..65d18d449 100644
--- a/yudao-admin-ui/Jenkinsfile
+++ b/yudao-admin-ui/Jenkinsfile
@@ -11,7 +11,7 @@ pipeline {
environment {
APP_NAME = 'yudao-admin'
- APP_PACKAGE='yudao-admin-ui'
+ PROJECT_DIR='yudao-admin-ui'
NGINX_WORKDIR = '/home/pi/mydata/nginx/html/'
}
@@ -25,8 +25,8 @@ pipeline {
stage('构建') {
steps {
- sh 'cnpm --prefix '+ "${env.APP_PACKAGE}" +' install'
- sh 'cnpm --prefix '+ "${env.APP_PACKAGE}" +' run build:prod'
+ sh 'cnpm --prefix '+ "${env.PROJECT_DIR}" +' install'
+ sh 'cnpm --prefix '+ "${env.PROJECT_DIR}" +' run build:prod'
}
}
@@ -34,9 +34,9 @@ pipeline {
steps {
sh 'rm -f ' + "${env.APP_NAME}" + '/'+ "${env.APP_NAME}" + '.tar.gz'
sh 'mkdir -p ' + "${env.NGINX_WORKDIR}" + "${env.APP_NAME}"
- sh 'cp -rf ' + "${env.APP_PACKAGE}" + '/dist/. ' + "${env.NGINX_WORKDIR}" + "${env.APP_NAME}"
- sh 'tar -zcvf ' + "${env.APP_PACKAGE}" + '/'+ "${env.APP_PACKAGE}" + '.tar.gz ' + "${env.APP_PACKAGE}" + '/dist/'
- archiveArtifacts "${env.APP_PACKAGE}" + '/'+ "${env.APP_PACKAGE}" + '.tar.gz'
+ sh 'cp -rf ' + "${env.PROJECT_DIR}" + '/dist/. ' + "${env.NGINX_WORKDIR}" + "${env.APP_NAME}"
+ sh 'tar -zcvf ' + "${env.PROJECT_DIR}" + '/'+ "${env.PROJECT_DIR}" + '.tar.gz ' + "${env.PROJECT_DIR}" + '/dist/'
+ archiveArtifacts "${env.PROJECT_DIR}" + '/'+ "${env.PROJECT_DIR}" + '.tar.gz'
//TODO 考虑刷新缓存的问题
}
}
diff --git a/yudao-admin-ui/src/router/index.js b/yudao-admin-ui/src/router/index.js
index a4f676306..82a304551 100644
--- a/yudao-admin-ui/src/router/index.js
+++ b/yudao-admin-ui/src/router/index.js
@@ -122,6 +122,7 @@ export const constantRoutes = [
]
export default new Router({
+ base: process.env.VUE_APP_APP_NAME ? process.env.VUE_APP_APP_NAME : "/",
mode: 'history', // 去掉url中的#
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes