Commit 675cdd6e by 李二毛

Merge branch 'development' into 'release/production'

发布生产环境

See merge request liermao/microservice-autodevopspipelines!93
parents f9fad4c2 b7ae2069
Pipeline #4311 canceled with stages
in 16 seconds
...@@ -5,6 +5,11 @@ stages: ...@@ -5,6 +5,11 @@ stages:
# Updating # Updating
- analysing-git-changes - analysing-git-changes
- synchronizing-config - synchronizing-config
- ci
- cd
- is-k8s-ready
- testing
- clean-k8s
build_job: build_job:
stage: build stage: build
...@@ -13,42 +18,90 @@ build_job: ...@@ -13,42 +18,90 @@ build_job:
tags: tags:
- build - build
staging-major_job: release-major_job:
stage: release-major stage: release-major
script: script:
- export Environment='Staging'
- bash ./devops/PipeLines/Creation/Creation_Pipeline.sh - bash ./devops/PipeLines/Creation/Creation_Pipeline.sh
only: only:
- rel/major - release/staging
- release/production
tags: tags:
- staging - staging
prod-major_job:
stage: release-major
script:
- export Environment='Production'
- bash ./devops/PipeLines/Creation/Creation_Pipeline.sh
only:
- rel/major
tags:
- production - production
staging-analysing-git-changes_job: analysing-git-changes_job:
stage: analysing-git-changes stage: analysing-git-changes
script: script:
- export Environment='Staging'
- bash ./devops/PipeLines/Updating/001_AnalysingGitChanges.sh - bash ./devops/PipeLines/Updating/001_AnalysingGitChanges.sh
only: only:
- staging - staging
- production
tags: tags:
- staging - staging
- production
staging-synchronizing-config_job: synchronizing-config_job:
stage: synchronizing-config stage: synchronizing-config
script: script:
- export Environment='Staging'
- bash ./devops/PipeLines/Updating/002_SyncConfig.sh - bash ./devops/PipeLines/Updating/002_SyncConfig.sh
only: only:
- staging - staging
- production
tags:
- staging
- production
ci_job:
stage: ci
script:
- bash ./devops/PipeLines/Updating/003_CI.sh
only:
- staging
- production
tags:
- staging
- production
cd_job:
stage: cd
script:
- bash ./devops/PipeLines/Updating/004_CD.sh
only:
- staging
- production
tags:
- staging
- production
is-k8s-ready_job:
stage: is-k8s-ready
script:
- bash ./devops/PipeLines/Updating/005_IsK8sReady.sh
only:
- staging
- production
tags: tags:
- staging - staging
\ No newline at end of file - production
testing_job:
stage: testing
script:
- bash ./devops/PipeLines/Updating/006_Testing.sh
only:
- staging
- production
tags:
- staging
- production
clean-k8s_job:
stage: clean-k8s
script:
- bash ./devops/PipeLines/Updating/007_CleanK8s.sh
only:
- staging
- production
tags:
- staging
- production
\ No newline at end of file
...@@ -7,8 +7,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ...@@ -7,8 +7,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
.gitlab-ci.yml = .gitlab-ci.yml .gitlab-ci.yml = .gitlab-ci.yml
devops\app.props = devops\app.props devops\app.props = devops\app.props
devops\branch.env.props = devops\branch.env.props
devops\deploy.production.props = devops\deploy.production.props
devops\deploy.props = devops\deploy.props devops\deploy.props = devops\deploy.props
devops\Gateways\kong.props = devops\Gateways\kong.props devops\deploy.staging.props = devops\deploy.staging.props
devops\token.props = devops\token.props devops\token.props = devops\token.props
devops\version.props = devops\version.props devops\version.props = devops\version.props
EndProjectSection EndProjectSection
...@@ -51,7 +53,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BuildingBlocks", "BuildingB ...@@ -51,7 +53,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BuildingBlocks", "BuildingB
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extensions", "Extensions", "{26EA0840-FACE-4F72-B7D0-64CA9443BD9F}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extensions", "Extensions", "{26EA0840-FACE-4F72-B7D0-64CA9443BD9F}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MvcExtensions", "src\BuildingBlocks\Extensions\MvcExtensions\MvcExtensions.csproj", "{2FFD7AC6-1A55-4B6E-BF9D-1B85CC5AE193}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MvcExtensions", "src\BuildingBlocks\Extensions\MvcExtensions\MvcExtensions.csproj", "{2FFD7AC6-1A55-4B6E-BF9D-1B85CC5AE193}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
......
...@@ -8,6 +8,6 @@ source ./devops/PipeLines/Functions.core.sh ...@@ -8,6 +8,6 @@ source ./devops/PipeLines/Functions.core.sh
GetSolutionName SolutionName GetSolutionName SolutionName
echo "begin build..." echo "Begin building..."
dotnet build ${SolutionName} dotnet build ${SolutionName}
echo "build successful." echo "Build completed."
\ No newline at end of file \ No newline at end of file
...@@ -6,6 +6,9 @@ set -e ...@@ -6,6 +6,9 @@ set -e
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
ReleaseEnvironmentOf Environment
GetAppName appName GetAppName appName
echo "" echo ""
echo "Continuous integration for ${appName} starting..." echo "Continuous integration for ${appName} starting..."
...@@ -15,12 +18,11 @@ echo "${appName} building..." ...@@ -15,12 +18,11 @@ echo "${appName} building..."
GetSolutionName solutionName GetSolutionName solutionName
dotnet build ${solutionName} dotnet build ${solutionName}
echo ""
echo "Please check the version of each microservice carefully !!!"
GetRegistryHost RegistryHost GetRegistryHost RegistryHost
for servicePrefix in `ls ./src/Services|xargs -d '/'` for servicePrefix in `ls ./src/Services|xargs -d '/'`
do do
echo ""
echo "Tips: ${servicePrefix} begin integrating to image registry!!!"
GetServiceName ${servicePrefix} serviceName GetServiceName ${servicePrefix} serviceName
GetServiceCsProjFile ${servicePrefix} ${serviceName} serviceCsProjFile GetServiceCsProjFile ${servicePrefix} ${serviceName} serviceCsProjFile
CI ${serviceName} ${serviceCsProjFile} CI ${serviceName} ${serviceCsProjFile}
......
...@@ -6,6 +6,9 @@ IFS=$'\n\n' ...@@ -6,6 +6,9 @@ IFS=$'\n\n'
chmod +x ./devops/PipeLines/Functions.config.sh chmod +x ./devops/PipeLines/Functions.config.sh
source ./devops/PipeLines/Functions.config.sh source ./devops/PipeLines/Functions.config.sh
# global variable
ReleaseEnvironmentOf Environment
GetAppName appName GetAppName appName
echo "" echo ""
echo "Begin creating ${appName}'s settings to the configmap of k8s..." echo "Begin creating ${appName}'s settings to the configmap of k8s..."
......
...@@ -6,6 +6,9 @@ IFS=$'\n\n' ...@@ -6,6 +6,9 @@ IFS=$'\n\n'
chmod +x ./devops/PipeLines/Functions.core.sh chmod +x ./devops/PipeLines/Functions.core.sh
source ./devops/PipeLines/Functions.core.sh source ./devops/PipeLines/Functions.core.sh
# global variable
ReleaseEnvironmentOf Environment
GetAppName appName GetAppName appName
echo "Starting release for ${appName}, it will dynamicly create k8s environment..." echo "Starting release for ${appName}, it will dynamicly create k8s environment..."
......
...@@ -6,6 +6,9 @@ IFS=$'\n\n' ...@@ -6,6 +6,9 @@ IFS=$'\n\n'
chmod +x ./devops/PipeLines/Functions.core.sh chmod +x ./devops/PipeLines/Functions.core.sh
source ./devops/PipeLines/Functions.core.sh source ./devops/PipeLines/Functions.core.sh
# global variable
RollEnvironmentOf Environment
GetAppName appName GetAppName appName
echo "Start dynamically building the gateway route for ${appName}..." echo "Start dynamically building the gateway route for ${appName}..."
......
# #
οű οű
## k8s ## k8s
helm delete --purge microservice.autodevopspipeline.v0 helm delete --purge microservice.autodevopspipeline.v1
kubectl delete namespace microservice-autodevopspipeline-v0 kubectl delete namespace microservice-autodevopspipeline-v1
## gateway ## gateway
delete FROM routes where created_at>'2019-01-10'; delete FROM routes where created_at>'2019-01-10';
......
...@@ -24,4 +24,11 @@ function DynamicVariableValueOf() ...@@ -24,4 +24,11 @@ function DynamicVariableValueOf()
declare suffix=$2 declare suffix=$2
eval "output=\$$prefix$suffix" eval "output=\$$prefix$suffix"
eval $3=${output} eval $3=${output}
}
function FirstCharUpperCase()
{
declare input=$1
declare output=($(echo ${input} | sed -e "s/\b\(.\)/\u\1/g"))
eval $2=${output}
} }
\ No newline at end of file
...@@ -136,4 +136,21 @@ function IsPublishableOf() ...@@ -136,4 +136,21 @@ function IsPublishableOf()
declare prefix=$1 declare prefix=$1
declare isP=($(grep -oP "(?<=${prefix}Publishable>)[^<]+" "/tmp/cicd.props")) declare isP=($(grep -oP "(?<=${prefix}Publishable>)[^<]+" "/tmp/cicd.props"))
eval $2="${isP}" eval $2="${isP}"
}
# get updating's environment of branch
function RollEnvironmentOf()
{
FirstCharUpperCase ${CI_COMMIT_REF_NAME} branch
declare env=($(grep -oP "(?<=${branch}>)[^<]+" "./devops/branch.env.props"))
eval $1="${env}"
}
# get creation's environment of branch
function ReleaseEnvironmentOf()
{
declare branch=${CI_COMMIT_REF_NAME}
declare name=($(echo "${branch}"|xargs -d '/'|awk '{print $2}'))
FirstCharUpperCase ${name} env
eval $1="${env}"
} }
\ No newline at end of file
...@@ -4,7 +4,7 @@ set -e ...@@ -4,7 +4,7 @@ set -e
# Import external functions # Import external functions
chmod +x ./devops/PipeLines/Functions.core.sh chmod +x ./devops/PipeLines/Functions.core.sh
source ./devops/PipeLines/Functions.core.sh source ./devops/PipeLines/Functions.core.sh
function CI() function CI()
{ {
...@@ -27,4 +27,27 @@ function CI() ...@@ -27,4 +27,27 @@ function CI()
docker push ${imagefullname} docker push ${imagefullname}
rm -fr ${publishOutputDir} rm -fr ${publishOutputDir}
echo "Delivery for ${serviceName} has been successful." echo "Delivery for ${serviceName} has been successful."
}
function CD()
{
declare registryHost=$1
declare registryUserName=$2
declare serviceName=$3
declare version=$4
declare namespace=$5
Replace ${serviceName} '.' '-' appName
# repository name must be lowercase
ToLower "${registryHost}/${registryUserName}/${serviceName}:${version}" imagefullname
ToLower ${appName} appNameOfK8s
# echo "Tips: namespace: ${namespace}, appNameOfK8s: ${appNameOfK8s}, imagefullname: ${imagefullname}"
kubectl -n ${namespace} set image deployments/${appNameOfK8s} "${appNameOfK8s}=${imagefullname}"
# [compatible]Staging environment does not need to change version number.
if [ "${Environment}" == "Staging" ]; then
kubectl -n ${namespace} scale deploy ${appNameOfK8s} --replicas=0;
kubectl -n ${namespace} scale deploy ${appNameOfK8s} --replicas=1;
fi
echo "Deployment[${Environment}] for ${appName}:${version} has been successful."
} }
\ No newline at end of file
...@@ -73,7 +73,7 @@ else ...@@ -73,7 +73,7 @@ else
echo "Tips[Hard Release]: ${servicePrefix} will be released." echo "Tips[Hard Release]: ${servicePrefix} will be released."
else else
# Soft Release, begin Analyzing git changes # Soft Release, begin Analyzing git changes
IsPublishable "src/${servicePrefix}" isPublishable publishableCount IsPublishable "src/Services/${servicePrefix}" isPublishable publishableCount
if [ "${isPublishable}" == "1" ]; if [ "${isPublishable}" == "1" ];
then then
AddConfig "${servicePrefix}" "${isPublishable}" AddConfig "${servicePrefix}" "${isPublishable}"
......
...@@ -6,6 +6,9 @@ IFS=$'\n\n' ...@@ -6,6 +6,9 @@ IFS=$'\n\n'
chmod +x ./devops/PipeLines/Functions.config.sh chmod +x ./devops/PipeLines/Functions.config.sh
source ./devops/PipeLines/Functions.config.sh source ./devops/PipeLines/Functions.config.sh
# global variable
RollEnvironmentOf Environment
GetAppName appName GetAppName appName
echo "" echo ""
echo "Begin synchronizing ${appName}'s settings to the configmap of k8s..." echo "Begin synchronizing ${appName}'s settings to the configmap of k8s..."
......
...@@ -3,11 +3,14 @@ ...@@ -3,11 +3,14 @@
set -e set -e
# Import external functions # Import external functions
chmod +x ./devops/PipeLines/functions.sh chmod +x ./devops/PipeLines/Functions.deploy.sh
./devops/PipeLines/functions.sh source ./devops/PipeLines/Functions.deploy.sh
# global variable
RollEnvironmentOf Environment
GetAppName appName GetAppName appName
echo "Continuous integration for ${appName} starting..." echo "Continuous integration[${Environment}] for ${appName} starting..."
GetCiCdSettings allPublishable noPublishable GetCiCdSettings allPublishable noPublishable
if [ "${noPublishable}" == "1" ] ; if [ "${noPublishable}" == "1" ] ;
...@@ -15,56 +18,28 @@ then ...@@ -15,56 +18,28 @@ then
echo "" echo ""
echo "Tips: No services need to be cied." echo "Tips: No services need to be cied."
else else
declare solutionName=($(grep -oP '(?<=SolutionName>)[^<]+' "devops/app.props")) echo ""
echo "${appName} building..."
GetSolutionName solutionName
dotnet build ${solutionName} dotnet build ${solutionName}
echo "Please check the version of each microservice carefully !!!" GetRegistryHost RegistryHost
declare major=($(grep -oP '(?<=VersionMajor>)[^<]+' "build/version.props")) for servicePrefix in `ls ./src/Services|xargs -d '/'`
declare minor=($(grep -oP '(?<=VersionMinor>)[^<]+' "build/version.props"))
declare patch=($(grep -oP '(?<=VersionPatch>)[^<]+' "build/version.props"))
declare version=${major}.${minor}.${patch}
declare registryUserName=($(grep -oP '(?<=ImageUserName>)[^<]+' "build/deploy.props"))
declare publishOutputDir=./publish
rm -fr ${publishOutputDir}
mkdir -p ${publishOutputDir}
function CI()
{
declare publishable=$1
declare imagename=$2
echo ""
if [ "${publishable}" == "1" ];
then
declare imagefullname=${RegistryHost}/${registryUserName}/${imagename}:${version}
declare publishFile=$3
echo "begin delivery of master branch 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}
echo "delivery of master branch for ${imagename}:${version} has been successful."
else
echo "Tips: master branch for ${imagename}:${version} will not be cied!!!"
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" ];
CI ${isPublishable} "${servicePrefix}" "./src/${servicePrefix}/${serviceName}.csproj" then
echo ""
echo "Tips: ${serviceName} begin integrating to image registry!!!"
GetServiceCsProjFile ${servicePrefix} ${serviceName} serviceCsProjFile
CI ${serviceName} ${serviceCsProjFile}
else
echo ""
echo "Tips: ${serviceName} will not be integrated to image registry!!!"
fi
done done
fi fi
echo "" echo ""
echo "Continuous integration for ${appName} has been successful." echo "Continuous integration[${Environment}] for ${appName} has been successful."
\ No newline at end of file \ No newline at end of file
...@@ -2,12 +2,15 @@ ...@@ -2,12 +2,15 @@
set -e set -e
# Import external functions # Import external functions
chmod +x ./devops/PipeLines/functions.sh chmod +x ./devops/PipeLines/Functions.deploy.sh
sh ./devops/PipeLines/functions.sh source ./devops/PipeLines/Functions.deploy.sh
# global variable
RollEnvironmentOf Environment
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 +19,26 @@ then ...@@ -16,45 +19,26 @@ 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 GetNameSpace namespace
GetImageRegistrySettings registryHost registryUserName GetRegistryHost registryHost
GetImageUserName 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} ${namespace}
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."
...@@ -3,8 +3,11 @@ ...@@ -3,8 +3,11 @@
IFS=$'\n\n' IFS=$'\n\n'
# Import external functions # Import external functions
chmod +x ./devops/PipeLines/functions.sh chmod +x ./devops/PipeLines/Functions.core.sh
sh ./devops/PipeLines/functions.sh source ./devops/PipeLines/Functions.core.sh
# global variable
RollEnvironmentOf Environment
#1: ready, 0: not ready. #1: ready, 0: not ready.
declare ready=0 declare ready=0
...@@ -18,19 +21,19 @@ do ...@@ -18,19 +21,19 @@ do
declare allIsReady=1 declare allIsReady=1
for row in $(kubectl -n ${namespace} get deployment) for row in $(kubectl -n ${namespace} get deployment)
do do
echo "" echo ""
declare name=$(echo "${row}"|awk '{print $1}') declare name=$(echo "${row}"|awk '{print $1}')
declare desired=$(echo "${row}"|awk '{print $2}') declare desired=$(echo "${row}"|awk '{print $2}')
declare current=$(echo "${row}"|awk '{print $3}') declare current=$(echo "${row}"|awk '{print $3}')
declare uptodate=$(echo "${row}"|awk '{print $4}') declare uptodate=$(echo "${row}"|awk '{print $4}')
declare available=$(echo "${row}"|awk '{print $5}') declare available=$(echo "${row}"|awk '{print $5}')
echo "deployment: ${name}, desired: ${desired}, current: ${current}, uptodate: ${uptodate}, available: ${available}" echo "[${Environment}]deployment: ${name}, desired: ${desired}, current: ${current}, uptodate: ${uptodate}, available: ${available}"
if [ $((${desired})) == $((${current})) -a $((${current})) == $((${uptodate})) -a $((${uptodate})) == $((${available})) ]; then if [ $((${desired})) == $((${current})) -a $((${current})) == $((${uptodate})) -a $((${uptodate})) == $((${available})) ]; then
echo "${name} has been ready."; echo "[${Environment}]${name} has been ready.";
else else
echo "${name} has been not ready."; echo "[${Environment}]${name} has been not ready.";
allIsReady=0 allIsReady=0
fi fi
done done
if [ $((${allIsReady})) == 1 ]; then if [ $((${allIsReady})) == 1 ]; then
......
#!/bin/bash
set -e
# Import external functions
chmod +x ./devops/PipeLines/Functions.core.sh
source ./devops/PipeLines/Functions.core.sh
# global variable
RollEnvironmentOf Environment
echo "[${Environment}]Begin testing..."
declare dir='./test/ServicesTests'
for prefix in `ls ${dir}|xargs -d '/'`
do
dotnet test "${dir}/${prefix}/${prefix}.csproj"
done
echo "[${Environment}]Test completed."
\ No newline at end of file
...@@ -3,12 +3,17 @@ ...@@ -3,12 +3,17 @@
IFS=$'\n\n' IFS=$'\n\n'
# Import external functions # Import external functions
chmod +x ./devops/PipeLines/functions.sh chmod +x ./devops/PipeLines/Functions.core.sh
sh ./devops/PipeLines/functions.sh source ./devops/PipeLines/Functions.core.sh
# global variable
RollEnvironmentOf Environment
GetNameSpace namespace GetNameSpace namespace
declare replicas=$(kubectl -n ${namespace} get rs) echo "[${Environment}]Begin cleaning..."
# Remove the heading line.
declare replicas=$(kubectl -n ${namespace} get rs|awk 'NR > 1')
for row in $replicas for row in $replicas
do do
declare name=$(echo "${row}"|awk '{print $1}') declare name=$(echo "${row}"|awk '{print $1}')
...@@ -18,10 +23,8 @@ do ...@@ -18,10 +23,8 @@ do
# echo "replica set: ${name}, desired: ${desired}" # echo "replica set: ${name}, desired: ${desired}"
if [ $((${desired})) == 0 -a $((${current})) == 0 -a $((${ready})) == 0 ]; then if [ $((${desired})) == 0 -a $((${current})) == 0 -a $((${ready})) == 0 ]; then
# echo ${name} # echo ${name}
kubectl -n ${namespace} delete rs ${name} --grace-period=0 --force kubectl -n ${namespace} delete rs ${name} --grace-period=0 --force
fi fi
done done
echo 'clean successful...' echo '[${Environment}]Clean completed.'
\ No newline at end of file
exit 0
\ No newline at end of file
<Project>
<PropertyGroup>
<!--key: branch name, value: environment-->
<staging>Staging</staging>
<master>Production</master>
</PropertyGroup>
</Project>
...@@ -11,7 +11,7 @@ namespace Identity.API.Controllers ...@@ -11,7 +11,7 @@ namespace Identity.API.Controllers
[HttpGet] [HttpGet]
public ActionResult<IEnumerable<string>> Get() public ActionResult<IEnumerable<string>> Get()
{ {
return new string[] { "value1", "value2" }; return new string[] { "value1", "value2" };
} }
// GET api/values/5 // GET api/values/5
......
...@@ -11,7 +11,7 @@ namespace Identity.API ...@@ -11,7 +11,7 @@ namespace Identity.API
{ {
public Startup(IConfiguration configuration) public Startup(IConfiguration configuration)
{ {
Configuration = configuration; Configuration = configuration;
} }
public IConfiguration Configuration { get; } public IConfiguration Configuration { get; }
......
...@@ -10,7 +10,7 @@ namespace Marketing.API ...@@ -10,7 +10,7 @@ namespace Marketing.API
public class Startup public class Startup
{ {
public Startup(IConfiguration configuration) public Startup(IConfiguration configuration)
{ {
Configuration = configuration; Configuration = configuration;
} }
......
#!/bin/bash
set -e
IFS=$'\n\n'
export Environment='Staging'
# Import external functions
chmod +x ./devops/PipeLines/Functions.config.sh
source ./devops/PipeLines/Functions.config.sh
GetAppName appName
echo ""
echo "Begin creating ${appName}'s settings to the configmap of k8s..."
GetNameSpace namespace
# global variable
GetAccessToken AccessToken
GetRegistryHost RegistryHost
GetK8sApiServer K8sApiServer
GetKongApiServer KongApiServer
GetKongRouteDomain KongRouteDomain
for servicePrefix in `ls ./src/Services|xargs -d '/'`
do
GetServiceName ${servicePrefix} serviceName
GetServiceDir ${servicePrefix} ${serviceName} serviceDir
CreateConfig ${Environment} ${namespace} ${K8sApiServer} ${serviceDir} ${servicePrefix}
done
echo ""
echo "End creating app settings to the configmap of k8s..."
\ 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