@xfe-repo/web-app 1.0.13 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/deploy/.drone.yml +23 -26
- package/deploy/helm/values.yaml +1 -1
- package/package.json +1 -1
package/deploy/.drone.yml
CHANGED
|
@@ -20,6 +20,7 @@ steps:
|
|
|
20
20
|
path: /drone/src/node_modules
|
|
21
21
|
commands:
|
|
22
22
|
- pnpm config set registry https://registry.npmmirror.com
|
|
23
|
+
- pnpm i pnpm@9 -g && pnpm -v
|
|
23
24
|
- pnpm i
|
|
24
25
|
|
|
25
26
|
- name: build
|
|
@@ -54,22 +55,35 @@ steps:
|
|
|
54
55
|
- sh /data/scripts/builderInit.sh
|
|
55
56
|
- appName="`echo ${DRONE_REPO//\//-}`"
|
|
56
57
|
- sed -i "s/<<APP_NAME>>/$appName/g" deploy/helm/values.yaml
|
|
57
|
-
- sed -i "s/<<CI_COMMIT_SHA>>/$CI_COMMIT_SHA/g" deploy/helm/values.yaml
|
|
58
|
-
- sed -i "s/<<TAG_CONTENT>>/$DRONE_TAG/g" deploy/helm/values.yaml
|
|
59
58
|
- docker build -f deploy/Dockerfile -t xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image/$$appName:$$CI_COMMIT_SHA . --no-cache
|
|
60
59
|
- docker push xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image/$$appName:$$CI_COMMIT_SHA
|
|
61
60
|
- docker rmi xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image/$$appName:$$CI_COMMIT_SHA
|
|
62
61
|
|
|
63
|
-
- name: deploy
|
|
62
|
+
- name: pre-deploy
|
|
64
63
|
image: xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image-common/deploy-helm:latest
|
|
65
64
|
environment:
|
|
66
65
|
SAAS_K8S_CONFIG:
|
|
67
66
|
from_secret: saas-k8s-config
|
|
67
|
+
INFRA_K8S_CONFIG:
|
|
68
|
+
from_secret: infra-k8s-config
|
|
69
|
+
commands:
|
|
70
|
+
# 判断values.yaml中的targetK8s字段,选择目标集群
|
|
71
|
+
- export TARGET_K8S=$(cat deploy/helm/values.yaml | grep targetK8s | awk '{print $2}' | sed 's/\"//g')
|
|
72
|
+
# 将$INFRA_K8S_CONFIG或$SAAS_K8S_CONFIG写入kube_config
|
|
73
|
+
- echo "$TARGET_K8S" | grep -q "infra" && echo "$INFRA_K8S_CONFIG" > kube_config || echo "$SAAS_K8S_CONFIG" > kube_config
|
|
74
|
+
# 将环境类型写入values.yaml
|
|
75
|
+
- sed -i "s/<<ENV_TYPE>>/test/g" deploy/helm/values.yaml
|
|
76
|
+
- sed -i "s/<<CI_COMMIT_SHA>>/$CI_COMMIT_SHA/g" deploy/helm/values.yaml
|
|
77
|
+
- sed -i "s/<<TAG_CONTENT>>/$DRONE_TAG/g" deploy/helm/values.yaml
|
|
78
|
+
# 展示values.yaml 与 TARGET_K8S
|
|
79
|
+
- cat deploy/helm/values.yaml && echo $TARGET_K8S
|
|
80
|
+
|
|
81
|
+
- name: deploy-to-test
|
|
82
|
+
image: xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image-common/deploy-helm:latest
|
|
68
83
|
commands:
|
|
69
|
-
- echo "$SAAS_K8S_CONFIG" > saas_config
|
|
70
84
|
- cp deploy/helm/values.yaml deploy/helm/values.test.yaml
|
|
71
85
|
- sed -i "s/<<ENV_TYPE>>/test/g" deploy/helm/values.test.yaml
|
|
72
|
-
- sed -i "s/<<
|
|
86
|
+
- sed -i "s/<<APP_SUFFIX>>/-$HOST_PREFIX/g" deploy/helm/values.test.yaml
|
|
73
87
|
- sed -i "s/<<HOST_PREFIX>>/$HOST_PREFIX/g" deploy/helm/values.test.yaml
|
|
74
88
|
- helm template deploy/helm --values deploy/helm/values.test.yaml
|
|
75
89
|
- helm template deploy/helm --values deploy/helm/values.test.yaml | kubectl --kubeconfig=saas_config apply -f -
|
|
@@ -79,17 +93,13 @@ steps:
|
|
|
79
93
|
|
|
80
94
|
- name: deploy-to-stage
|
|
81
95
|
image: xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image-common/deploy-helm:latest
|
|
82
|
-
environment:
|
|
83
|
-
SAAS_K8S_CONFIG:
|
|
84
|
-
from_secret: saas-k8s-config
|
|
85
96
|
commands:
|
|
86
|
-
- echo "$SAAS_K8S_CONFIG" > saas_config
|
|
87
97
|
- cp deploy/helm/values.yaml deploy/helm/values.stage.yaml
|
|
88
98
|
- sed -i "s/<<ENV_TYPE>>/stage/g" deploy/helm/values.stage.yaml
|
|
89
|
-
- sed -i "s/<<
|
|
99
|
+
- sed -i "s/<<APP_SUFFIX>>//g" deploy/helm/values.stage.yaml
|
|
90
100
|
- sed -i "s/<<HOST_PREFIX>>//g" deploy/helm/values.stage.yaml
|
|
91
101
|
- helm template deploy/helm --values deploy/helm/values.stage.yaml
|
|
92
|
-
- helm template deploy/helm --values deploy/helm/values.stage.yaml | kubectl --kubeconfig=
|
|
102
|
+
- helm template deploy/helm --values deploy/helm/values.stage.yaml | kubectl --kubeconfig=kube_config apply -f -
|
|
93
103
|
when:
|
|
94
104
|
ref:
|
|
95
105
|
include:
|
|
@@ -97,19 +107,10 @@ steps:
|
|
|
97
107
|
|
|
98
108
|
- name: deploy-to-prod
|
|
99
109
|
image: xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image-common/deploy-helm:latest
|
|
100
|
-
environment:
|
|
101
|
-
SAAS_K8S_CONFIG:
|
|
102
|
-
from_secret: saas-k8s-config
|
|
103
|
-
INFRA_K8S_CONFIG:
|
|
104
|
-
from_secret: infra-k8s-config
|
|
105
110
|
commands:
|
|
106
|
-
# 判断values.yaml中的targetK8s字段,选择目标集群
|
|
107
|
-
- export TARGET_K8S=$(cat deploy/helm/values.yaml | grep targetK8s | awk '{print $2}' | sed 's/\"//g')
|
|
108
|
-
# 将$INFRA_K8S_CONFIG或$SAAS_K8S_CONFIG写入kube_config
|
|
109
|
-
- echo "$TARGET_K8S" | grep -q "infra" && echo "$INFRA_K8S_CONFIG" > kube_config || echo "$SAAS_K8S_CONFIG" > kube_config
|
|
110
111
|
- cp deploy/helm/values.yaml deploy/helm/values.prod.yaml
|
|
111
112
|
- sed -i "s/<<ENV_TYPE>>/prod/g" deploy/helm/values.prod.yaml
|
|
112
|
-
- sed -i "s/<<
|
|
113
|
+
- sed -i "s/<<APP_SUFFIX>>//g" deploy/helm/values.prod.yaml
|
|
113
114
|
- sed -i "s/<<HOST_PREFIX>>//g" deploy/helm/values.prod.yaml
|
|
114
115
|
- helm template deploy/helm --values deploy/helm/values.prod.yaml
|
|
115
116
|
- helm template deploy/helm --values deploy/helm/values.prod.yaml | kubectl --kubeconfig=kube_config apply -f -
|
|
@@ -121,14 +122,10 @@ steps:
|
|
|
121
122
|
- name: deploy-to-stable
|
|
122
123
|
image: xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image-common/deploy-helm:latest
|
|
123
124
|
failure: ignore
|
|
124
|
-
environment:
|
|
125
|
-
SAAS_K8S_CONFIG:
|
|
126
|
-
from_secret: saas-k8s-config
|
|
127
125
|
commands:
|
|
128
|
-
- echo "$SAAS_K8S_CONFIG" > saas_config
|
|
129
126
|
- cp deploy/helm/values.yaml deploy/helm/values.test.yaml
|
|
130
127
|
- sed -i "s/<<ENV_TYPE>>/test/g" deploy/helm/values.test.yaml
|
|
131
|
-
- sed -i "s/<<
|
|
128
|
+
- sed -i "s/<<APP_SUFFIX>>/-stable/g" deploy/helm/values.test.yaml
|
|
132
129
|
- sed -i "s/<<HOST_PREFIX>>/*/g" deploy/helm/values.test.yaml
|
|
133
130
|
- helm template deploy/helm --values deploy/helm/values.test.yaml
|
|
134
131
|
- helm template deploy/helm --values deploy/helm/values.test.yaml | kubectl --kubeconfig=saas_config apply -f -
|
package/deploy/helm/values.yaml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
imagePullSecret: 'docker-image-cr-pull-vpc'
|
|
2
|
-
app: '<<APP_NAME>><<
|
|
2
|
+
app: '<<APP_NAME>><<APP_SUFFIX>>'
|
|
3
3
|
image: 'xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image/<<APP_NAME>>:<<CI_COMMIT_SHA>>'
|
|
4
4
|
tagContent: '<<TAG_CONTENT>>'
|
|
5
5
|
commitSHA: '<<CI_COMMIT_SHA>>'
|