(workspace *dw.DevWorkspaceTemplateSpec)
| 133 | } |
| 134 | |
| 135 | func GetStarterProject(workspace *dw.DevWorkspaceTemplateSpec) (*dw.StarterProject, error) { |
| 136 | if !workspace.Attributes.Exists(constants.StarterProjectAttribute) { |
| 137 | return nil, nil |
| 138 | } |
| 139 | var err error |
| 140 | selectedStarterProject := workspace.Attributes.GetString(constants.StarterProjectAttribute, &err) |
| 141 | if err != nil { |
| 142 | return nil, fmt.Errorf("failed to read %s attribute on workspace: %w", constants.StarterProjectAttribute, err) |
| 143 | } |
| 144 | for _, starterProject := range workspace.StarterProjects { |
| 145 | if starterProject.Name == selectedStarterProject { |
| 146 | starterProject := starterProject |
| 147 | return &starterProject, nil |
| 148 | } |
| 149 | } |
| 150 | return nil, fmt.Errorf("selected starter project %s not found in workspace starterProjects", selectedStarterProject) |
| 151 | } |
| 152 | |
| 153 | // GetClonePath gets the correct clonePath for a project, given the semantics in devfile/api |
| 154 | func GetClonePath(project *dw.Project) string { |
no test coverage detected