Skip to content

Commit

Permalink
use sourcevalue
Browse files Browse the repository at this point in the history
Signed-off-by: Horiodino <[email protected]>
  • Loading branch information
Horiodino committed Aug 12, 2024
1 parent 87c44d7 commit 64f49c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
14 changes: 0 additions & 14 deletions pkg/devfile/generator/generators_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,6 @@ func TestGetContainers(t *testing.T) {
Name: "PROJECTS_ROOT",
Value: "/projects",
},
{
Name: "PROJECT_SOURCE",
Value: "/projects",
},
{
Name: "PROJECT_SOURCE",
Value: "/projects/test-project",
Expand Down Expand Up @@ -1452,7 +1448,6 @@ func TestGetPodTemplateSpec(t *testing.T) {
Env: []corev1.EnvVar{
{Name: "PROJECTS_ROOT", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
},
ImagePullPolicy: corev1.PullAlways,
SecurityContext: &corev1.SecurityContext{
Expand All @@ -1465,7 +1460,6 @@ func TestGetPodTemplateSpec(t *testing.T) {
Env: []corev1.EnvVar{
{Name: "PROJECTS_ROOT", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
},
ImagePullPolicy: corev1.PullAlways,
Ports: []corev1.ContainerPort{},
Expand Down Expand Up @@ -1518,7 +1512,6 @@ func TestGetPodTemplateSpec(t *testing.T) {
Env: []corev1.EnvVar{
{Name: "PROJECTS_ROOT", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
},
ImagePullPolicy: corev1.PullAlways,
SecurityContext: &corev1.SecurityContext{
Expand Down Expand Up @@ -1573,7 +1566,6 @@ func TestGetPodTemplateSpec(t *testing.T) {
Env: []corev1.EnvVar{
{Name: "PROJECTS_ROOT", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
},
ImagePullPolicy: corev1.PullAlways,
SecurityContext: &corev1.SecurityContext{
Expand Down Expand Up @@ -1630,7 +1622,6 @@ func TestGetPodTemplateSpec(t *testing.T) {
Env: []corev1.EnvVar{
{Name: "PROJECTS_ROOT", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
},
ImagePullPolicy: corev1.PullAlways,
Ports: []corev1.ContainerPort{},
Expand Down Expand Up @@ -1685,7 +1676,6 @@ func TestGetPodTemplateSpec(t *testing.T) {
Env: []corev1.EnvVar{
{Name: "PROJECTS_ROOT", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
},
ImagePullPolicy: corev1.PullAlways,
SecurityContext: &corev1.SecurityContext{
Expand Down Expand Up @@ -1752,7 +1742,6 @@ func TestGetPodTemplateSpec(t *testing.T) {
Env: []corev1.EnvVar{
{Name: "PROJECTS_ROOT", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
},
ImagePullPolicy: corev1.PullAlways,
Ports: []corev1.ContainerPort{},
Expand Down Expand Up @@ -1822,7 +1811,6 @@ func TestGetPodTemplateSpec(t *testing.T) {
Env: []corev1.EnvVar{
{Name: "PROJECTS_ROOT", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
},
ImagePullPolicy: corev1.PullAlways,
Ports: []corev1.ContainerPort{},
Expand Down Expand Up @@ -1886,7 +1874,6 @@ func TestGetPodTemplateSpec(t *testing.T) {
Env: []corev1.EnvVar{
{Name: "PROJECTS_ROOT", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
},
ImagePullPolicy: corev1.PullAlways,
Ports: []corev1.ContainerPort{},
Expand Down Expand Up @@ -1949,7 +1936,6 @@ func TestGetPodTemplateSpec(t *testing.T) {
Env: []corev1.EnvVar{
{Name: "PROJECTS_ROOT", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
},
ImagePullPolicy: corev1.PullAlways,
Ports: []corev1.ContainerPort{},
Expand Down
11 changes: 8 additions & 3 deletions pkg/devfile/generator/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,17 @@ func addSyncRootFolder(container *corev1.Container, sourceMapping string) string
{
Name: EnvProjectsRoot,
Value: syncRootFolder,
}, {
Name: EnvProjectsSrc,
Value: syncRootFolder,
},
}, container.Env...)

if sourceMapping != "" {
container.Env = append(container.Env,
corev1.EnvVar{
Name: EnvProjectsSrc,
Value: sourceMapping,
})
}

return syncRootFolder
}

Expand Down

0 comments on commit 64f49c7

Please sign in to comment.