Skip to content

Commit

Permalink
Merge pull request TencentBlueKing#2479 from jsonwan/github_master
Browse files Browse the repository at this point in the history
Merge: 3.8.x->master
  • Loading branch information
jsonwan authored Sep 25, 2023
2 parents 8faab1a + 5182d82 commit f538517
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 @@ -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
Expand Down Expand Up @@ -275,7 +279,7 @@ if [[ ${#BUILD_MODULES[@]} -ne 0 ]]; then
elif [[ "$MODULE" == "startup-controller" ]]; then
build_startup_controller_image
elif [[ ${BACKENDS[@]} =~ "${MODULE}" ]]; then
BUILD_BACKEND_MODULES[${#BUILD_BACKEND_MODULES[*]}]=${MODULE}
BUILD_BACKEND_MODULES[${#BUILD_BACKEND_MODULES[*]}]=${MODULE}
fi
done
if [[ ${#BUILD_BACKEND_MODULES[*]} > 0 ]] ; then
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 f538517

Please sign in to comment.