sst 2.23.0 → 2.23.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.
- package/bootstrap.d.ts +1 -1
- package/bootstrap.js +26 -9
- package/package.json +1 -1
- package/project.d.ts +1 -1
- package/sst.mjs +24 -11
package/bootstrap.d.ts
CHANGED
package/bootstrap.js
CHANGED
|
@@ -37,9 +37,13 @@ export const useBootstrap = Context.memo(async () => {
|
|
|
37
37
|
: "Updating bootstrap stack").start();
|
|
38
38
|
if (needToBootstrapCDK) {
|
|
39
39
|
await bootstrapCDK();
|
|
40
|
+
// fetch bootstrap status
|
|
41
|
+
cdkStatus = await loadCDKStatus();
|
|
42
|
+
if (cdkStatus.status !== "ready")
|
|
43
|
+
throw new VisibleError("Failed to load bootstrap stack status");
|
|
40
44
|
}
|
|
41
45
|
if (needToBootstrapSST) {
|
|
42
|
-
await bootstrapSST();
|
|
46
|
+
await bootstrapSST(cdkStatus.bucket);
|
|
43
47
|
// fetch bootstrap status
|
|
44
48
|
sstStatus = await loadSSTStatus();
|
|
45
49
|
if (sstStatus.status !== "ready")
|
|
@@ -60,18 +64,31 @@ async function loadCDKStatus() {
|
|
|
60
64
|
if (!stacks || stacks.length === 0)
|
|
61
65
|
return { status: "bootstrap" };
|
|
62
66
|
// Check CDK bootstrap stack deployed successfully
|
|
63
|
-
if (![
|
|
67
|
+
if (![
|
|
68
|
+
"CREATE_COMPLETE",
|
|
69
|
+
"UPDATE_COMPLETE",
|
|
70
|
+
"UPDATE_ROLLBACK_COMPLETE",
|
|
71
|
+
].includes(stacks[0].StackStatus)) {
|
|
64
72
|
return { status: "bootstrap" };
|
|
65
73
|
}
|
|
66
74
|
// Check CDK bootstrap stack is up to date
|
|
67
75
|
// note: there is no a programmatical way to get the minimal required version
|
|
68
76
|
// of CDK bootstrap stack. We are going to hardcode it to 14 for now,
|
|
69
77
|
// which is the latest version as of CDK v2.62.2
|
|
70
|
-
|
|
71
|
-
|
|
78
|
+
let version;
|
|
79
|
+
let bucket;
|
|
80
|
+
const output = stacks[0].Outputs?.forEach((o) => {
|
|
81
|
+
if (o.OutputKey === "BootstrapVersion") {
|
|
82
|
+
version = parseInt(o.OutputValue);
|
|
83
|
+
}
|
|
84
|
+
else if (o.OutputKey === "BucketName") {
|
|
85
|
+
bucket = o.OutputValue;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
if (!version || version < 14 || !bucket) {
|
|
72
89
|
return { status: "update" };
|
|
73
90
|
}
|
|
74
|
-
return { status: "ready" };
|
|
91
|
+
return { status: "ready", version, bucket };
|
|
75
92
|
}
|
|
76
93
|
catch (e) {
|
|
77
94
|
if (e.name === "ValidationError" &&
|
|
@@ -133,7 +150,7 @@ async function loadSSTStatus() {
|
|
|
133
150
|
}
|
|
134
151
|
return { status: "ready", version, bucket };
|
|
135
152
|
}
|
|
136
|
-
export async function bootstrapSST() {
|
|
153
|
+
export async function bootstrapSST(cdkBucket) {
|
|
137
154
|
const { region, bootstrap, cdk } = useProject().config;
|
|
138
155
|
// Create bootstrap stack
|
|
139
156
|
const app = new App();
|
|
@@ -157,10 +174,10 @@ export async function bootstrapSST() {
|
|
|
157
174
|
Tags.of(app).add(key, value);
|
|
158
175
|
}
|
|
159
176
|
// Create S3 bucket to store stacks metadata
|
|
160
|
-
const bucket = bootstrap?.
|
|
177
|
+
const bucket = bootstrap?.useCdkBucket
|
|
161
178
|
? {
|
|
162
|
-
bucketName:
|
|
163
|
-
bucketArn: `arn:${stack.partition}:s3:::${
|
|
179
|
+
bucketName: cdkBucket,
|
|
180
|
+
bucketArn: `arn:${stack.partition}:s3:::${cdkBucket}`,
|
|
164
181
|
}
|
|
165
182
|
: new Bucket(stack, region, {
|
|
166
183
|
encryption: BucketEncryption.S3_MANAGED,
|
package/package.json
CHANGED
package/project.d.ts
CHANGED
package/sst.mjs
CHANGED
|
@@ -5888,16 +5888,26 @@ async function loadCDKStatus() {
|
|
|
5888
5888
|
);
|
|
5889
5889
|
if (!stacks || stacks.length === 0)
|
|
5890
5890
|
return { status: "bootstrap" };
|
|
5891
|
-
if (![
|
|
5891
|
+
if (![
|
|
5892
|
+
"CREATE_COMPLETE",
|
|
5893
|
+
"UPDATE_COMPLETE",
|
|
5894
|
+
"UPDATE_ROLLBACK_COMPLETE"
|
|
5895
|
+
].includes(stacks[0].StackStatus)) {
|
|
5892
5896
|
return { status: "bootstrap" };
|
|
5893
5897
|
}
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
)
|
|
5897
|
-
|
|
5898
|
+
let version2;
|
|
5899
|
+
let bucket;
|
|
5900
|
+
const output = stacks[0].Outputs?.forEach((o) => {
|
|
5901
|
+
if (o.OutputKey === "BootstrapVersion") {
|
|
5902
|
+
version2 = parseInt(o.OutputValue);
|
|
5903
|
+
} else if (o.OutputKey === "BucketName") {
|
|
5904
|
+
bucket = o.OutputValue;
|
|
5905
|
+
}
|
|
5906
|
+
});
|
|
5907
|
+
if (!version2 || version2 < 14 || !bucket) {
|
|
5898
5908
|
return { status: "update" };
|
|
5899
5909
|
}
|
|
5900
|
-
return { status: "ready" };
|
|
5910
|
+
return { status: "ready", version: version2, bucket };
|
|
5901
5911
|
} catch (e) {
|
|
5902
5912
|
if (e.name === "ValidationError" && e.message === `Stack with id ${stackName} does not exist`) {
|
|
5903
5913
|
return { status: "bootstrap" };
|
|
@@ -5946,7 +5956,7 @@ async function loadSSTStatus() {
|
|
|
5946
5956
|
}
|
|
5947
5957
|
return { status: "ready", version: version2, bucket };
|
|
5948
5958
|
}
|
|
5949
|
-
async function bootstrapSST() {
|
|
5959
|
+
async function bootstrapSST(cdkBucket) {
|
|
5950
5960
|
const { region, bootstrap: bootstrap2, cdk } = useProject().config;
|
|
5951
5961
|
const app = new App();
|
|
5952
5962
|
const stackName = bootstrap2?.stackName || SST_STACK_NAME;
|
|
@@ -5967,9 +5977,9 @@ async function bootstrapSST() {
|
|
|
5967
5977
|
for (const [key, value] of Object.entries(bootstrap2?.tags || {})) {
|
|
5968
5978
|
Tags.of(app).add(key, value);
|
|
5969
5979
|
}
|
|
5970
|
-
const bucket = bootstrap2?.
|
|
5971
|
-
bucketName:
|
|
5972
|
-
bucketArn: `arn:${stack.partition}:s3:::${
|
|
5980
|
+
const bucket = bootstrap2?.useCdkBucket ? {
|
|
5981
|
+
bucketName: cdkBucket,
|
|
5982
|
+
bucketArn: `arn:${stack.partition}:s3:::${cdkBucket}`
|
|
5973
5983
|
} : new Bucket(stack, region, {
|
|
5974
5984
|
encryption: BucketEncryption.S3_MANAGED,
|
|
5975
5985
|
removalPolicy: RemovalPolicy.DESTROY,
|
|
@@ -6133,9 +6143,12 @@ var init_bootstrap = __esm({
|
|
|
6133
6143
|
).start();
|
|
6134
6144
|
if (needToBootstrapCDK) {
|
|
6135
6145
|
await bootstrapCDK();
|
|
6146
|
+
cdkStatus = await loadCDKStatus();
|
|
6147
|
+
if (cdkStatus.status !== "ready")
|
|
6148
|
+
throw new VisibleError("Failed to load bootstrap stack status");
|
|
6136
6149
|
}
|
|
6137
6150
|
if (needToBootstrapSST) {
|
|
6138
|
-
await bootstrapSST();
|
|
6151
|
+
await bootstrapSST(cdkStatus.bucket);
|
|
6139
6152
|
sstStatus = await loadSSTStatus();
|
|
6140
6153
|
if (sstStatus.status !== "ready")
|
|
6141
6154
|
throw new VisibleError("Failed to load bootstrap stack status");
|