优化部署文件

This commit is contained in:
chenzhihang 2024-10-24 14:04:49 +08:00
parent 3178853faa
commit bb8daeac88
2 changed files with 23 additions and 24 deletions

View File

@ -41,25 +41,6 @@ fi
baseDir="/home/somuns/ci4s"
cd ${baseDir}
# 拉取指定分支的最新代码
echo "Checking out and pulling branch $branch..."
git stash
git checkout $branch
if [ $? -ne 0 ]; then
echo "切换到分支 $branch 失败,请检查分支名称是否正确!"
exit 1
fi
git stash
git pull origin $branch
if [ $? -ne 0 ]; then
echo "拉取代码失败,请检查网络或联系管理员!"
exit 1
fi
chmod +777 ${baseDir}/k8s/*.sh
# 创建目录
mkdir -p ${baseDir}/k8s/dockerfiles/jar
mkdir -p ${baseDir}/k8s/dockerfiles/html

View File

@ -3,11 +3,6 @@
#记录开始时间
startTime=$(date +%s)
# 登录到目标环境
baseDir="/home/somuns/ci4s"
cd ${baseDir}
#build
# 默认参数
branch="master"
@ -50,6 +45,29 @@ if [[ ! " ${valid_envs[@]} " =~ " $env " ]]; then
exit 1
fi
# 拉取指定分支的最新代码
echo "Checking out and pulling branch $branch..."
git stash
git checkout $branch
if [ $? -ne 0 ]; then
echo "切换到分支 $branch 失败,请检查分支名称是否正确!"
exit 1
fi
git stash
git pull origin $branch
if [ $? -ne 0 ]; then
echo "拉取代码失败,请检查网络或联系管理员!"
exit 1
fi
chmod +777 ${baseDir}/k8s/*.sh
# 登录到目标环境
baseDir="/home/somuns/ci4s"
cd ${baseDir}
echo "start build"
sh ${baseDir}/k8s/build.sh -b ${branch} -s ${service}
if [ $? -ne 0 ]; then