@geek-fun/serverlessinsight 0.4.1 → 0.5.0
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/.gitattributes +1 -0
- package/README.md +108 -8
- package/README.zh-CN.md +52 -8
- package/dist/package.json +37 -35
- package/dist/src/commands/deploy.js +17 -7
- package/dist/src/commands/destroy.js +27 -4
- package/dist/src/commands/forceUnlock.js +61 -0
- package/dist/src/commands/index.js +41 -5
- package/dist/src/commands/local.js +10 -1
- package/dist/src/commands/plan.js +33 -0
- package/dist/src/commands/template.js +1 -1
- package/dist/src/commands/validate.js +2 -1
- package/dist/src/common/aliyunClient/apigwOperations.js +652 -0
- package/dist/src/common/aliyunClient/dnsOperations.js +90 -0
- package/dist/src/common/aliyunClient/ecsOperations.js +141 -0
- package/dist/src/common/aliyunClient/esOperations.js +219 -0
- package/dist/src/common/aliyunClient/fc3Operations.js +270 -0
- package/dist/src/common/aliyunClient/index.js +141 -0
- package/dist/src/common/aliyunClient/nasOperations.js +233 -0
- package/dist/src/common/aliyunClient/ossOperations.js +237 -0
- package/dist/src/common/aliyunClient/ramOperations.js +205 -0
- package/dist/src/common/aliyunClient/rdsOperations.js +206 -0
- package/dist/src/common/aliyunClient/slsOperations.js +218 -0
- package/dist/src/common/aliyunClient/tablestoreOperations.js +199 -0
- package/dist/src/common/aliyunClient/types.js +2 -0
- package/dist/src/common/constants.js +6 -1
- package/dist/src/common/context.js +13 -3
- package/dist/src/common/credentials.js +30 -6
- package/dist/src/common/dependencyGraph/graph.js +280 -0
- package/dist/src/common/dependencyGraph/index.js +18 -0
- package/dist/src/common/dependencyGraph/types.js +2 -0
- package/dist/src/common/fileUtils.js +16 -0
- package/dist/src/common/hashUtils.js +121 -0
- package/dist/src/common/iacHelper.js +25 -97
- package/dist/src/common/imsClient.js +4 -0
- package/dist/src/common/index.js +6 -2
- package/dist/src/common/lockManager.js +212 -0
- package/dist/src/common/logger.js +87 -10
- package/dist/src/common/providerEnum.js +2 -3
- package/dist/src/common/runtimeMapper.js +160 -0
- package/dist/src/common/scfClient.js +84 -0
- package/dist/src/common/stateManager.js +107 -0
- package/dist/src/common/tencentClient/cosOperations.js +287 -0
- package/dist/src/common/tencentClient/esOperations.js +156 -0
- package/dist/src/common/tencentClient/index.js +116 -0
- package/dist/src/common/tencentClient/scfOperations.js +141 -0
- package/dist/src/common/tencentClient/tdsqlcOperations.js +211 -0
- package/dist/src/common/tencentClient/types.js +17 -0
- package/dist/src/lang/en.js +254 -0
- package/dist/src/lang/index.js +28 -8
- package/dist/src/lang/zh-CN.js +229 -0
- package/dist/src/parser/bucketParser.js +25 -12
- package/dist/src/parser/databaseParser.js +14 -10
- package/dist/src/parser/functionParser.js +19 -6
- package/dist/src/parser/parseUtils.js +74 -0
- package/dist/src/parser/tableParser.js +19 -17
- package/dist/src/stack/aliyunStack/apigwExecutor.js +84 -0
- package/dist/src/stack/aliyunStack/apigwPlanner.js +118 -0
- package/dist/src/stack/aliyunStack/apigwResource.js +339 -0
- package/dist/src/stack/aliyunStack/apigwTypes.js +125 -0
- package/dist/src/stack/aliyunStack/databaseExecutor.js +112 -0
- package/dist/src/stack/aliyunStack/databasePlanner.js +128 -0
- package/dist/src/stack/aliyunStack/databaseResource.js +228 -0
- package/dist/src/stack/aliyunStack/deployer.js +133 -0
- package/dist/src/stack/aliyunStack/destroyer.js +114 -0
- package/dist/src/stack/aliyunStack/esServerlessTypes.js +141 -0
- package/dist/src/stack/aliyunStack/fc3Executor.js +91 -0
- package/dist/src/stack/aliyunStack/fc3Planner.js +77 -0
- package/dist/src/stack/aliyunStack/fc3Resource.js +511 -0
- package/dist/src/stack/aliyunStack/fc3Types.js +76 -0
- package/dist/src/stack/aliyunStack/index.js +40 -0
- package/dist/src/stack/aliyunStack/ossExecutor.js +91 -0
- package/dist/src/stack/aliyunStack/ossPlanner.js +76 -0
- package/dist/src/stack/aliyunStack/ossResource.js +196 -0
- package/dist/src/stack/aliyunStack/ossTypes.js +50 -0
- package/dist/src/stack/aliyunStack/planner.js +37 -0
- package/dist/src/stack/aliyunStack/rdsTypes.js +217 -0
- package/dist/src/stack/aliyunStack/tablestoreExecutor.js +92 -0
- package/dist/src/stack/aliyunStack/tablestorePlanner.js +94 -0
- package/dist/src/stack/aliyunStack/tablestoreResource.js +120 -0
- package/dist/src/stack/aliyunStack/tablestoreTypes.js +77 -0
- package/dist/src/stack/bucketTypes.js +17 -0
- package/dist/src/stack/deploy.js +24 -77
- package/dist/src/stack/localStack/bucket.js +11 -6
- package/dist/src/stack/localStack/event.js +10 -5
- package/dist/src/stack/localStack/function.js +13 -7
- package/dist/src/stack/localStack/functionRunner.js +1 -1
- package/dist/src/stack/localStack/localServer.js +7 -6
- package/dist/src/stack/scfStack/cosExecutor.js +91 -0
- package/dist/src/stack/scfStack/cosPlanner.js +76 -0
- package/dist/src/stack/scfStack/cosResource.js +126 -0
- package/dist/src/stack/scfStack/cosTypes.js +46 -0
- package/dist/src/stack/scfStack/deployer.js +91 -0
- package/dist/src/stack/scfStack/destroyer.js +88 -0
- package/dist/src/stack/scfStack/esServerlessExecutor.js +105 -0
- package/dist/src/stack/scfStack/esServerlessPlanner.js +86 -0
- package/dist/src/stack/scfStack/esServerlessResource.js +94 -0
- package/dist/src/stack/scfStack/esServerlessTypes.js +48 -0
- package/dist/src/stack/scfStack/index.js +35 -0
- package/dist/src/stack/scfStack/planner.js +91 -0
- package/dist/src/stack/scfStack/scfExecutor.js +91 -0
- package/dist/src/stack/scfStack/scfPlanner.js +78 -0
- package/dist/src/stack/scfStack/scfResource.js +216 -0
- package/dist/src/stack/scfStack/scfTypes.js +41 -0
- package/dist/src/stack/scfStack/tdsqlcExecutor.js +105 -0
- package/dist/src/stack/scfStack/tdsqlcPlanner.js +90 -0
- package/dist/src/stack/scfStack/tdsqlcResource.js +146 -0
- package/dist/src/stack/scfStack/tdsqlcTypes.js +59 -0
- package/dist/src/types/domains/lock.js +2 -0
- package/dist/src/types/domains/resolvable.js +2 -0
- package/dist/src/types/domains/state.js +19 -0
- package/dist/src/types/index.js +4 -0
- package/dist/src/validator/bucketSchema.js +4 -10
- package/dist/src/validator/databaseSchema.js +36 -36
- package/dist/src/validator/eventSchema.js +3 -2
- package/dist/src/validator/functionSchema.js +51 -46
- package/dist/src/validator/iacSchema.js +35 -1
- package/dist/src/validator/rootSchema.js +1 -1
- package/dist/src/validator/tableschema.js +9 -8
- package/dist/src/validator/templateRefSchema.js +23 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +37 -35
- package/samples/README_TENCENT_COS.md +486 -0
- package/samples/README_TENCENT_SCF.md +272 -0
- package/samples/aliyun-poc-api.yml +1 -1
- package/samples/aliyun-poc-bucket.yml +0 -1
- package/samples/aliyun-poc-domain.yml +0 -1
- package/samples/aliyun-poc-es.yml +4 -7
- package/samples/aliyun-poc-rds.yml +0 -2
- package/samples/aliyun-poc-table.yml +1 -3
- package/samples/tencent-poc-cos.yml +20 -0
- package/samples/tencent-poc-scf.yml +36 -0
- package/dist/src/commands/index.d.ts +0 -2
- package/dist/src/common/index.d.ts +0 -12
- package/dist/src/common/rosAssets.js +0 -178
- package/dist/src/common/rosClient.js +0 -201
- package/dist/src/index.d.ts +0 -1
- package/dist/src/lang/index.d.ts +0 -3
- package/dist/src/parser/index.d.ts +0 -3
- package/dist/src/stack/index.d.ts +0 -1
- package/dist/src/stack/localStack/index.d.ts +0 -5
- package/dist/src/stack/rfsStack/index.d.ts +0 -9
- package/dist/src/stack/rosStack/bootstrap.js +0 -187
- package/dist/src/stack/rosStack/bucket.js +0 -127
- package/dist/src/stack/rosStack/database.js +0 -313
- package/dist/src/stack/rosStack/event.js +0 -143
- package/dist/src/stack/rosStack/function.js +0 -259
- package/dist/src/stack/rosStack/index.d.ts +0 -7
- package/dist/src/stack/rosStack/index.js +0 -75
- package/dist/src/stack/rosStack/stage.js +0 -46
- package/dist/src/stack/rosStack/table.js +0 -95
- package/dist/src/stack/rosStack/tag.js +0 -11
- package/dist/src/stack/rosStack/vars.js +0 -49
- package/dist/src/types/index.d.ts +0 -55
- package/dist/src/types/localStack/index.d.ts +0 -81
- package/dist/src/validator/index.d.ts +0 -1
- package/layers/si-bootstrap-sdk/Dockerfile-aliyuncli +0 -12
- package/layers/si-bootstrap-sdk/README.md +0 -64
- package/layers/si-bootstrap-sdk/package-lock.json +0 -881
- package/layers/si-bootstrap-sdk/package.json +0 -33
- package/layers/si-bootstrap-sdk/support/operation-collection/README.md +0 -47
- package/layers/si-bootstrap-sdk/support/operation-collection/package-lock.json +0 -298
- package/layers/si-bootstrap-sdk/support/operation-collection/package.json +0 -18
- package/layers/si-bootstrap-sdk/support/operation-collection/publish.js +0 -257
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@geek-fun/si-bootstrap-sdk",
|
|
3
|
-
"version": "1.0.2",
|
|
4
|
-
"main": "src/index.js",
|
|
5
|
-
"types": "src/index.d.ts",
|
|
6
|
-
"description": "Bootstrap SDK for Serverless Insight",
|
|
7
|
-
"homepage": "https://serverlessinsight.geekfun.club",
|
|
8
|
-
"scripts": {
|
|
9
|
-
"build": "tsc --build",
|
|
10
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
|
-
},
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "git+https://github.com/geek-fun/serverlessinsight.git"
|
|
15
|
-
},
|
|
16
|
-
"author": "geekfun <support@geekfun.club>",
|
|
17
|
-
"license": "Apache-2.0",
|
|
18
|
-
"bugs": {
|
|
19
|
-
"url": "https://github.com/geek-fun/serverlessinsight/issues"
|
|
20
|
-
},
|
|
21
|
-
"devDependencies": {
|
|
22
|
-
"@types/tablestore": "^5.1.3",
|
|
23
|
-
"typescript": "^5.9.3"
|
|
24
|
-
},
|
|
25
|
-
"dependencies": {
|
|
26
|
-
"@alicloud/credentials": "^2.4.4",
|
|
27
|
-
"@alicloud/openapi-client": "^0.4.15",
|
|
28
|
-
"@alicloud/tablestore20201209": "^1.2.0",
|
|
29
|
-
"pino": "^10.1.0",
|
|
30
|
-
"pino-pretty": "^13.1.3",
|
|
31
|
-
"tablestore": "^5.6.3"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# SI Operation Collection
|
|
2
|
-
|
|
3
|
-
Simple Node.js scripts for managing SI bootstrap SDK operations.
|
|
4
|
-
|
|
5
|
-
## Setup
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
### Publish Layer to Multiple Regions
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
node publish.js \
|
|
17
|
-
--artifact ../../artifacts/si-bootstrap-sdk.zip \
|
|
18
|
-
--layer-name si-bootstrap-sdk \
|
|
19
|
-
--regions cn-beijing,cn-hangzhou,cn-chengdu \
|
|
20
|
-
--runtimes nodejs20,nodejs18,nodejs16 \
|
|
21
|
-
--delay 2
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Or use environment variables:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
export ALIYUN_ACCESS_KEY_ID=your-key-id
|
|
28
|
-
export ALIYUN_ACCESS_KEY_SECRET=your-key-secret
|
|
29
|
-
export ALIYUN_REGIONS=cn-beijing,cn-hangzhou,cn-chengdu
|
|
30
|
-
export ALIYUN_COMPATIBLE_RUNTIMES=nodejs20,nodejs18,nodejs16
|
|
31
|
-
export API_DELAY=2
|
|
32
|
-
|
|
33
|
-
node publish.js --artifact ../../artifacts/si-bootstrap-sdk.zip
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Required Environment Variables
|
|
37
|
-
|
|
38
|
-
- `ALIYUN_ACCESS_KEY_ID`: Aliyun access key ID
|
|
39
|
-
- `ALIYUN_ACCESS_KEY_SECRET`: Aliyun access key secret
|
|
40
|
-
|
|
41
|
-
## Optional Environment Variables
|
|
42
|
-
|
|
43
|
-
- `ALIYUN_SECURITY_TOKEN`: For STS temporary credentials
|
|
44
|
-
- `ALIYUN_ACCOUNT_ID`: Aliyun account ID (defaults to 1990893136649406)
|
|
45
|
-
- `ALIYUN_REGIONS`: Comma-separated list of regions
|
|
46
|
-
- `ALIYUN_COMPATIBLE_RUNTIMES`: Comma-separated list of compatible runtimes
|
|
47
|
-
- `API_DELAY`: Delay between API calls in seconds (default: 2)
|
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@geek-fun/si-operation-collection",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"lockfileVersion": 3,
|
|
5
|
-
"requires": true,
|
|
6
|
-
"packages": {
|
|
7
|
-
"": {
|
|
8
|
-
"name": "@geek-fun/si-operation-collection",
|
|
9
|
-
"version": "1.0.0",
|
|
10
|
-
"hasInstallScript": true,
|
|
11
|
-
"license": "Apache-2.0",
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"@alicloud/credentials": "^2.4.4",
|
|
14
|
-
"@alicloud/fc-open20210406": "^2.0.13",
|
|
15
|
-
"@alicloud/openapi-client": "^0.4.15",
|
|
16
|
-
"@alicloud/tea-util": "^1.4.11"
|
|
17
|
-
},
|
|
18
|
-
"engines": {
|
|
19
|
-
"node": ">=18"
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
"node_modules/@alicloud/credentials": {
|
|
23
|
-
"version": "2.4.4",
|
|
24
|
-
"resolved": "https://registry.npmjs.org/@alicloud/credentials/-/credentials-2.4.4.tgz",
|
|
25
|
-
"integrity": "sha512-/eRAGSKcniLIFQ1UCpDhB/IrHUZisQ1sc65ws/c2avxUMpXwH1rWAohb76SVAUJhiF4mwvLzLJM1Mn1XL4Xe/Q==",
|
|
26
|
-
"license": "MIT",
|
|
27
|
-
"dependencies": {
|
|
28
|
-
"@alicloud/tea-typescript": "^1.8.0",
|
|
29
|
-
"httpx": "^2.3.3",
|
|
30
|
-
"ini": "^1.3.5",
|
|
31
|
-
"kitx": "^2.0.0"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"node_modules/@alicloud/endpoint-util": {
|
|
35
|
-
"version": "0.0.1",
|
|
36
|
-
"resolved": "https://registry.npmjs.org/@alicloud/endpoint-util/-/endpoint-util-0.0.1.tgz",
|
|
37
|
-
"integrity": "sha512-+pH7/KEXup84cHzIL6UJAaPqETvln4yXlD9JzlrqioyCSaWxbug5FUobsiI6fuUOpw5WwoB3fWAtGbFnJ1K3Yg==",
|
|
38
|
-
"license": "Apache-2.0",
|
|
39
|
-
"dependencies": {
|
|
40
|
-
"@alicloud/tea-typescript": "^1.5.1",
|
|
41
|
-
"kitx": "^2.0.0"
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
"node_modules/@alicloud/fc-open20210406": {
|
|
45
|
-
"version": "2.0.13",
|
|
46
|
-
"resolved": "https://registry.npmjs.org/@alicloud/fc-open20210406/-/fc-open20210406-2.0.13.tgz",
|
|
47
|
-
"integrity": "sha512-H7DjUoNSPUp967Ir1VZtEFi+2n0q5P6qX5YXWNnHuBvAqASEEqrN6SwzuygMGxSo75j/d1CPzmgT5oREbecOOg==",
|
|
48
|
-
"license": "Apache-2.0",
|
|
49
|
-
"dependencies": {
|
|
50
|
-
"@alicloud/endpoint-util": "^0.0.1",
|
|
51
|
-
"@alicloud/openapi-client": "^0.4.7",
|
|
52
|
-
"@alicloud/openapi-util": "^0.3.2",
|
|
53
|
-
"@alicloud/tea-typescript": "^1.7.1",
|
|
54
|
-
"@alicloud/tea-util": "^1.4.7"
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
"node_modules/@alicloud/gateway-spi": {
|
|
58
|
-
"version": "0.0.8",
|
|
59
|
-
"resolved": "https://registry.npmjs.org/@alicloud/gateway-spi/-/gateway-spi-0.0.8.tgz",
|
|
60
|
-
"integrity": "sha512-KM7fu5asjxZPmrz9sJGHJeSU+cNQNOxW+SFmgmAIrITui5hXL2LB+KNRuzWmlwPjnuA2X3/keq9h6++S9jcV5g==",
|
|
61
|
-
"license": "ISC",
|
|
62
|
-
"dependencies": {
|
|
63
|
-
"@alicloud/credentials": "^2",
|
|
64
|
-
"@alicloud/tea-typescript": "^1.7.1"
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
"node_modules/@alicloud/openapi-client": {
|
|
68
|
-
"version": "0.4.15",
|
|
69
|
-
"resolved": "https://registry.npmjs.org/@alicloud/openapi-client/-/openapi-client-0.4.15.tgz",
|
|
70
|
-
"integrity": "sha512-4VE0/k5ZdQbAhOSTqniVhuX1k5DUeUMZv74degn3wIWjLY6Bq+hxjaGsaHYlLZ2gA5wUrs8NcI5TE+lIQS3iiA==",
|
|
71
|
-
"license": "ISC",
|
|
72
|
-
"dependencies": {
|
|
73
|
-
"@alicloud/credentials": "^2.4.2",
|
|
74
|
-
"@alicloud/gateway-spi": "^0.0.8",
|
|
75
|
-
"@alicloud/openapi-util": "^0.3.2",
|
|
76
|
-
"@alicloud/tea-typescript": "^1.7.1",
|
|
77
|
-
"@alicloud/tea-util": "1.4.9",
|
|
78
|
-
"@alicloud/tea-xml": "0.0.3"
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
"node_modules/@alicloud/openapi-client/node_modules/@alicloud/tea-util": {
|
|
82
|
-
"version": "1.4.9",
|
|
83
|
-
"resolved": "https://registry.npmjs.org/@alicloud/tea-util/-/tea-util-1.4.9.tgz",
|
|
84
|
-
"integrity": "sha512-S0wz76rGtoPKskQtRTGqeuqBHFj8BqUn0Vh+glXKun2/9UpaaaWmuJwcmtImk6bJZfLYEShDF/kxDmDJoNYiTw==",
|
|
85
|
-
"license": "Apache-2.0",
|
|
86
|
-
"dependencies": {
|
|
87
|
-
"@alicloud/tea-typescript": "^1.5.1",
|
|
88
|
-
"kitx": "^2.0.0"
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
"node_modules/@alicloud/openapi-util": {
|
|
92
|
-
"version": "0.3.2",
|
|
93
|
-
"resolved": "https://registry.npmjs.org/@alicloud/openapi-util/-/openapi-util-0.3.2.tgz",
|
|
94
|
-
"integrity": "sha512-EC2JvxdcOgMlBAEG0+joOh2IB1um8CPz9EdYuRfTfd1uP8Yc9D8QRUWVGjP6scnj6fWSOaHFlit9H6PrJSyFow==",
|
|
95
|
-
"license": "ISC",
|
|
96
|
-
"dependencies": {
|
|
97
|
-
"@alicloud/tea-typescript": "^1.7.1",
|
|
98
|
-
"@alicloud/tea-util": "^1.3.0",
|
|
99
|
-
"kitx": "^2.1.0",
|
|
100
|
-
"sm3": "^1.0.3"
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
"node_modules/@alicloud/tea-typescript": {
|
|
104
|
-
"version": "1.8.0",
|
|
105
|
-
"resolved": "https://registry.npmjs.org/@alicloud/tea-typescript/-/tea-typescript-1.8.0.tgz",
|
|
106
|
-
"integrity": "sha512-CWXWaquauJf0sW30mgJRVu9aaXyBth5uMBCUc+5vKTK1zlgf3hIqRUjJZbjlwHwQ5y9anwcu18r48nOZb7l2QQ==",
|
|
107
|
-
"license": "ISC",
|
|
108
|
-
"dependencies": {
|
|
109
|
-
"@types/node": "^12.0.2",
|
|
110
|
-
"httpx": "^2.2.6"
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
"node_modules/@alicloud/tea-util": {
|
|
114
|
-
"version": "1.4.11",
|
|
115
|
-
"resolved": "https://registry.npmjs.org/@alicloud/tea-util/-/tea-util-1.4.11.tgz",
|
|
116
|
-
"integrity": "sha512-HyPEEQ8F0WoZegiCp7sVdrdm6eBOB+GCvGl4182u69LDFktxfirGLcAx3WExUr1zFWkq2OSmBroTwKQ4w/+Yww==",
|
|
117
|
-
"license": "Apache-2.0",
|
|
118
|
-
"dependencies": {
|
|
119
|
-
"@alicloud/tea-typescript": "^1.5.1",
|
|
120
|
-
"@darabonba/typescript": "^1.0.0",
|
|
121
|
-
"kitx": "^2.0.0"
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
"node_modules/@alicloud/tea-xml": {
|
|
125
|
-
"version": "0.0.3",
|
|
126
|
-
"resolved": "https://registry.npmjs.org/@alicloud/tea-xml/-/tea-xml-0.0.3.tgz",
|
|
127
|
-
"integrity": "sha512-+/9GliugjrLglsXVrd1D80EqqKgGpyA0eQ6+1ZdUOYCaRguaSwz44trX3PaxPu/HhIPJg9PsGQQ3cSLXWZjbAA==",
|
|
128
|
-
"license": "Apache-2.0",
|
|
129
|
-
"dependencies": {
|
|
130
|
-
"@alicloud/tea-typescript": "^1",
|
|
131
|
-
"@types/xml2js": "^0.4.5",
|
|
132
|
-
"xml2js": "^0.6.0"
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
"node_modules/@darabonba/typescript": {
|
|
136
|
-
"version": "1.0.3",
|
|
137
|
-
"resolved": "https://registry.npmjs.org/@darabonba/typescript/-/typescript-1.0.3.tgz",
|
|
138
|
-
"integrity": "sha512-/y2y6wf5TsxD7pCPIm0OvTC+5qV0Tk7HQYxwpIuWRLXQLB0CRDvr6qk4bR6rTLO/JglJa8z2uCGZsaLYpQNqFQ==",
|
|
139
|
-
"license": "Apache License 2.0",
|
|
140
|
-
"dependencies": {
|
|
141
|
-
"@alicloud/tea-typescript": "^1.5.1",
|
|
142
|
-
"httpx": "^2.3.2",
|
|
143
|
-
"lodash": "^4.17.21",
|
|
144
|
-
"moment": "^2.30.1",
|
|
145
|
-
"moment-timezone": "^0.5.45",
|
|
146
|
-
"xml2js": "^0.6.2"
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
"node_modules/@types/node": {
|
|
150
|
-
"version": "12.20.55",
|
|
151
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz",
|
|
152
|
-
"integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==",
|
|
153
|
-
"license": "MIT"
|
|
154
|
-
},
|
|
155
|
-
"node_modules/@types/xml2js": {
|
|
156
|
-
"version": "0.4.14",
|
|
157
|
-
"resolved": "https://registry.npmjs.org/@types/xml2js/-/xml2js-0.4.14.tgz",
|
|
158
|
-
"integrity": "sha512-4YnrRemBShWRO2QjvUin8ESA41rH+9nQGLUGZV/1IDhi3SL9OhdpNC/MrulTWuptXKwhx/aDxE7toV0f/ypIXQ==",
|
|
159
|
-
"license": "MIT",
|
|
160
|
-
"dependencies": {
|
|
161
|
-
"@types/node": "*"
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
"node_modules/debug": {
|
|
165
|
-
"version": "4.4.3",
|
|
166
|
-
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
|
167
|
-
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
|
|
168
|
-
"license": "MIT",
|
|
169
|
-
"dependencies": {
|
|
170
|
-
"ms": "^2.1.3"
|
|
171
|
-
},
|
|
172
|
-
"engines": {
|
|
173
|
-
"node": ">=6.0"
|
|
174
|
-
},
|
|
175
|
-
"peerDependenciesMeta": {
|
|
176
|
-
"supports-color": {
|
|
177
|
-
"optional": true
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
},
|
|
181
|
-
"node_modules/httpx": {
|
|
182
|
-
"version": "2.3.3",
|
|
183
|
-
"resolved": "https://registry.npmjs.org/httpx/-/httpx-2.3.3.tgz",
|
|
184
|
-
"integrity": "sha512-k1qv94u1b6e+XKCxVbLgYlOypVP9MPGpnN5G/vxFf6tDO4V3xpz3d6FUOY/s8NtPgaq5RBVVgSB+7IHpVxMYzw==",
|
|
185
|
-
"license": "MIT",
|
|
186
|
-
"dependencies": {
|
|
187
|
-
"@types/node": "^20",
|
|
188
|
-
"debug": "^4.1.1"
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
"node_modules/httpx/node_modules/@types/node": {
|
|
192
|
-
"version": "20.19.27",
|
|
193
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.27.tgz",
|
|
194
|
-
"integrity": "sha512-N2clP5pJhB2YnZJ3PIHFk5RkygRX5WO/5f0WC08tp0wd+sv0rsJk3MqWn3CbNmT2J505a5336jaQj4ph1AdMug==",
|
|
195
|
-
"license": "MIT",
|
|
196
|
-
"dependencies": {
|
|
197
|
-
"undici-types": "~6.21.0"
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
"node_modules/ini": {
|
|
201
|
-
"version": "1.3.8",
|
|
202
|
-
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
|
|
203
|
-
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
|
|
204
|
-
"license": "ISC"
|
|
205
|
-
},
|
|
206
|
-
"node_modules/kitx": {
|
|
207
|
-
"version": "2.2.0",
|
|
208
|
-
"resolved": "https://registry.npmjs.org/kitx/-/kitx-2.2.0.tgz",
|
|
209
|
-
"integrity": "sha512-tBMwe6AALTBQJb0woQDD40734NKzb0Kzi3k7wQj9ar3AbP9oqhoVrdXPh7rk2r00/glIgd0YbToIUJsnxWMiIg==",
|
|
210
|
-
"license": "MIT",
|
|
211
|
-
"dependencies": {
|
|
212
|
-
"@types/node": "^22.5.4"
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
"node_modules/kitx/node_modules/@types/node": {
|
|
216
|
-
"version": "22.19.3",
|
|
217
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.3.tgz",
|
|
218
|
-
"integrity": "sha512-1N9SBnWYOJTrNZCdh/yJE+t910Y128BoyY+zBLWhL3r0TYzlTmFdXrPwHL9DyFZmlEXNQQolTZh3KHV31QDhyA==",
|
|
219
|
-
"license": "MIT",
|
|
220
|
-
"dependencies": {
|
|
221
|
-
"undici-types": "~6.21.0"
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
"node_modules/lodash": {
|
|
225
|
-
"version": "4.17.21",
|
|
226
|
-
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
|
227
|
-
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
|
|
228
|
-
"license": "MIT"
|
|
229
|
-
},
|
|
230
|
-
"node_modules/moment": {
|
|
231
|
-
"version": "2.30.1",
|
|
232
|
-
"resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz",
|
|
233
|
-
"integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==",
|
|
234
|
-
"license": "MIT",
|
|
235
|
-
"engines": {
|
|
236
|
-
"node": "*"
|
|
237
|
-
}
|
|
238
|
-
},
|
|
239
|
-
"node_modules/moment-timezone": {
|
|
240
|
-
"version": "0.5.48",
|
|
241
|
-
"resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.48.tgz",
|
|
242
|
-
"integrity": "sha512-f22b8LV1gbTO2ms2j2z13MuPogNoh5UzxL3nzNAYKGraILnbGc9NEE6dyiiiLv46DGRb8A4kg8UKWLjPthxBHw==",
|
|
243
|
-
"license": "MIT",
|
|
244
|
-
"dependencies": {
|
|
245
|
-
"moment": "^2.29.4"
|
|
246
|
-
},
|
|
247
|
-
"engines": {
|
|
248
|
-
"node": "*"
|
|
249
|
-
}
|
|
250
|
-
},
|
|
251
|
-
"node_modules/ms": {
|
|
252
|
-
"version": "2.1.3",
|
|
253
|
-
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
|
254
|
-
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
|
255
|
-
"license": "MIT"
|
|
256
|
-
},
|
|
257
|
-
"node_modules/sax": {
|
|
258
|
-
"version": "1.4.3",
|
|
259
|
-
"resolved": "https://registry.npmjs.org/sax/-/sax-1.4.3.tgz",
|
|
260
|
-
"integrity": "sha512-yqYn1JhPczigF94DMS+shiDMjDowYO6y9+wB/4WgO0Y19jWYk0lQ4tuG5KI7kj4FTp1wxPj5IFfcrz/s1c3jjQ==",
|
|
261
|
-
"license": "BlueOak-1.0.0"
|
|
262
|
-
},
|
|
263
|
-
"node_modules/sm3": {
|
|
264
|
-
"version": "1.0.3",
|
|
265
|
-
"resolved": "https://registry.npmjs.org/sm3/-/sm3-1.0.3.tgz",
|
|
266
|
-
"integrity": "sha512-KyFkIfr8QBlFG3uc3NaljaXdYcsbRy1KrSfc4tsQV8jW68jAktGeOcifu530Vx/5LC+PULHT0Rv8LiI8Gw+c1g==",
|
|
267
|
-
"license": "MIT"
|
|
268
|
-
},
|
|
269
|
-
"node_modules/undici-types": {
|
|
270
|
-
"version": "6.21.0",
|
|
271
|
-
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
|
|
272
|
-
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
|
|
273
|
-
"license": "MIT"
|
|
274
|
-
},
|
|
275
|
-
"node_modules/xml2js": {
|
|
276
|
-
"version": "0.6.2",
|
|
277
|
-
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.6.2.tgz",
|
|
278
|
-
"integrity": "sha512-T4rieHaC1EXcES0Kxxj4JWgaUQHDk+qwHcYOCFHfiwKz7tOVPLq7Hjq9dM1WCMhylqMEfP7hMcOIChvotiZegA==",
|
|
279
|
-
"license": "MIT",
|
|
280
|
-
"dependencies": {
|
|
281
|
-
"sax": ">=0.6.0",
|
|
282
|
-
"xmlbuilder": "~11.0.0"
|
|
283
|
-
},
|
|
284
|
-
"engines": {
|
|
285
|
-
"node": ">=4.0.0"
|
|
286
|
-
}
|
|
287
|
-
},
|
|
288
|
-
"node_modules/xmlbuilder": {
|
|
289
|
-
"version": "11.0.1",
|
|
290
|
-
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz",
|
|
291
|
-
"integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==",
|
|
292
|
-
"license": "MIT",
|
|
293
|
-
"engines": {
|
|
294
|
-
"node": ">=4.0"
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@geek-fun/si-operation-collection",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "Operation collection for SI bootstrap SDK management",
|
|
5
|
-
"main": "publish.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
},
|
|
8
|
-
"dependencies": {
|
|
9
|
-
"@alicloud/credentials": "^2.4.4",
|
|
10
|
-
"@alicloud/fc-open20210406": "^2.0.13",
|
|
11
|
-
"@alicloud/openapi-client": "^0.4.15",
|
|
12
|
-
"@alicloud/tea-util": "^1.4.11"
|
|
13
|
-
},
|
|
14
|
-
"engines": {
|
|
15
|
-
"node": ">=18"
|
|
16
|
-
},
|
|
17
|
-
"license": "Apache-2.0"
|
|
18
|
-
}
|
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
5
|
-
|
|
6
|
-
const FCOpen20210406 = require('@alicloud/fc-open20210406').default;
|
|
7
|
-
const OpenApi = require('@alicloud/openapi-client');
|
|
8
|
-
const Util = require('@alicloud/tea-util');
|
|
9
|
-
const Credential = require('@alicloud/credentials').default;
|
|
10
|
-
const fs = require('fs');
|
|
11
|
-
const path = require('path');
|
|
12
|
-
|
|
13
|
-
// Parse command line arguments
|
|
14
|
-
const args = process.argv.slice(2);
|
|
15
|
-
const options = {};
|
|
16
|
-
|
|
17
|
-
for (let i = 0; i < args.length; i++) {
|
|
18
|
-
const arg = args[i];
|
|
19
|
-
if (arg.startsWith('--')) {
|
|
20
|
-
const key = arg.slice(2);
|
|
21
|
-
const value = args[i + 1];
|
|
22
|
-
options[key] = value;
|
|
23
|
-
i++;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Configuration
|
|
28
|
-
const config = {
|
|
29
|
-
artifact: options.artifact || process.env.ARTIFACT_PATH,
|
|
30
|
-
layerName: options['layer-name'] || process.env.LAYER_NAME || 'si-bootstrap-sdk',
|
|
31
|
-
regions: (
|
|
32
|
-
options.regions ||
|
|
33
|
-
process.env.ALIYUN_REGIONS ||
|
|
34
|
-
'cn-beijing,cn-hangzhou,cn-chengdu,ap-southeast-1'
|
|
35
|
-
)
|
|
36
|
-
.split(',')
|
|
37
|
-
.map((r) => r.trim()),
|
|
38
|
-
runtimes: (
|
|
39
|
-
options.runtimes ||
|
|
40
|
-
process.env.ALIYUN_COMPATIBLE_RUNTIMES ||
|
|
41
|
-
'nodejs20,nodejs18,nodejs16'
|
|
42
|
-
)
|
|
43
|
-
.split(',')
|
|
44
|
-
.map((r) => r.trim()),
|
|
45
|
-
delay: parseInt(options.delay || process.env.API_DELAY || '2', 10) * 1000,
|
|
46
|
-
accountId: process.env.ALIYUN_ACCOUNT_ID || '1990893136649406',
|
|
47
|
-
accessKeyId: process.env.ALIYUN_ACCESS_KEY_ID || process.env.ALIBABA_CLOUD_ACCESS_KEY_ID,
|
|
48
|
-
accessKeySecret:
|
|
49
|
-
process.env.ALIYUN_ACCESS_KEY_SECRET || process.env.ALIBABA_CLOUD_ACCESS_KEY_SECRET,
|
|
50
|
-
securityToken: process.env.ALIYUN_SECURITY_TOKEN || process.env.ALIBABA_CLOUD_SECURITY_TOKEN,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// Validate
|
|
54
|
-
if (!config.artifact) {
|
|
55
|
-
console.error('Error: --artifact is required');
|
|
56
|
-
process.exit(1);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const artifactPath = path.resolve(config.artifact);
|
|
60
|
-
if (!fs.existsSync(artifactPath)) {
|
|
61
|
-
console.error(`Error: Artifact not found: ${artifactPath}`);
|
|
62
|
-
process.exit(1);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Initialize credentials once and reuse for all clients
|
|
66
|
-
const credential = new Credential({
|
|
67
|
-
type: 'access_key',
|
|
68
|
-
accessKeyId: config.accessKeyId,
|
|
69
|
-
accessKeySecret: config.accessKeySecret,
|
|
70
|
-
securityToken: config.securityToken,
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
// Helper to create FC client for a region
|
|
74
|
-
const createFCClient = (region) => {
|
|
75
|
-
const clientConfig = new OpenApi.Config({
|
|
76
|
-
credential: credential,
|
|
77
|
-
endpoint: `${config.accountId}.${region}.fc.aliyuncs.com`,
|
|
78
|
-
regionId: region,
|
|
79
|
-
readTimeout: 60000, // 60 seconds for large layer uploads
|
|
80
|
-
connectTimeout: 60000, // 60 seconds connection timeout
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
return new FCOpen20210406(clientConfig);
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
// Get latest layer version for a region
|
|
87
|
-
const getLatestLayerVersion = async (client, layerName, region) => {
|
|
88
|
-
try {
|
|
89
|
-
const runtime = new Util.RuntimeOptions({});
|
|
90
|
-
let allVersions = [];
|
|
91
|
-
let startVersion = undefined;
|
|
92
|
-
|
|
93
|
-
// Paginate through all layer versions
|
|
94
|
-
do {
|
|
95
|
-
const request = startVersion ? { startVersion } : {};
|
|
96
|
-
const response = await client.listLayerVersions(layerName, request, {}, runtime);
|
|
97
|
-
|
|
98
|
-
const versions = response.body.layers || [];
|
|
99
|
-
allVersions = allVersions.concat(versions);
|
|
100
|
-
|
|
101
|
-
startVersion = response.body.nextVersion;
|
|
102
|
-
} while (startVersion);
|
|
103
|
-
|
|
104
|
-
if (allVersions.length === 0) {
|
|
105
|
-
console.log(`Region ${region}: Layer not found, treating as version 0`);
|
|
106
|
-
return 0;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// Find the maximum version number across all pages
|
|
110
|
-
const maxVersion = Math.max(...allVersions.map((v) => v.version || 0));
|
|
111
|
-
return maxVersion;
|
|
112
|
-
} catch (error) {
|
|
113
|
-
if (error.code === 'LayerNotFound' || error.statusCode === 404) {
|
|
114
|
-
console.log(`Region ${region}: Layer not found, treating as version 0`);
|
|
115
|
-
return 0;
|
|
116
|
-
}
|
|
117
|
-
console.error(`Region ${region}: Failed to get layer versions:`, error.message);
|
|
118
|
-
if (error.data && error.data['Recommend']) {
|
|
119
|
-
console.error(`Recommend: ${error.data['Recommend']}`);
|
|
120
|
-
}
|
|
121
|
-
throw error;
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
// Publish a layer version
|
|
126
|
-
const publishLayerVersion = async (client, layerName, base64Content, region) => {
|
|
127
|
-
try {
|
|
128
|
-
const request = {
|
|
129
|
-
compatibleRuntime: config.runtimes,
|
|
130
|
-
code: { zipFile: base64Content },
|
|
131
|
-
license: 'Apache-2.0',
|
|
132
|
-
description: 'Bootstrap SDK for ServerlessInsight',
|
|
133
|
-
};
|
|
134
|
-
const runtime = new Util.RuntimeOptions({
|
|
135
|
-
readTimeout: 60000, // 60 seconds for large layer uploads
|
|
136
|
-
connectTimeout: 10000, // 10 seconds connection timeout
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
await client.createLayerVersion(layerName, request, {}, runtime);
|
|
140
|
-
console.log(`Region ${region}: Layer version published successfully`);
|
|
141
|
-
} catch (error) {
|
|
142
|
-
console.error(`Region ${region}: Failed to publish layer version:`, error.message);
|
|
143
|
-
if (error.data && error.data['Recommend']) {
|
|
144
|
-
console.error(`Recommend: ${error.data['Recommend']}`);
|
|
145
|
-
}
|
|
146
|
-
throw error;
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
// Delay helper
|
|
151
|
-
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
152
|
-
|
|
153
|
-
// Main publish flow
|
|
154
|
-
const publish = async () => {
|
|
155
|
-
console.log('Starting layer publication');
|
|
156
|
-
console.log(`Layer: ${config.layerName}`);
|
|
157
|
-
console.log(`Regions: ${config.regions.join(', ')}`);
|
|
158
|
-
console.log(`Runtimes: ${config.runtimes.join(', ')}`);
|
|
159
|
-
|
|
160
|
-
// Read and encode artifact
|
|
161
|
-
console.log(`Reading artifact: ${artifactPath}`);
|
|
162
|
-
const zipContent = fs.readFileSync(artifactPath);
|
|
163
|
-
const base64Content = zipContent.toString('base64');
|
|
164
|
-
console.log(
|
|
165
|
-
`Artifact encoded (${zipContent.length} bytes -> ${base64Content.length} base64 chars)`,
|
|
166
|
-
);
|
|
167
|
-
|
|
168
|
-
// Step 1: Get current versions for all regions
|
|
169
|
-
console.log('\nStep 1: Checking current versions across regions...');
|
|
170
|
-
const currentVersions = new Map();
|
|
171
|
-
let maxVersion = 0;
|
|
172
|
-
|
|
173
|
-
for (const region of config.regions) {
|
|
174
|
-
const client = createFCClient(region);
|
|
175
|
-
const version = await getLatestLayerVersion(client, config.layerName, region);
|
|
176
|
-
currentVersions.set(region, version);
|
|
177
|
-
console.log(`Region ${region}: version ${version}`);
|
|
178
|
-
|
|
179
|
-
if (version > maxVersion) {
|
|
180
|
-
maxVersion = version;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
console.log(`\nMaximum version across all regions: ${maxVersion}`);
|
|
185
|
-
|
|
186
|
-
// Step 2: Publish to all regions and align versions
|
|
187
|
-
console.log('\nStep 2: Publishing and aligning versions...');
|
|
188
|
-
const targetVersion = maxVersion + 1;
|
|
189
|
-
|
|
190
|
-
for (const region of config.regions) {
|
|
191
|
-
const currentVersion = currentVersions.get(region) || 0;
|
|
192
|
-
const versionsToAdd = targetVersion - currentVersion;
|
|
193
|
-
|
|
194
|
-
console.log(`\nRegion ${region}: current=${currentVersion}, target=${targetVersion}`);
|
|
195
|
-
|
|
196
|
-
if (versionsToAdd === 0) {
|
|
197
|
-
console.log(`Region ${region}: Already at target version, skipping`);
|
|
198
|
-
continue;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
const client = createFCClient(region);
|
|
202
|
-
|
|
203
|
-
for (let i = 1; i <= versionsToAdd; i++) {
|
|
204
|
-
console.log(
|
|
205
|
-
`Publishing version ${currentVersion + i} to ${region} (attempt ${i}/${versionsToAdd})`,
|
|
206
|
-
);
|
|
207
|
-
await publishLayerVersion(client, config.layerName, base64Content, region);
|
|
208
|
-
|
|
209
|
-
if (i < versionsToAdd) {
|
|
210
|
-
await sleep(config.delay);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// Step 3: Verify all regions are aligned
|
|
216
|
-
console.log('\nStep 3: Verifying version alignment...');
|
|
217
|
-
let finalVersion = 0;
|
|
218
|
-
const mismatches = [];
|
|
219
|
-
|
|
220
|
-
for (const region of config.regions) {
|
|
221
|
-
const client = createFCClient(region);
|
|
222
|
-
const version = await getLatestLayerVersion(client, config.layerName, region);
|
|
223
|
-
console.log(`Region ${region}: final version ${version}`);
|
|
224
|
-
|
|
225
|
-
if (finalVersion === 0) {
|
|
226
|
-
finalVersion = version;
|
|
227
|
-
} else if (version !== finalVersion) {
|
|
228
|
-
mismatches.push(`${region}:${version}`);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
if (mismatches.length > 0) {
|
|
233
|
-
console.warn(
|
|
234
|
-
`Warning: Version mismatch detected! Mismatches: ${mismatches.join(', ')}, expected: ${finalVersion}`,
|
|
235
|
-
);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
console.log(`\nAll regions published and aligned to version: ${finalVersion}`);
|
|
239
|
-
|
|
240
|
-
// Output for GitHub Actions
|
|
241
|
-
if (process.env.GITHUB_OUTPUT) {
|
|
242
|
-
fs.appendFileSync(process.env.GITHUB_OUTPUT, `LAYER_VERSION=${finalVersion}\n`);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
return finalVersion;
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
// Run
|
|
249
|
-
publish()
|
|
250
|
-
.then((version) => {
|
|
251
|
-
console.log(`\nSuccess! Layer version: ${version}`);
|
|
252
|
-
process.exit(0);
|
|
253
|
-
})
|
|
254
|
-
.catch((error) => {
|
|
255
|
-
console.error('\nPublish failed:', error.message);
|
|
256
|
-
process.exit(1);
|
|
257
|
-
});
|