Project 'liermao/microservice-autodevopspipelines' was moved to 'lichunsheng/microservice-autodevopspipelines'. Please update any links and bookmarks that may still have the old path.
Commit 762195c0 by 李二毛

Merge branch 'development' into 'rel/major'

Development

See merge request liermao/microservice-autodevopspipelines!46
parents c62eb450 d24fb63b
Pipeline #4166 failed with stages
in 24 seconds
......@@ -2,40 +2,39 @@
set -e
IFS=$'\n\n'
declare appName=($(grep -oP '(?<=AppName>)[^<]+' "devops/app.props"))
# Import external functions
chmod +x ./devops/PipeLines/Functions.core.sh
source ./devops/PipeLines/Functions.core.sh
echo "Release for ${appName} starting, dynamicly creating k8s environment..."
GetAppName appName
declare major=($(grep -oP '(?<=Major>)[^<]+' "devops/version.props"))
declare minor=($(grep -oP '(?<=Minor>)[^<]+' "devops/version.props"))
declare patch=($(grep -oP '(?<=Patch>)[^<]+' "devops/version.props"))
declare namespace=($(grep -oP '(?<=Namespace>)[^<]+' "devops/app.props"))
echo "starting release for ${appName}, it will dynamicly create k8s environment..."
declare version=${major}.${minor}.${patch}
declare namespaceOfK8s=$(echo "${namespace}-v${major}" | tr 'A-Z' 'a-z')
GetMajor major
GetVersion version
GetNameSpace namespace
declare releaseName="${appName}-v${major}"
echo ""
echo "Please check the image version of each microservice carefully !!!"
echo "kubernetes's namespace: ${namespaceOfK8s}"
declare services=$(ls -l src/services | awk 'NR>1')
declare servicePrefix=""
for service in ${services}
echo "kubernetes's namespace: ${namespace}"
for servicePrefix in `ls ./src/Services|xargs -d '/'`
do
servicePrefix=($(echo ${service} | awk '{print $9}'))
echo "${servicePrefix}: ${version}"
GetServiceName ${servicePrefix} serviceName
echo "${serviceName}: ${version}"
done
echo ""
declare replicas=($(grep -oP '(?<=Replicas>)[^<]+' "devops/app.props"))
GetReplicas replicas
ToLower ${Environment} environment
helm install /root/AutoDevOpsPipeLinesCharts \
--name=${releaseName} \
--set environment.upper=${Environment} \
--set environment.lower=$(echo ${Environment} | tr 'A-Z' 'a-z') \
--set namespace=${namespaceOfK8s} \
--set environment.lower=${environment} \
--set namespace=${namespace} \
--set image.version=${version} \
--set replicas=${replicas}
echo ""
echo "Dynamicly creating k8s environment Successfully !!!"
\ No newline at end of file
echo "k8s environment Created Successfully !!!"
\ No newline at end of file
......@@ -93,6 +93,12 @@ function GetImageRegistrySettings()
eval $2=${username}
}
function GetReplicas()
{
declare count=($(grep -oP '(?<=Replicas>)[^<]+' "devops/deploy.props"))
eval $1=${count}
}
function GetAccessTokenOf()
{
declare token=($(grep -oP "(?<=${Environment}AccessToken>)[^<]+" "devops/deploy.props"))
......
## 为我们的项目创建chart目录
helm create AutoDevOpsPipeLinesCharts
## 安装
## 渲染模板(调试)
```shell
helm install --debug --dry-run /root/AutoDevOpsPipeLinesCharts \
--name=v1 \
--set environment.upper=Production \
--set environment.lower=production \
--set namespace=microservice-autodevopspipeline-v0 \
--set image.version=0.0.0 \
--set replicas=1
```
## 发布版本
```shell
helm install /root/AutoDevOpsPipeLinesCharts \
--name=geekbuying-light-v2 \
--set environment.upper=Production \
--set environment.lower=production \
--set namespace=geekbuying-light-v3 \
--set image.version=2.0.0
```
## 检视发布
helm get manifest [release name]
## 删除发布
helm delete [release name]
## 其他
helm ls
helm ls --deleted -d
helm del --purge $releaseName
\ No newline at end of file
......@@ -30,13 +30,6 @@ spec:
imagePullPolicy: Always
ports:
- containerPort: 80
readinessProbe:
httpGet:
path: /healthchecks
port: 80
scheme: HTTP
initialDelaySeconds: 5
periodSeconds: 60
volumeMounts:
- name: appsetting
mountPath: "/app/appsettings.json"
......@@ -80,13 +73,6 @@ spec:
imagePullPolicy: Always
ports:
- containerPort: 80
readinessProbe:
httpGet:
path: /healthchecks
port: 80
scheme: HTTP
initialDelaySeconds: 5
periodSeconds: 60
volumeMounts:
- name: appsetting
mountPath: "/app/appsettings.json"
......@@ -131,13 +117,6 @@ spec:
imagePullPolicy: Always
ports:
- containerPort: 80
readinessProbe:
httpGet:
path: /healthchecks
port: 80
scheme: HTTP
initialDelaySeconds: 5
periodSeconds: 60
volumeMounts:
- name: appsetting
mountPath: "/app/appsettings.json"
......@@ -182,13 +161,6 @@ spec:
imagePullPolicy: Always
ports:
- containerPort: 80
readinessProbe:
httpGet:
path: /healthchecks
port: 80
scheme: HTTP
initialDelaySeconds: 5
periodSeconds: 60
volumeMounts:
- name: appsetting
mountPath: "/app/appsettings.json"
......@@ -233,13 +205,6 @@ spec:
imagePullPolicy: Always
ports:
- containerPort: 80
readinessProbe:
httpGet:
path: /healthchecks
port: 80
scheme: HTTP
initialDelaySeconds: 5
periodSeconds: 60
volumeMounts:
- name: appsetting
mountPath: "/app/appsettings.json"
......@@ -284,13 +249,6 @@ spec:
imagePullPolicy: Always
ports:
- containerPort: 80
readinessProbe:
httpGet:
path: /healthchecks
port: 80
scheme: HTTP
initialDelaySeconds: 5
periodSeconds: 60
volumeMounts:
- name: appsetting
mountPath: "/app/appsettings.json"
......
......@@ -2,24 +2,7 @@ apiVersion: v1
kind: Service
metadata:
labels:
app: light
component: common
name: common-api
namespace: {{ .Values.namespace }}
spec:
type: ClusterIP
ports:
- port: 80
selector:
app: light
component: common
type: webapi
---
apiVersion: v1
kind: Service
metadata:
labels:
app: light
app: auto-devops-pipelines
component: basket
name: basket-api
namespace: {{ .Values.namespace }}
......@@ -28,7 +11,7 @@ spec:
ports:
- port: 80
selector:
app: light
app: auto-devops-pipelines
component: basket
type: webapi
......@@ -37,7 +20,7 @@ apiVersion: v1
kind: Service
metadata:
labels:
app: light
app: auto-devops-pipelines
component: catalog
name: catalog-api
namespace: {{ .Values.namespace }}
......@@ -46,7 +29,7 @@ spec:
ports:
- port: 80
selector:
app: light
app: auto-devops-pipelines
component: catalog
type: webapi
......@@ -55,7 +38,7 @@ apiVersion: v1
kind: Service
metadata:
labels:
app: light
app: auto-devops-pipelines
component: identity
name: identity-api
namespace: {{ .Values.namespace }}
......@@ -64,7 +47,7 @@ spec:
ports:
- port: 80
selector:
app: light
app: auto-devops-pipelines
component: identity
type: webapi
......@@ -73,7 +56,7 @@ apiVersion: v1
kind: Service
metadata:
labels:
app: light
app: auto-devops-pipelines
component: marketing
name: marketing-api
namespace: {{ .Values.namespace }}
......@@ -82,7 +65,7 @@ spec:
ports:
- port: 80
selector:
app: light
app: auto-devops-pipelines
component: marketing
type: webapi
......@@ -91,7 +74,7 @@ apiVersion: v1
kind: Service
metadata:
labels:
app: light
app: auto-devops-pipelines
component: ordering
name: ordering-api
namespace: {{ .Values.namespace }}
......@@ -100,7 +83,7 @@ spec:
ports:
- port: 80
selector:
app: light
app: auto-devops-pipelines
component: ordering
type: webapi
......@@ -109,7 +92,7 @@ apiVersion: v1
kind: Service
metadata:
labels:
app: light
app: auto-devops-pipelines
component: payment
name: payment-api
namespace: {{ .Values.namespace }}
......@@ -118,43 +101,6 @@ spec:
ports:
- port: 80
selector:
app: light
app: auto-devops-pipelines
component: payment
type: webapi
---
apiVersion: v1
kind: Service
metadata:
labels:
app: light
component: searching
name: searching-yu
namespace: {{ .Values.namespace }}
spec:
type: ClusterIP
ports:
- port: 80
selector:
app: light
component: searching
type: webapi
---
apiVersion: v1
kind: Service
metadata:
labels:
app: light
role: aggregation
component: light
name: aggregation-light
namespace: {{ .Values.namespace }}
spec:
type: ClusterIP
ports:
- port: 80
selector:
app: light
role: aggregation
component: light
type: webapi
type: webapi
\ 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