Skip to content

Commit 04187ca

Browse files
committed
fix: adding starterProjects attributes
Signed-off-by: Oleksii Orel <oorel@redhat.com>
1 parent c0c8ebc commit 04187ca

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/generate.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,12 @@ export class Generate {
125125

126126
// if the devfile has a starter project, we use it for the devWorkspace
127127
if (devfileCopy.starterProjects && devfileCopy.starterProjects.length > 0) {
128-
devWorkspace.spec.template.attributes = {
129-
'controller.devfile.io/use-starter-project': devfileCopy.starterProjects[0].name,
130-
};
128+
if (devWorkspace.spec.template.attributes === undefined) {
129+
devWorkspace.spec.template.attributes = {};
130+
}
131+
const starterProjectName = devfileCopy.starterProjects[0].name;
132+
// add starter projects to the devWorkspace
133+
devWorkspace.spec.template.attributes['controller.devfile.io/use-starter-project'] = starterProjectName;
131134
}
132135

133136
// for now the list of devWorkspace templates is only the editor template

tests/generate.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ metadata:
9494
schemaVersion: 2.2.0
9595
metadata:
9696
name: starter-project
97+
attributes:
98+
controller.devfile.io/storage-type: ephemeral
9799
starterProjects:
98100
- name: go-starter
99101
description: A Go project
@@ -130,6 +132,7 @@ metadata:
130132
routingClass: 'che',
131133
template: {
132134
attributes: {
135+
'controller.devfile.io/storage-type': 'ephemeral',
133136
'controller.devfile.io/use-starter-project': 'go-starter',
134137
},
135138
starterProjects: [

0 commit comments

Comments
 (0)