(ctx context.Context, ch *cmdutil.Helper, req *adminv1.CreateProjectRequest)
| 482 | } |
| 483 | |
| 484 | func 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 | |
| 516 | func repoInSyncFlow(ch *cmdutil.Helper, gitPath, subpath, remoteName string) (bool, error) { |
| 517 | st, err := gitutil.RunGitStatus(gitPath, subpath, remoteName, "") |
no test coverage detected