12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- starttime=`date +'%Y-%m-%d %H:%M:%S'`
- #mvn clean package -DskipTests
- currentTimeStamp=$(cat version.txt)
- sed -i "s%#version_num#%$currentTimeStamp%g" deployment_local.yaml
- docker build . -t registry.cn-shanghai.aliyuncs.com/ab-inbev-apac/abi-cloud-qr-platform-service:$currentTimeStamp
- docker push registry.cn-shanghai.aliyuncs.com/ab-inbev-apac/abi-cloud-qr-platform-service:$currentTimeStamp
- kubectl apply -f deployment_local.yaml -n $1
- kubectl get pods -n $1 -o wide | grep abi-cloud-qr-platform-service
- if [ $2 ] ; then
- kubectl apply -f deployment_local.yaml -n $2
- kubectl get pods -n $2 -o wide | grep abi-cloud-qr-platform-service
- echo __$1__$2"环境发版结束"
- else
- echo $1"环境发版结束"
- fi
- sed -i "s%$currentTimeStamp%#version_num#%g" deployment_local.yaml
- COUNTER=$(kubectl get pods -n $1 -o wide| grep abi-cloud-qr-platform-service | awk 'END{print NR}')
- endtime=`date +'%Y-%m-%d %H:%M:%S'`
- start_seconds=$(date --date="$starttime" +%s)
- end_seconds=$(date --date="$endtime" +%s)
- echo "运行时间: "$((end_seconds-start_seconds))"s"
- timeout=0
- while [ "$COUNTER" -gt 1 ]; do
- sleep 10
- COUNTER=$(kubectl get pods -n $1 -o wide| grep abi-cloud-qr-platform-service | awk 'END{print NR}')
- kubectl get pods -n $1 -o wide| grep abi-cloud-qr-platform-service
- echo $COUNTER
- timeout=$(($timeout+10))
- if [ "$timeout" -gt 100 ]; then
- echo "发版异常,请访问https://cs.console.aliyun.com/"
- break
- fi
- #strin=$(kubectl get pods -n $1 -o wide| grep abi-cloud-qr-platform-service | grep Running | awk '{print$1}')
- # kubectl logs --tail 100 -f strin -n $1
- done
- sh lookLog.sh $1
|