From 65a7b8eb31f44e701702a508dddfd71b087ab2a9 Mon Sep 17 00:00:00 2001 From: jsonwan Date: Thu, 21 Sep 2023 10:24:08 +0800 Subject: [PATCH 1/3] =?UTF-8?q?perf:=20job-migration=E9=95=9C=E5=83=8F?= =?UTF-8?q?=E4=B8=AD=E6=8F=90=E4=BE=9B=E5=8D=87=E7=BA=A7=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E8=B5=84=E6=BA=90=E6=96=87=E4=BB=B6=20#2462?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 提供jar包、配置模板文件、运行脚本 --- support-files/kubernetes/images/build.sh | 4 ++ .../images/migration/migration.Dockerfile | 3 +- .../images/migration/runUpgrader.sh | 37 +++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 support-files/kubernetes/images/migration/runUpgrader.sh diff --git a/support-files/kubernetes/images/build.sh b/support-files/kubernetes/images/build.sh index 84ce507858..1d3ff701d7 100755 --- a/support-files/kubernetes/images/build.sh +++ b/support-files/kubernetes/images/build.sh @@ -226,8 +226,12 @@ build_backend_modules () { # Build migration image build_migration_image(){ log "Building migration image, version: ${VERSION}..." + $BACKEND_DIR/gradlew -p $BACKEND_DIR/upgrader clean :upgrader:build -DmavenRepoUrl=$MAVEN_REPO_URL -DbkjobVersion=$VERSION rm -rf tmp/migration/* + cp $BACKEND_DIR/release/upgrader-$VERSION.jar tmp/migration/upgrader.jar cp migration/startup.sh tmp/migration + cp migration/runUpgrader.sh tmp/migration + cp $SUPPORT_FILES_DIR/templates/#etc#job#upgrader#upgrader.properties tmp/migration/upgrader.properties.tpl cp -r $SUPPORT_FILES_DIR/bkiam tmp/migration/ cp -r $SUPPORT_FILES_DIR/sql tmp/migration/ docker build -f migration/migration.Dockerfile -t $REGISTRY/job-migration:$VERSION tmp/migration --network=host diff --git a/support-files/kubernetes/images/migration/migration.Dockerfile b/support-files/kubernetes/images/migration/migration.Dockerfile index 34440efdee..6bc0d04e36 100644 --- a/support-files/kubernetes/images/migration/migration.Dockerfile +++ b/support-files/kubernetes/images/migration/migration.Dockerfile @@ -1,4 +1,4 @@ -FROM blueking/jdk:0.0.1 +FROM bkjob/jdk:0.0.3 LABEL maintainer="Tencent BlueKing Job" @@ -13,6 +13,7 @@ RUN pip install requests==2.6.0 RUN ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ echo 'Asia/Shanghai' > /etc/timezone && \ + chmod +x /data/job/exec/runUpgrader.sh && \ chmod +x /data/job/exec/startup.sh ENV LANG en_US.utf8 diff --git a/support-files/kubernetes/images/migration/runUpgrader.sh b/support-files/kubernetes/images/migration/runUpgrader.sh new file mode 100644 index 0000000000..959fd8c03f --- /dev/null +++ b/support-files/kubernetes/images/migration/runUpgrader.sh @@ -0,0 +1,37 @@ +#! /bin/sh +PROGRAM=$(basename "$0") +usage () { + cat < Date: Thu, 21 Sep 2023 10:24:08 +0800 Subject: [PATCH 2/3] =?UTF-8?q?perf:=20job-migration=E9=95=9C=E5=83=8F?= =?UTF-8?q?=E4=B8=AD=E6=8F=90=E4=BE=9B=E5=8D=87=E7=BA=A7=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E8=B5=84=E6=BA=90=E6=96=87=E4=BB=B6=20#2462?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 提供jar包、配置模板文件、运行脚本 --- support-files/kubernetes/images/build.sh | 6 ++- .../images/migration/migration.Dockerfile | 3 +- .../images/migration/runUpgrader.sh | 37 +++++++++++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 support-files/kubernetes/images/migration/runUpgrader.sh diff --git a/support-files/kubernetes/images/build.sh b/support-files/kubernetes/images/build.sh index 4f2e7dedce..62718d3853 100755 --- a/support-files/kubernetes/images/build.sh +++ b/support-files/kubernetes/images/build.sh @@ -214,8 +214,12 @@ build_backend_module () { # Build migration image build_migration_image(){ log "Building migration image, version: ${VERSION}..." + $BACKEND_DIR/gradlew -p $BACKEND_DIR clean :upgrader:build -DmavenRepoUrl=$MAVEN_REPO_URL -DbkjobVersion=$VERSION rm -rf tmp/* + cp $BACKEND_DIR/release/upgrader-$VERSION.jar tmp/upgrader.jar cp migration/startup.sh tmp/ + cp migration/runUpgrader.sh tmp/ + cp $SUPPORT_FILES_DIR/templates/#etc#job#upgrader#upgrader.properties tmp/upgrader.properties.tpl cp -r $SUPPORT_FILES_DIR/bkiam tmp/ cp -r $SUPPORT_FILES_DIR/sql tmp/ docker build -f migration/migration.Dockerfile -t $REGISTRY/job-migration:$VERSION tmp --network=host @@ -262,7 +266,7 @@ if [[ ${#BUILD_MODULES[@]} -ne 0 ]]; then if [[ "$SERVICE" == "job-frontend" ]]; then build_frontend_module elif [[ "$SERVICE" == "job-migration" ]]; then - build_migration_image + build_migration_image elif [[ "$SERVICE" == "startup-controller" ]]; then build_startup_controller_image else diff --git a/support-files/kubernetes/images/migration/migration.Dockerfile b/support-files/kubernetes/images/migration/migration.Dockerfile index 34440efdee..6bc0d04e36 100644 --- a/support-files/kubernetes/images/migration/migration.Dockerfile +++ b/support-files/kubernetes/images/migration/migration.Dockerfile @@ -1,4 +1,4 @@ -FROM blueking/jdk:0.0.1 +FROM bkjob/jdk:0.0.3 LABEL maintainer="Tencent BlueKing Job" @@ -13,6 +13,7 @@ RUN pip install requests==2.6.0 RUN ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ echo 'Asia/Shanghai' > /etc/timezone && \ + chmod +x /data/job/exec/runUpgrader.sh && \ chmod +x /data/job/exec/startup.sh ENV LANG en_US.utf8 diff --git a/support-files/kubernetes/images/migration/runUpgrader.sh b/support-files/kubernetes/images/migration/runUpgrader.sh new file mode 100644 index 0000000000..959fd8c03f --- /dev/null +++ b/support-files/kubernetes/images/migration/runUpgrader.sh @@ -0,0 +1,37 @@ +#! /bin/sh +PROGRAM=$(basename "$0") +usage () { + cat < Date: Thu, 21 Sep 2023 17:22:21 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20Job=20=E4=BA=8C=E8=BF=9B=E5=88=B6?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=97=A0=E6=8D=9F=E5=8D=87=E7=BA=A7=E5=A4=B1?= =?UTF-8?q?=E6=95=88=20#2467?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bk/job/common/consul/listener/GracefulShutdown.java | 4 +++- .../src/main/resources/META-INF/spring.factories | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/backend/commons/common-consul/src/main/java/com/tencent/bk/job/common/consul/listener/GracefulShutdown.java b/src/backend/commons/common-consul/src/main/java/com/tencent/bk/job/common/consul/listener/GracefulShutdown.java index 71be750135..4f896c4327 100644 --- a/src/backend/commons/common-consul/src/main/java/com/tencent/bk/job/common/consul/listener/GracefulShutdown.java +++ b/src/backend/commons/common-consul/src/main/java/com/tencent/bk/job/common/consul/listener/GracefulShutdown.java @@ -40,8 +40,10 @@ public class GracefulShutdown implements ApplicationListener private final ConsulServiceRegistry consulServiceRegistry; private final JobConsulProperties jobConsulProperties; - public GracefulShutdown(ConsulRegistration consulRegistration, ConsulServiceRegistry consulServiceRegistry, + public GracefulShutdown(ConsulRegistration consulRegistration, + ConsulServiceRegistry consulServiceRegistry, JobConsulProperties jobConsulProperties) { + log.info("Init consul service graceful shutdown component"); this.consulRegistration = consulRegistration; this.consulServiceRegistry = consulServiceRegistry; this.jobConsulProperties = jobConsulProperties; diff --git a/src/backend/commons/common-consul/src/main/resources/META-INF/spring.factories b/src/backend/commons/common-consul/src/main/resources/META-INF/spring.factories index 0f4a6a6e45..b040d5216d 100644 --- a/src/backend/commons/common-consul/src/main/resources/META-INF/spring.factories +++ b/src/backend/commons/common-consul/src/main/resources/META-INF/spring.factories @@ -1,3 +1,4 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ com.tencent.bk.job.common.consul.config.JobApplicationAvailabilityAutoConfiguration,\ -com.tencent.bk.job.common.consul.config.JobConsulAutoConfiguration +com.tencent.bk.job.common.consul.config.JobConsulAutoConfiguration,\ +com.tencent.bk.job.common.consul.config.GracefulShutdownAutoConfiguration