@next-core/brick-container 3.18.5 → 3.18.7
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/dist/core.d3bce4b0.js +2 -0
- package/dist/core.d3bce4b0.js.map +1 -0
- package/dist/index.html +1 -1
- package/dist/{main.58a942b7.js → main.a3a32de8.js} +2 -2
- package/dist/{main.58a942b7.js.map → main.a3a32de8.js.map} +1 -1
- package/dist/{polyfill.274ef3e3.js → polyfill.98c95f15.js} +1 -1
- package/dist/preview/core.26866d56.js +1 -0
- package/dist/preview/core.26866d56.js.map +1 -0
- package/dist/preview/index.html +1 -1
- package/dist/preview/main.bf716c90.js +1 -0
- package/dist/preview/{main.d19f2e5d.js.map → main.bf716c90.js.map} +1 -1
- package/dist/preview/{vendors.904cbfe9.js → vendors.3795db69.js} +2 -2
- package/dist/{vendors.600a0b8f.js → vendors.f1390456.js} +2 -2
- package/package.json +6 -6
- package/tools/package-union/report_union_micro_app.py +113 -23
- package/dist/core.9743eb6e.js +0 -2
- package/dist/core.9743eb6e.js.map +0 -1
- package/dist/preview/core.9fffe8a9.js +0 -1
- package/dist/preview/core.9fffe8a9.js.map +0 -1
- package/dist/preview/main.d19f2e5d.js +0 -1
- /package/dist/preview/{vendors.904cbfe9.js.LICENSE.txt → vendors.3795db69.js.LICENSE.txt} +0 -0
- /package/dist/{vendors.600a0b8f.js.LICENSE.txt → vendors.f1390456.js.LICENSE.txt} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-core/brick-container",
|
|
3
|
-
"version": "3.18.
|
|
3
|
+
"version": "3.18.7",
|
|
4
4
|
"description": "Brick Container Server",
|
|
5
5
|
"homepage": "https://github.com/easyops-cn/next-core/tree/v3/packages/brick-container",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -53,12 +53,12 @@
|
|
|
53
53
|
"@next-api-sdk/api-gateway-sdk": "^1.1.0",
|
|
54
54
|
"@next-api-sdk/micro-app-standalone-sdk": "^1.1.0",
|
|
55
55
|
"@next-core/build-next-bricks": "^1.22.4",
|
|
56
|
-
"@next-core/easyops-runtime": "^0.12.
|
|
56
|
+
"@next-core/easyops-runtime": "^0.12.11",
|
|
57
57
|
"@next-core/http": "^1.2.6",
|
|
58
58
|
"@next-core/i18n": "^1.0.61",
|
|
59
|
-
"@next-core/loader": "^1.6.
|
|
60
|
-
"@next-core/preview": "^0.7.
|
|
61
|
-
"@next-core/runtime": "^1.54.
|
|
59
|
+
"@next-core/loader": "^1.6.6",
|
|
60
|
+
"@next-core/preview": "^0.7.9",
|
|
61
|
+
"@next-core/runtime": "^1.54.5",
|
|
62
62
|
"@next-core/test-next": "^1.1.5",
|
|
63
63
|
"@next-core/theme": "^1.5.4",
|
|
64
64
|
"@next-core/types": "^1.12.0",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"@next-core/runtime": "*",
|
|
75
75
|
"@next-core/utils": "*"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "b871737621c17304571deb104b75424427d0eda3"
|
|
78
78
|
}
|
|
@@ -5,10 +5,16 @@ import os
|
|
|
5
5
|
import ens_api
|
|
6
6
|
import requests
|
|
7
7
|
import simplejson
|
|
8
|
+
import shutil
|
|
9
|
+
from concurrent.futures import ThreadPoolExecutor,as_completed, wait, ALL_COMPLETED
|
|
8
10
|
|
|
9
11
|
reload(sys)
|
|
10
12
|
sys.setdefaultencoding("utf-8")
|
|
11
13
|
|
|
14
|
+
# 公共路径
|
|
15
|
+
_INSTALL_BASE_PATH = "/usr/local/easyops"
|
|
16
|
+
_APPLICATIONS_SA_FOLDER = "applications_sa"
|
|
17
|
+
|
|
12
18
|
class NameServiceError(Exception):
|
|
13
19
|
pass
|
|
14
20
|
|
|
@@ -50,7 +56,6 @@ def collect_app_info(app_path, report_app_id, version):
|
|
|
50
56
|
if f.startswith("bootstrap-mini.") and f.endswith(".json"):
|
|
51
57
|
bootstrap_file_name = f
|
|
52
58
|
if bootstrap_file_name is "":
|
|
53
|
-
print u"bootstrap-mini.*.json not found in dir {}".format(app_path)
|
|
54
59
|
return
|
|
55
60
|
bootstrap_file = os.path.join(app_path, bootstrap_file_name)
|
|
56
61
|
print u"report app: {}, bootstrap_file: {}".format(report_app_id, bootstrap_file)
|
|
@@ -86,7 +91,7 @@ def collect_app_info(app_path, report_app_id, version):
|
|
|
86
91
|
|
|
87
92
|
def report(org, app):
|
|
88
93
|
try:
|
|
89
|
-
create_or_update_micro_app_sa(org, app)
|
|
94
|
+
return create_or_update_micro_app_sa(org, app)
|
|
90
95
|
except NameServiceError, e:
|
|
91
96
|
raise e
|
|
92
97
|
except requests.HTTPError, e:
|
|
@@ -98,12 +103,17 @@ def create_or_update_micro_app_sa(org, app):
|
|
|
98
103
|
url = "http://{}/api/v1/micro_app_standalone/report".format(MICRO_APP_SA_ADDR)
|
|
99
104
|
rsp = requests.post(url, json=app, headers=headers)
|
|
100
105
|
rsp.raise_for_status()
|
|
101
|
-
|
|
106
|
+
rsp_data = rsp.json().get("data", {})
|
|
107
|
+
print "report app: {} end".format(app["appId"])
|
|
108
|
+
# 兼容之前的report_sa_na接口的响应体没有appId的场景
|
|
109
|
+
if rsp_data.get("appId") is None:
|
|
110
|
+
rsp_data["appId"] = app["appId"]
|
|
111
|
+
return rsp_data
|
|
102
112
|
|
|
103
113
|
|
|
104
114
|
def import_micro_app_permissions(org, permission_path):
|
|
105
115
|
if not os.path.exists(permission_path):
|
|
106
|
-
print "
|
|
116
|
+
print "permission path {} does not exist, return...".format(permission_path)
|
|
107
117
|
return
|
|
108
118
|
headers = {"org": str(org), "user": "defaultUser"}
|
|
109
119
|
url = "http://{}/api/micro_app/v1/permission/import".format(MICRO_APP_ADDR)
|
|
@@ -123,29 +133,109 @@ def read_union_apps_file(install_app_path):
|
|
|
123
133
|
with open(union_app_file, "r") as f:
|
|
124
134
|
return simplejson.load(f)
|
|
125
135
|
|
|
136
|
+
def get_union_app_version(install_path):
|
|
137
|
+
version_file_path = os.path.join(install_path, "version.ini")
|
|
138
|
+
with open(version_file_path) as f:
|
|
139
|
+
version_content = f.readlines()
|
|
140
|
+
return version_content[1].strip()
|
|
141
|
+
|
|
142
|
+
def get_union_app_id_and_version(install_path):
|
|
143
|
+
pluin_name = os.path.basename(install_path)
|
|
144
|
+
union_app_id = pluin_name[:-len("-standalone-NA")]
|
|
145
|
+
union_app_version = get_union_app_version(install_path)
|
|
146
|
+
return union_app_id, union_app_version
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def report_single_standalone_na(union_app_install_path, app_detail, union_app_id, union_app_version):
|
|
150
|
+
app_id = app_detail["app_id"]
|
|
151
|
+
version = app_detail["version"]
|
|
152
|
+
if app_detail["use_brick_next_v3"]:
|
|
153
|
+
subdir_snippet = "v3"
|
|
154
|
+
else:
|
|
155
|
+
subdir_snippet = "v2"
|
|
156
|
+
single_app_path = os.path.join(union_app_install_path, "micro-apps", subdir_snippet, app_id, version)
|
|
157
|
+
app = collect_app_info(single_app_path, app_id, version)
|
|
158
|
+
if app:
|
|
159
|
+
# 增加union信息
|
|
160
|
+
app["unionAppInfo"] = {
|
|
161
|
+
"unionAppId": union_app_id,
|
|
162
|
+
"unionAppVersion": union_app_version,
|
|
163
|
+
}
|
|
164
|
+
report_standalone_na_ret = report(org, app)
|
|
165
|
+
permission_file_path = os.path.join(single_app_path, "permissions", "permissions.json")
|
|
166
|
+
import_micro_app_permissions(org, permission_file_path)
|
|
167
|
+
return report_standalone_na_ret
|
|
168
|
+
else:
|
|
169
|
+
return None
|
|
170
|
+
|
|
171
|
+
def report_union_apps(org, union_app_install_path):
|
|
172
|
+
union_app_id, union_app_version = get_union_app_id_and_version(union_app_install_path)
|
|
173
|
+
union_apps = read_union_apps_file(union_app_install_path)
|
|
174
|
+
updated_apps = []
|
|
175
|
+
skip_updated_apps = []
|
|
176
|
+
executor = ThreadPoolExecutor(max_workers=20)
|
|
177
|
+
try:
|
|
178
|
+
all_task = [ executor.submit(report_single_standalone_na, union_app_install_path, app, union_app_id, union_app_version) for app in union_apps ]
|
|
179
|
+
wait(all_task, return_when=ALL_COMPLETED)
|
|
180
|
+
for future in as_completed(all_task):
|
|
181
|
+
report_ret = future.result()
|
|
182
|
+
print u"report result: {}".format(report_ret)
|
|
183
|
+
if report_ret is None:
|
|
184
|
+
continue
|
|
185
|
+
is_skip_update = report_ret.get("skipUpdate")
|
|
186
|
+
if is_skip_update:
|
|
187
|
+
skip_updated_apps.append(report_ret.get("appId"))
|
|
188
|
+
else:
|
|
189
|
+
updated_apps.append(report_ret.get("appId"))
|
|
190
|
+
except Exception as e:
|
|
191
|
+
print u"report union app:{}, {}, err: {}".format(union_app_id, union_app_version, e)
|
|
192
|
+
sys.exit(1)
|
|
193
|
+
finally:
|
|
194
|
+
executor.shutdown()
|
|
126
195
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
for app in union_apps:
|
|
130
|
-
app_id = app["app_id"]
|
|
131
|
-
version = app["version"]
|
|
132
|
-
if app["use_brick_next_v3"]:
|
|
133
|
-
subdir_snippet = "v3"
|
|
134
|
-
else:
|
|
135
|
-
subdir_snippet = "v2"
|
|
136
|
-
union_app_path = os.path.join(install_app_path, "micro-apps", subdir_snippet, app_id, version)
|
|
137
|
-
print u"report app: {}, current app path: {}".format(app_id, union_app_path)
|
|
138
|
-
app = collect_app_info(union_app_path, app_id, version)
|
|
139
|
-
if app:
|
|
140
|
-
report(org, app)
|
|
141
|
-
permission_file_path = os.path.join(union_app_path, "permissions", "permissions.json")
|
|
142
|
-
import_micro_app_permissions(org, permission_file_path)
|
|
196
|
+
print "report union_apps: updated sa_na: {}, skip updated sa_na: {}".format(",".join(updated_apps), ",".join(skip_updated_apps))
|
|
197
|
+
return updated_apps
|
|
143
198
|
|
|
199
|
+
def delete_directory(directory_path):
|
|
200
|
+
try:
|
|
201
|
+
shutil.rmtree(directory_path)
|
|
202
|
+
print u"delete directory: {}".format(directory_path)
|
|
203
|
+
except Exception as e:
|
|
204
|
+
print u"error deleting directory: {}, err: {}".format(directory_path, e)
|
|
205
|
+
|
|
206
|
+
def is_develop_version(standalone_na_path):
|
|
207
|
+
version_file_path = os.path.join(standalone_na_path, "version.ini")
|
|
208
|
+
if not os.path.exists(version_file_path):
|
|
209
|
+
return True
|
|
210
|
+
with open(version_file_path) as f:
|
|
211
|
+
version_content = f.readlines()
|
|
212
|
+
if "0.0.0" in version_content[1]:
|
|
213
|
+
return True
|
|
214
|
+
return False
|
|
215
|
+
|
|
216
|
+
def uninstall_old_sa_na(standalone_na_list):
|
|
217
|
+
for sa_na_name in standalone_na_list:
|
|
218
|
+
sa_na_path = os.path.join(_INSTALL_BASE_PATH, _APPLICATIONS_SA_FOLDER, sa_na_name+"-standalone-NA")
|
|
219
|
+
if not os.path.exists(sa_na_path):
|
|
220
|
+
print u"old standalone_na dir: {} done not exist".format(sa_na_path)
|
|
221
|
+
continue
|
|
222
|
+
if is_develop_version(sa_na_path):
|
|
223
|
+
print u"standalone_na is developing: skip delete dir: {}".format(sa_na_path)
|
|
224
|
+
continue
|
|
225
|
+
|
|
226
|
+
# 删除old standalone na
|
|
227
|
+
delete_directory(sa_na_path)
|
|
228
|
+
# 删除pkg目录: /usr/local/easyops/pkg/conf/xx-standalone-na
|
|
229
|
+
old_sa_na_pkg_path = os.path.join(_INSTALL_BASE_PATH, "pkg", "conf", sa_na_name+"-standalone-NA")
|
|
230
|
+
if os.path.exists(old_sa_na_pkg_path):
|
|
231
|
+
delete_directory(old_sa_na_pkg_path)
|
|
144
232
|
|
|
145
233
|
if __name__ == "__main__":
|
|
146
234
|
if len(sys.argv) != 3:
|
|
147
|
-
print "Usage: ./report_union_micro_app.py $org $
|
|
235
|
+
print "Usage: ./report_union_micro_app.py $org $union_app_install_path"
|
|
148
236
|
sys.exit(1)
|
|
149
237
|
org = sys.argv[1]
|
|
150
|
-
|
|
151
|
-
report_union_apps(org,
|
|
238
|
+
union_app_install_path = sys.argv[2]
|
|
239
|
+
updated_apps = report_union_apps(org, union_app_install_path)
|
|
240
|
+
# 卸载老的sa-na
|
|
241
|
+
uninstall_old_sa_na(updated_apps)
|