Commit 7b3c2f97 by 李二毛

Merge branch 'development' into 'rel/major'

优化脚本

See merge request liermao/microservice-autodevopspipelines!11
parents adf76130 2981db1d
Pipeline #4081 failed with stages
in 30 seconds
......@@ -22,13 +22,13 @@ staging-major_job:
- bash ./devops/PipeLines/Creation/001_CI.sh
# 002 Create config information to k8s's configmap.
- bash ./devops/PipeLines/Creation/CreateConfig.sh
- bash ./devops/PipeLines/Creation/002_CreateConfig.sh
# 003 Release major to k8s's cluster.
- bash ./devops/PipeLines/Creation/ReleaseMajor.sh
- bash ./devops/PipeLines/Creation/003_ReleaseMajor.sh
# 004 Create gateway route.
- bash ./devops/PipeLines/Creation/Gateways/Kong/CreateGatewayRoute.sh
- bash ./devops/PipeLines/Creation/Gateways/Kong/004_CreateGatewayRoute.sh
only:
- rel/major
tags:
......
......@@ -14,12 +14,9 @@ declare solutionName=($(grep -oP '(?<=SolutionName>)[^<]+' "devops/app.props"))
dotnet build ${solutionName}
echo "Please check the version of each microservice carefully !!!"
declare major=($(grep -oP '(?<=VersionMajor>)[^<]+' "build/version.props"))
declare minor=($(grep -oP '(?<=VersionMinor>)[^<]+' "build/version.props"))
declare patch=($(grep -oP '(?<=VersionPatch>)[^<]+' "build/version.props"))
declare version=${major}.${minor}.${patch}
GetVersion version
declare registryUserName=($(grep -oP '(?<=ImageUserName>)[^<]+' "build/deploy.props"))
GetImageUserName registryUserName
declare publishOutputDir=./publish
......@@ -35,16 +32,16 @@ function CI()
declare imagefullname=${RegistryHost}/${registryUserName}/${imagename}:${version}
declare publishFile=$3
echo "begin delivery of master branch for ${imagename}..."
echo "begin delivery for ${imagename}..."
mkdir -p ${publishOutputDir}/${imagename}
dotnet publish ${publishFile} -o ../../publish/${imagename} -c release --no-restore
docker build -t ${imagefullname} ${publishOutputDir}/${imagename}
docker push ${imagefullname}
rm -fr ${publishOutputDir}/${imagename}
echo "delivery of master branch for ${imagename}:${version} has been successful."
echo "delivery for ${imagename}:${version} has been successful."
}
declare services=$(ls -l src/services | awk 'NR>1')
GetServices services
declare servicePrefix=""
declare serviceName=""
for service in ${services}
......
......@@ -2,11 +2,17 @@
set -e
function GetServices()
{
declare services=$(ls -l src/services | awk 'NR>1')
eval $1="${services}"
}
function GetServiceName()
{
declare servicePrefix=${1}
declare serviceName=$(ls ./src/services/${servicePrefix}|head -n 1|xargs -d '/' echo)
$2="${serviceName}"
eval $2="${serviceName}"
}
function GetAppName()
......@@ -15,16 +21,24 @@ function GetAppName()
eval $1="${appName}"
}
function GetImageUserName()
{
declare name=($(grep -oP '(?<=ImageUserName>)[^<]+' "devops/deploy.props"))
eval $1="${name}"
}
function GetCiCdSettings()
{
declare allPublishable=($(grep -oP '(?<=AllPublishable>)[^<]+' "/tmp/cicd.props"))
declare noPublishable=($(grep -oP '(?<=NoPublishable>)[^<]+' "/tmp/cicd.props"))
eval $1=${allPublishable}
eval $2=${noPublishable}
}
function GetMajor()
{
declare major=($(grep -oP '(?<=VersionMajor>)[^<]+' "devops/version.props"))
$1=${major}
eval $1=${major}
}
function GetVersion()
......@@ -33,19 +47,19 @@ function GetVersion()
declare minor=($(grep -oP '(?<=VersionMinor>)[^<]+' "devops/version.props"))
declare patch=($(grep -oP '(?<=VersionPatch>)[^<]+' "devops/version.props"))
declare version=${major}.${minor}.${patch}
$1=${version}
eval $1=${version}
}
function GetImageRegistrySettings()
{
declare host=($(grep -oP '(?<=ImageRegistryHost>)[^<]+' "devops/deploy.props"))
declare username=($(grep -oP '(?<=ImageUserName>)[^<]+' "devops/deploy.props"))
$1=${host}
$2=${username}
eval $1=${host}
eval $2=${username}
}
function GetAccessTokenOf()
{
declare token=($(grep -oP "(?<=${Environment}AccessToken>)[^<]+" "devops/deploy.props"))
$1="${token}"
eval $1="${token}"
}
\ 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