MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / runDeploy

Function runDeploy

packages/cli/src/commands/cloudrun.ts:293–392  ·  view source on GitHub ↗
(args: Record<string, unknown>)

Source from the content-addressed store, hash-verified

291
292// fallow-ignore-next-line complexity
293function runDeploy(args: Record<string, unknown>): void {
294 const project = args.project as string | undefined;
295 if (!project) {
296 console.error("[cloudrun deploy] --project <gcp-project-id> is required.");
297 process.exit(1);
298 }
299 const region = (args.region as string | undefined) ?? "us-central1";
300 const repo = (args.repo as string | undefined) ?? "hyperframes";
301 const tfDir = terraformDir();
302 const repoRoot = findRepoRoot(tfDir);
303
304 console.log(`→ Enabling required APIs on ${project}`);
305 run("gcloud", [
306 "services",
307 "enable",
308 "run.googleapis.com",
309 "workflows.googleapis.com",
310 "workflowexecutions.googleapis.com",
311 "artifactregistry.googleapis.com",
312 "cloudbuild.googleapis.com",
313 "monitoring.googleapis.com",
314 "--project",
315 project,
316 ]);
317
318 let image = args.image as string | undefined;
319 if (!image) {
320 if (!repoRoot) {
321 console.error(
322 "[cloudrun deploy] --image is required when not running from a hyperframes checkout (no Dockerfile context found).",
323 );
324 process.exit(1);
325 }
326 // Ensure the Artifact Registry repo exists.
327 const exists =
328 spawnSync("gcloud", [
329 "artifacts",
330 "repositories",
331 "describe",
332 repo,
333 "--location",
334 region,
335 "--project",
336 project,
337 ]).status === 0;
338 if (!exists) {
339 run("gcloud", [
340 "artifacts",
341 "repositories",
342 "create",
343 repo,
344 "--repository-format",
345 "docker",
346 "--location",
347 region,
348 "--project",
349 project,
350 ]);

Callers 2

runFunction · 0.70
runFunction · 0.70

Calls 8

terraformDirFunction · 0.85
findRepoRootFunction · 0.85
writeCloudBuildConfigFunction · 0.85
machineVarsFunction · 0.85
captureFunction · 0.85
writeStateFunction · 0.85
errorMethod · 0.80
runFunction · 0.70

Tested by

no test coverage detected