Commit fbe6e8c5 by 据说甜蜜呢

重构自动扩容脚本

parent 4d129992
Pipeline #4367 passed with stage
in 21 seconds
#!/bin/bash #!/bin/bash
set -e set -e
IFS=$'\n\n'
# Import external functions # Import external functions
chmod +x ./devops/PipeLines/Functions.deploy.sh chmod +x ./devops/PipeLines/Functions.deploy.sh
source ./devops/PipeLines/Functions.deploy.sh source ./devops/PipeLines/Functions.deploy.sh
# global variable GetNameSpace namespace
RollEnvironmentOf Environment GetReplicas replicas
GetAppName appName if [ "${AllPublishable}" == "1" ];
echo "[${Environment}]Auto scaling for ${appName} starting..."
GetCiCdSettings allPublishable noPublishable
if [ "${noPublishable}" == "1" ] ;
then then
echo ""
echo "Tips: No services need to be cded."
else
GetNameSpace namespace
GetReplicas replicas
for servicePrefix in `ls ./src/Services|xargs -d '/'` for servicePrefix in `ls ./src/Services|xargs -d '/'`
do do
IsPublishableOf ${servicePrefix} isPublishable echo "All micro-services will be scaled, replicas: [${replicas}]."
GetServiceName ${servicePrefix} serviceName GetServiceName ${servicePrefix} serviceName
AutoScaling ${namespace} ${serviceName} ${replicas}
done
else
for servicePrefix in `ls ./src/Services|xargs -d '/'`
do
# Notes: Hard release[manual control], will not analyz changes.
DynamicVariableValueOf "${servicePrefix}" "Publishable" isPublishable
if [ "${isPublishable}" == "1" ]; if [ "${isPublishable}" == "1" ];
then then
echo "" echo "Tips: ${servicePrefix} will be scaled, replicas: [${replicas}]."
echo "Tips: ${serviceName} begin scaling, replicas: [${replicas}]!!!" GetServiceName ${servicePrefix} serviceName
AutoScaling ${namespace} ${serviceName} ${replicas} AutoScaling ${namespace} ${serviceName} ${replicas}
else
echo ""
echo "Tips: ${serviceName} will not be scaled!!!"
fi fi
done done
fi fi
\ No newline at end of file
echo ""
echo "[${Environment}]Auto scaling for ${appName} has been successful."
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment