Commit 122842dd by 据说甜蜜呢

重构

parent 2ab2aead
...@@ -7,7 +7,7 @@ sh ./devops/PipeLines/functions.sh ...@@ -7,7 +7,7 @@ sh ./devops/PipeLines/functions.sh
GetAppName appName GetAppName appName
echo "Continuous deployment of ${Environment} branch for ${appName} starting..." echo "Continuous deployment[${Environment}] for ${appName} starting..."
GetCiCdSettings allPublishable noPublishable GetCiCdSettings allPublishable noPublishable
...@@ -16,45 +16,24 @@ then ...@@ -16,45 +16,24 @@ then
echo "" echo ""
echo "Tips: No services need to be cded." echo "Tips: No services need to be cded."
else else
echo "Please check the version of each microservice carefully !!!"
echo ""
GetVersion version GetVersion version
GetNameSpace namespace
GetImageRegistrySettings registryHost registryUserName GetImageRegistrySettings registryHost registryUserName
function CD() for servicePrefix in `ls ./src/Services|xargs -d '/'`
{
declare publishable=$1
declare appName=$2
declare imageName=$3
echo ""
if [ "${publishable}" == "1" ];
then
kubectl -n ${namespace} set image deployments/${appName} "${appName}=${registryHost}/${registryUserName}/${imageName}:${version}";
if [ "${Environment}" == "Staging" ]; then
kubectl -n ${namespace} scale deploy ${appName} --replicas=0;
kubectl -n ${namespace} scale deploy ${appName} --replicas=1;
fi
echo "deployment of ${Environment} branch for ${appName}:${version} has been successful."
else
echo "Tips: ${Environment} branch for ${appName}:${version} will not be cded!!!"
fi
}
declare services=$(ls -l src/services | awk 'NR>1')
declare servicePrefix=""
declare serviceName=""
declare isPublishable="0"
for service in ${services}
do do
servicePrefix=($(echo ${service} | awk '{print $9}')) IsPublishableOf ${servicePrefix} isPublishable
isPublishable=($(grep -oP "(?<=${servicePrefix}Publishable>)[^<]+" "/tmp/cicd.props")) GetServiceName ${servicePrefix} serviceName
GetServiceName "${servicePrefix}" serviceName if [ "${isPublishable}" == "1" ];
CD ${apiPublishable} "${serviceName}" "${serviceName}" then
echo ""
echo "Tips: ${serviceName} begin deployment to K8S!!!"
CD ${registryHost} ${registryUserName} ${serviceName} ${version}
else
echo ""
echo "Tips: ${serviceName} will not be deploymented to K8S!!!"
fi
done done
fi fi
echo "" echo ""
echo "Continuous deployment of ${Environment} branch for ${appName} has been successful." echo "Continuous deployment[${Environment}] for ${appName} has been successful."
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