@xfe-repo/web-app 1.0.8 → 1.0.10

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 CHANGED
@@ -20,7 +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 --frozen-lockfile
23
+ - pnpm i
24
24
 
25
25
  - name: build
26
26
  pull: if-not-exists
@@ -100,14 +100,19 @@ steps:
100
100
  environment:
101
101
  SAAS_K8S_CONFIG:
102
102
  from_secret: saas-k8s-config
103
+ INFRA_K8S_CONFIG:
104
+ from_secret: infra-k8s-config
103
105
  commands:
104
- - echo "$SAAS_K8S_CONFIG" > saas_config
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
105
110
  - cp deploy/helm/values.yaml deploy/helm/values.prod.yaml
106
111
  - sed -i "s/<<ENV_TYPE>>/prod/g" deploy/helm/values.prod.yaml
107
112
  - sed -i "s/<<APP_PREFIX>>//g" deploy/helm/values.prod.yaml
108
113
  - sed -i "s/<<HOST_PREFIX>>//g" deploy/helm/values.prod.yaml
109
114
  - helm template deploy/helm --values deploy/helm/values.prod.yaml
110
- - helm template deploy/helm --values deploy/helm/values.prod.yaml | kubectl --kubeconfig=saas_config apply -f -
115
+ - helm template deploy/helm --values deploy/helm/values.prod.yaml | kubectl --kubeconfig=kube_config apply -f -
111
116
  when:
112
117
  ref:
113
118
  include:
@@ -153,6 +158,12 @@ get:
153
158
  name: config
154
159
  ---
155
160
  kind: secret
161
+ name: infra-k8s-config
162
+ get:
163
+ path: infra-k8s-config
164
+ name: config
165
+ ---
166
+ kind: secret
156
167
  name: ssh-key
157
168
  get:
158
169
  path: deployer-ssh-key
@@ -14,3 +14,5 @@ hosts:
14
14
  - 'template.com'
15
15
  gateways:
16
16
  - 'common-gateway-eshetang'
17
+ # 目标集群 默认发布到saas集群 可选值: saas, infra
18
+ targetK8s: 'saas'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xfe-repo/web-app",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "bin": {
5
5
  "xfe-web": "./bin/index.js"
6
6
  },
@@ -73,7 +73,7 @@
73
73
  "webpack-manifest-plugin": "^4.0.2",
74
74
  "workbox-webpack-plugin": "^7.0.0",
75
75
  "yaml": "^2.3.4",
76
- "@xfe-repo/eslint-config": "0.0.1",
77
- "@xfe-repo/typescript-config": "0.0.3"
76
+ "@xfe-repo/typescript-config": "0.0.3",
77
+ "@xfe-repo/eslint-config": "0.0.2"
78
78
  }
79
79
  }
package/scripts/config.js CHANGED
@@ -30,6 +30,9 @@ const configDeploy = () => {
30
30
  // gateways 默认为 common-gateway-eshetang
31
31
  valuesYaml.gateways = xfeConfig.deploy.gateways || ["common-gateway-eshetang"]
32
32
 
33
+ // 修改目标集群
34
+ valuesYaml.targetK8s = xfeConfig.deploy.targetK8s || "saas"
35
+
33
36
  // 写入values.yaml
34
37
  const valuesYamlStr = yaml.stringify(valuesYaml, { defaultStringType: 'QUOTE_SINGLE', defaultKeyType: 'PLAIN' })
35
38
  fs.writeFileSync(valuesYamlFilePath, valuesYamlStr, 'utf8')