Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Creating a project from a template does not apply the manifest #501

Open
BenElgar opened this issue Nov 11, 2021 · 1 comment
Open
Labels
bug Something isn't working

Comments

@BenElgar
Copy link
Contributor

When we create a project using one of the templates that templates manifest should be automatically applied upon creation.

There are two reasons this doesn't happen right now:

  1. [BUG] Can't run a single component without running everything #482, which means that we would start all of the components, which isn't what we want.
  2. I'm not clear on how to best get a handle on a workspace from within a kernel function. Specifically, I'm not sure how to get a reference to a relevant Workspace struct from within here:
    func (kern *Kernel) CreateProject(ctx context.Context, input *api.CreateProjectInput) (*api.CreateProjectOutput, error) {
    projectDir := input.Root
    if !filepath.IsAbs(projectDir) {
    return nil, errors.New("path must be absolute")
    }
    var templateDir string
    if input.TemplateURL != nil {
    var err error
    templateDir, err = template.GetTemplateFiles(ctx, *input.TemplateURL)
    if err != nil {
    return nil, fmt.Errorf("getting template files: %w", err)
    }
    }
    if templateDir != "" {
    err := os.Rename(templateDir, projectDir)
    if err != nil {
    if os.IsExist(err) {
    return nil, dirExistsErr
    }
    return nil, fmt.Errorf("moving project dir: %w", err)
    }
    } else {
    if err := os.Mkdir(projectDir, 0750); err != nil {
    if os.IsExist(err) {
    return nil, dirExistsErr
    }
    return nil, fmt.Errorf("making project dir: %w", err)
    }
    }
    result, err := kern.CreateWorkspace(ctx, &api.CreateWorkspaceInput{Root: projectDir})
    if err != nil {
    return nil, fmt.Errorf("creating workspace: %w", err)
    }
    return &api.CreateProjectOutput{WorkspaceID: result.ID}, err
    }
@BenElgar BenElgar added bug Something isn't working needs triage Incoming request that needs to be triaged and prioritized labels Nov 11, 2021
@brandonbloom
Copy link
Member

See also #305

@brandonbloom brandonbloom removed the needs triage Incoming request that needs to be triaged and prioritized label Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants