@next-core/brick-container 2.82.12 → 2.83.1

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.
@@ -0,0 +1,59 @@
1
+ #!/bin/bash
2
+
3
+ # easyops 安装根目录
4
+ install_base="/usr/local/easyops"
5
+
6
+ plugin_name='brick_next'
7
+
8
+ install_path="${install_base}/${plugin_name}"
9
+
10
+ function check_service_availability() {
11
+ services=$1
12
+ for service in ${services[*]}; do
13
+ ret=`${install_base}/python/bin/python ${install_base}/ens_client/tools/get_all_service.py ${service}`
14
+ arr=($ret)
15
+ if [[ ${arr[0]} -lt 0 ]]; then
16
+ echo "service ${service} not ready"
17
+ return 1
18
+ fi
19
+ done
20
+ }
21
+
22
+ function check_service() {
23
+ associated_service=("logic.micro_app_service" "logic.user_service" "logic.artifact")
24
+ check_service_availability "${associated_service[*]}"
25
+ if [[ `echo $?` -eq 1 ]]; then
26
+ sleep 15
27
+ check_service_availability "${associated_service[*]}"
28
+ if [[ `echo $?` -eq 1 ]]; then
29
+ echo "some service not ready, and retry fail, exit"
30
+ exit 1
31
+ fi
32
+ fi
33
+ }
34
+
35
+ function report_package() {
36
+ install_base=$1
37
+ org=$2
38
+ install_path=$3
39
+ if [[ -f ${install_base}/brick_next/packages/brick-container/tools/report_installed_brick_next_package.py ]];then
40
+ ${install_base}/python/bin/python ${install_base}/brick_next/packages/brick-container/tools/report_installed_brick_next_package.py ${org} ${install_path}
41
+ if [[ $? -ne 0 ]]; then
42
+ echo "report brick next error"
43
+ exit 1
44
+ fi
45
+ fi
46
+ }
47
+
48
+ # 优先取环境变量里面的org
49
+ if [[ ${org}X == X ]]; then
50
+ org=$(/usr/local/easyops/deploy_init/tools/get_env.py common org)
51
+ [[ $? -ne 0 ]] && echo "get org error, exit" && exit 1
52
+ fi
53
+
54
+ # 上报当前安装小产品
55
+ check_service
56
+ report_package ${install_base} ${org} ${install_path}
57
+
58
+ exit 0
59
+