Skip to content

Commit 64f49c7

Browse files
committed
use sourcevalue
Signed-off-by: Horiodino <[email protected]>
1 parent 87c44d7 commit 64f49c7

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

pkg/devfile/generator/generators_test.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,6 @@ func TestGetContainers(t *testing.T) {
135135
Name: "PROJECTS_ROOT",
136136
Value: "/projects",
137137
},
138-
{
139-
Name: "PROJECT_SOURCE",
140-
Value: "/projects",
141-
},
142138
{
143139
Name: "PROJECT_SOURCE",
144140
Value: "/projects/test-project",
@@ -1452,7 +1448,6 @@ func TestGetPodTemplateSpec(t *testing.T) {
14521448
Env: []corev1.EnvVar{
14531449
{Name: "PROJECTS_ROOT", Value: "/projects"},
14541450
{Name: "PROJECT_SOURCE", Value: "/projects"},
1455-
{Name: "PROJECT_SOURCE", Value: "/projects"},
14561451
},
14571452
ImagePullPolicy: corev1.PullAlways,
14581453
SecurityContext: &corev1.SecurityContext{
@@ -1465,7 +1460,6 @@ func TestGetPodTemplateSpec(t *testing.T) {
14651460
Env: []corev1.EnvVar{
14661461
{Name: "PROJECTS_ROOT", Value: "/projects"},
14671462
{Name: "PROJECT_SOURCE", Value: "/projects"},
1468-
{Name: "PROJECT_SOURCE", Value: "/projects"},
14691463
},
14701464
ImagePullPolicy: corev1.PullAlways,
14711465
Ports: []corev1.ContainerPort{},
@@ -1518,7 +1512,6 @@ func TestGetPodTemplateSpec(t *testing.T) {
15181512
Env: []corev1.EnvVar{
15191513
{Name: "PROJECTS_ROOT", Value: "/projects"},
15201514
{Name: "PROJECT_SOURCE", Value: "/projects"},
1521-
{Name: "PROJECT_SOURCE", Value: "/projects"},
15221515
},
15231516
ImagePullPolicy: corev1.PullAlways,
15241517
SecurityContext: &corev1.SecurityContext{
@@ -1573,7 +1566,6 @@ func TestGetPodTemplateSpec(t *testing.T) {
15731566
Env: []corev1.EnvVar{
15741567
{Name: "PROJECTS_ROOT", Value: "/projects"},
15751568
{Name: "PROJECT_SOURCE", Value: "/projects"},
1576-
{Name: "PROJECT_SOURCE", Value: "/projects"},
15771569
},
15781570
ImagePullPolicy: corev1.PullAlways,
15791571
SecurityContext: &corev1.SecurityContext{
@@ -1630,7 +1622,6 @@ func TestGetPodTemplateSpec(t *testing.T) {
16301622
Env: []corev1.EnvVar{
16311623
{Name: "PROJECTS_ROOT", Value: "/projects"},
16321624
{Name: "PROJECT_SOURCE", Value: "/projects"},
1633-
{Name: "PROJECT_SOURCE", Value: "/projects"},
16341625
},
16351626
ImagePullPolicy: corev1.PullAlways,
16361627
Ports: []corev1.ContainerPort{},
@@ -1685,7 +1676,6 @@ func TestGetPodTemplateSpec(t *testing.T) {
16851676
Env: []corev1.EnvVar{
16861677
{Name: "PROJECTS_ROOT", Value: "/projects"},
16871678
{Name: "PROJECT_SOURCE", Value: "/projects"},
1688-
{Name: "PROJECT_SOURCE", Value: "/projects"},
16891679
},
16901680
ImagePullPolicy: corev1.PullAlways,
16911681
SecurityContext: &corev1.SecurityContext{
@@ -1752,7 +1742,6 @@ func TestGetPodTemplateSpec(t *testing.T) {
17521742
Env: []corev1.EnvVar{
17531743
{Name: "PROJECTS_ROOT", Value: "/projects"},
17541744
{Name: "PROJECT_SOURCE", Value: "/projects"},
1755-
{Name: "PROJECT_SOURCE", Value: "/projects"},
17561745
},
17571746
ImagePullPolicy: corev1.PullAlways,
17581747
Ports: []corev1.ContainerPort{},
@@ -1822,7 +1811,6 @@ func TestGetPodTemplateSpec(t *testing.T) {
18221811
Env: []corev1.EnvVar{
18231812
{Name: "PROJECTS_ROOT", Value: "/projects"},
18241813
{Name: "PROJECT_SOURCE", Value: "/projects"},
1825-
{Name: "PROJECT_SOURCE", Value: "/projects"},
18261814
},
18271815
ImagePullPolicy: corev1.PullAlways,
18281816
Ports: []corev1.ContainerPort{},
@@ -1886,7 +1874,6 @@ func TestGetPodTemplateSpec(t *testing.T) {
18861874
Env: []corev1.EnvVar{
18871875
{Name: "PROJECTS_ROOT", Value: "/projects"},
18881876
{Name: "PROJECT_SOURCE", Value: "/projects"},
1889-
{Name: "PROJECT_SOURCE", Value: "/projects"},
18901877
},
18911878
ImagePullPolicy: corev1.PullAlways,
18921879
Ports: []corev1.ContainerPort{},
@@ -1949,7 +1936,6 @@ func TestGetPodTemplateSpec(t *testing.T) {
19491936
Env: []corev1.EnvVar{
19501937
{Name: "PROJECTS_ROOT", Value: "/projects"},
19511938
{Name: "PROJECT_SOURCE", Value: "/projects"},
1952-
{Name: "PROJECT_SOURCE", Value: "/projects"},
19531939
},
19541940
ImagePullPolicy: corev1.PullAlways,
19551941
Ports: []corev1.ContainerPort{},

pkg/devfile/generator/utils.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,17 @@ func addSyncRootFolder(container *corev1.Container, sourceMapping string) string
157157
{
158158
Name: EnvProjectsRoot,
159159
Value: syncRootFolder,
160-
}, {
161-
Name: EnvProjectsSrc,
162-
Value: syncRootFolder,
163160
},
164161
}, container.Env...)
165162

163+
if sourceMapping != "" {
164+
container.Env = append(container.Env,
165+
corev1.EnvVar{
166+
Name: EnvProjectsSrc,
167+
Value: sourceMapping,
168+
})
169+
}
170+
166171
return syncRootFolder
167172
}
168173

0 commit comments

Comments
 (0)