Browse Source

优化部署文件

dev-lc
chenzhihang 1 year ago
parent
commit
bb8daeac88
2 changed files with 23 additions and 24 deletions
  1. +0
    -19
      k8s/build.sh
  2. +23
    -5
      k8s/build_and_deploy.sh

+ 0
- 19
k8s/build.sh 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


+ 23
- 5
k8s/build_and_deploy.sh 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


Loading…
Cancel
Save