Skip to content

Commit

Permalink
Merge pull request #2470 from jsonwan/3.7.x
Browse files Browse the repository at this point in the history
perf: job-migration镜像中提供升级工具相关资源文件 #2462
  • Loading branch information
jsonwan authored Sep 21, 2023
2 parents a7919cb + dde1b63 commit 9dc486c
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
6 changes: 5 additions & 1 deletion support-files/kubernetes/images/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM blueking/jdk:0.0.1
FROM bkjob/jdk:0.0.3

LABEL maintainer="Tencent BlueKing Job"

Expand All @@ -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
Expand Down
37 changes: 37 additions & 0 deletions support-files/kubernetes/images/migration/runUpgrader.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#! /bin/sh
PROGRAM=$(basename "$0")
usage () {
cat <<EOF
Usage:
$PROGRAM [FROM_VERSION] [TO_VERSION]
FROM_VERSION:升级前的系统版本号,如3.5.1-rc.4
TO_VERSION:升级后的系统版本号,如3.6.2-rc.4
注意:请先通过配置模板文件upgrader.properties.tpl渲染生成配置文件upgrader.properties后再执行该脚本
EOF
}

usage_and_exit () {
usage
exit "$1"
}

# Parse command line
fromVersion=""
toVersion=""
if [ $# -eq 2 ]; then
fromVersion=$1
toVersion=$2
echo "fromVersion=$fromVersion"
echo "toVersion=$toVersion"
else
usage_and_exit 1
fi

if [ ! -f "upgrader.properties" ];then
usage_and_exit 1
fi

if [[ ! -d /data/job/logs ]];then
mkdir -p /data/job/logs
fi
java -Dfile.encoding=utf8 -Djob.log.dir=/data/job/logs -Dconfig.file=upgrader.properties -jar upgrader.jar $fromVersion $toVersion AFTER_UPDATE_JOB

0 comments on commit 9dc486c

Please sign in to comment.