MCPcopy Index your code
hub / github.com/rilldata/rill / createProjectFlow

Function createProjectFlow

cli/cmd/project/connect_github.go:484–514  ·  view source on GitHub ↗
(ctx context.Context, ch *cmdutil.Helper, req *adminv1.CreateProjectRequest)

Source from the content-addressed store, hash-verified

482}
483
484func createProjectFlow(ctx context.Context, ch *cmdutil.Helper, req *adminv1.CreateProjectRequest) (*adminv1.CreateProjectResponse, error) {
485 // Get the admin client
486 c, err := ch.Client()
487 if err != nil {
488 return nil, err
489 }
490
491 // Create the project (automatically deploys primary branch)
492 res, err := c.CreateProject(ctx, req)
493 if err != nil {
494 if !errMsgContains(err, "a project with that name already exists in the org") {
495 return nil, err
496 }
497 if !ch.Interactive {
498 return nil, fmt.Errorf("a project with the name %q already exists in the org %q. Please provide a different name using the --name flag and try again", req.Project, req.Org)
499 }
500
501 ch.PrintfWarn("Rill project names are derived from your Github repository name.\n")
502 ch.PrintfWarn("The %q project already exists under org %q. Please enter a different name.\n", req.Project, req.Org)
503
504 // project name already exists, prompt for project name and create project with new name again
505 name, err := projectNamePrompt(ctx, ch, req.Org)
506 if err != nil {
507 return nil, err
508 }
509
510 req.Project = name
511 return c.CreateProject(ctx, req)
512 }
513 return res, err
514}
515
516func repoInSyncFlow(ch *cmdutil.Helper, gitPath, subpath, remoteName string) (bool, error) {
517 st, err := gitutil.RunGitStatus(gitPath, subpath, remoteName, "")

Callers 1

ConnectGithubFlowFunction · 0.85

Calls 6

errMsgContainsFunction · 0.85
projectNamePromptFunction · 0.85
PrintfWarnMethod · 0.80
CreateProjectMethod · 0.65
ErrorfMethod · 0.65
ClientMethod · 0.45

Tested by

no test coverage detected