Skip to content

Commit fa6e55c

Browse files
emmaling27Convex, Inc.
authored andcommitted
Add --partition-id flag to deploy (#31431)
GitOrigin-RevId: 2863fd190b37b34c2aad91be4a313065ae7bbf78
1 parent 393d25d commit fa6e55c

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

src/cli/configure.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export async function deploymentCredentialsOrConfigure(
110110
teamSlug,
111111
projectSlug,
112112
deploymentOptions,
113+
partitionId,
113114
});
114115
await updateEnvAndConfigForDeploymentSelection(ctx, {
115116
url,
@@ -423,6 +424,7 @@ async function ensureDeploymentProvisioned(
423424
teamSlug: string;
424425
projectSlug: string;
425426
deploymentOptions: DeploymentOptions;
427+
partitionId: number | undefined;
426428
},
427429
): Promise<DeploymentDetails> {
428430
switch (options.deploymentOptions.kind) {
@@ -433,6 +435,7 @@ async function ensureDeploymentProvisioned(
433435
ctx,
434436
{ teamSlug: options.teamSlug, projectSlug: options.projectSlug },
435437
options.deploymentOptions.kind,
438+
options.partitionId,
436439
);
437440
return {
438441
...credentials,

src/cli/deploy.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export const deploy = new Command("deploy")
118118
.conflicts("preview-create"),
119119
)
120120
.addOption(new Option("--live-component-sources").hideHelp())
121+
.addOption(new Option("--partition-id <id>").hideHelp())
121122
.showHelpAfterError()
122123
.action(async (cmdOptions) => {
123124
const ctx = oneoffContext();
@@ -284,6 +285,7 @@ async function deployToExistingDeployment(
284285
url?: string | undefined;
285286
writePushRequest?: string | undefined;
286287
liveComponentSources?: boolean | undefined;
288+
partitionId?: string | undefined;
287289
},
288290
) {
289291
const deploymentSelection = deploymentSelectionFromOptions({

src/cli/lib/api.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export type DeploymentSelection =
132132
| { kind: "deployKey" }
133133
| { kind: "previewName"; previewName: string }
134134
| { kind: "deploymentName"; deploymentName: string }
135-
| { kind: "ownProd" }
135+
| { kind: "ownProd"; partitionId?: number | undefined }
136136
| { kind: "ownDev" }
137137
| { kind: "urlWithAdminKey"; url: string; adminKey: string }
138138
| { kind: "urlWithLogin"; url: string };
@@ -154,6 +154,7 @@ export type DeploymentSelectionOptions = {
154154
deploymentName?: string | undefined;
155155
url?: string | undefined;
156156
adminKey?: string | undefined;
157+
partitionId?: string | undefined;
157158
};
158159

159160
export function deploymentSelectionFromOptions(
@@ -176,7 +177,13 @@ export function deploymentSelectionFromOptions(
176177
if (adminKey !== undefined) {
177178
return { kind: "deployKey" };
178179
}
179-
return { kind: options.prod === true ? "ownProd" : "ownDev" };
180+
const partitionId = options.partitionId
181+
? parseInt(options.partitionId)
182+
: undefined;
183+
return {
184+
kind: options.prod === true ? "ownProd" : "ownDev",
185+
partitionId,
186+
};
180187
}
181188

182189
// Deploy
@@ -342,6 +349,7 @@ async function fetchDeploymentCredentialsWithinCurrentProjectInner(
342349
url: "deployment/authorize_prod",
343350
data: {
344351
deploymentName: configuredDeployment,
352+
partitionId: deploymentSelection.partitionId,
345353
},
346354
});
347355
case "previewName":
@@ -514,6 +522,7 @@ export async function fetchDeploymentCredentialsProvisioningDevOrProdMaybeThrows
514522
ctx: Context,
515523
{ teamSlug, projectSlug }: { teamSlug: string; projectSlug: string },
516524
deploymentType: DeploymentType,
525+
partitionId: number | undefined,
517526
): Promise<{
518527
deploymentName: string;
519528
deploymentUrl: string;
@@ -527,6 +536,7 @@ export async function fetchDeploymentCredentialsProvisioningDevOrProdMaybeThrows
527536
teamSlug,
528537
projectSlug,
529538
deploymentType,
539+
partitionId,
530540
},
531541
});
532542
const deploymentName = data.deploymentName;

0 commit comments

Comments
 (0)