Skip to content

Commit 1d7c0c3

Browse files
emmaling27Convex, Inc.
authored andcommitted
Add hidden CLI option to specify a partition to provision on (#31128)
GitOrigin-RevId: 0c563b01c2a8995ef9c04a90493fb596cda067f7
1 parent dea9943 commit 1d7c0c3

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

src/cli/configure.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export async function deploymentCredentialsOrConfigure(
7575
url?: string | undefined;
7676
adminKey?: string | undefined;
7777
},
78+
partitionId?: number | undefined,
7879
): Promise<
7980
DeploymentCredentials & {
8081
deploymentName?: DeploymentName;
@@ -90,7 +91,11 @@ export async function deploymentCredentialsOrConfigure(
9091
const { projectSlug, teamSlug } = await selectProject(
9192
ctx,
9293
chosenConfiguration,
93-
{ team: cmdOptions.team, project: cmdOptions.project },
94+
{
95+
team: cmdOptions.team,
96+
project: cmdOptions.project,
97+
partitionId,
98+
},
9499
);
95100
const deploymentOptions: DeploymentOptions = cmdOptions.prod
96101
? { kind: "prod" }
@@ -149,6 +154,7 @@ async function selectProject(
149154
cmdOptions: {
150155
team?: string | undefined;
151156
project?: string | undefined;
157+
partitionId?: number;
152158
},
153159
): Promise<{ teamSlug: string; projectSlug: string }> {
154160
let result:
@@ -280,6 +286,7 @@ async function selectNewProject(
280286
config: {
281287
team?: string | undefined;
282288
project?: string | undefined;
289+
partitionId?: number | undefined;
283290
},
284291
) {
285292
const { teamSlug: selectedTeam, chosen: didChooseBetweenTeams } =
@@ -299,6 +306,7 @@ async function selectNewProject(
299306
({ projectSlug, teamSlug, projectsRemaining } = await createProject(ctx, {
300307
teamSlug: selectedTeam,
301308
projectName,
309+
partitionId: config.partitionId,
302310
}));
303311
} catch (err) {
304312
logFailure(ctx, "Unable to create project.");

src/cli/dev.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ export const dev = new Command("dev")
125125
.addOption(new Option("--local-backend-version <version>").hideHelp())
126126
.addOption(new Option("--local-force-upgrade").default(false).hideHelp())
127127
.addOption(new Option("--live-component-sources").hideHelp())
128+
.addOption(new Option("--partition-id <id>").hideHelp())
128129
.showHelpAfterError()
129130
.action(async (cmdOptions) => {
130131
const ctx = oneoffContext();
@@ -194,12 +195,20 @@ export const dev = new Command("dev")
194195
}
195196
}
196197

198+
const partitionId = cmdOptions.partitionId
199+
? parseInt(cmdOptions.partitionId)
200+
: undefined;
197201
const configure =
198202
cmdOptions.configure === true ? "ask" : cmdOptions.configure ?? null;
199-
const credentials = await deploymentCredentialsOrConfigure(ctx, configure, {
200-
...cmdOptions,
201-
localOptions,
202-
});
203+
const credentials = await deploymentCredentialsOrConfigure(
204+
ctx,
205+
configure,
206+
{
207+
...cmdOptions,
208+
localOptions,
209+
},
210+
partitionId,
211+
);
203212

204213
await usageStateWarning(ctx);
205214

src/cli/lib/api.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ export async function createProject(
3636
{
3737
teamSlug: selectedTeamSlug,
3838
projectName,
39-
}: { teamSlug: string; projectName: string },
39+
partitionId,
40+
}: { teamSlug: string; projectName: string; partitionId?: number },
4041
): Promise<{
4142
projectSlug: string;
4243
teamSlug: string;
@@ -49,6 +50,7 @@ export async function createProject(
4950
// to provisioning prod on creation.
5051
deploymentType: "dev",
5152
backendVersionOverride: process.env.CONVEX_BACKEND_VERSION_OVERRIDE,
53+
partitionId,
5254
};
5355
const data = await bigBrainAPI({
5456
ctx,

0 commit comments

Comments
 (0)