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 8689e44
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
24 changes: 10 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,7 @@ func TestGetPodTemplateSpec(t *testing.T) {
Env: []corev1.EnvVar{
{Name: "PROJECTS_ROOT", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
//{Name: "PROJECT_SOURCE", Value: "/projects"},
},
ImagePullPolicy: corev1.PullAlways,
SecurityContext: &corev1.SecurityContext{
Expand All @@ -1465,7 +1461,7 @@ func TestGetPodTemplateSpec(t *testing.T) {
Env: []corev1.EnvVar{
{Name: "PROJECTS_ROOT", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
//{Name: "PROJECT_SOURCE", Value: "/projects"},
},
ImagePullPolicy: corev1.PullAlways,
Ports: []corev1.ContainerPort{},
Expand Down Expand Up @@ -1518,7 +1514,7 @@ func TestGetPodTemplateSpec(t *testing.T) {
Env: []corev1.EnvVar{
{Name: "PROJECTS_ROOT", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
//{Name: "PROJECT_SOURCE", Value: "/projects"},
},
ImagePullPolicy: corev1.PullAlways,
SecurityContext: &corev1.SecurityContext{
Expand Down Expand Up @@ -1573,7 +1569,7 @@ func TestGetPodTemplateSpec(t *testing.T) {
Env: []corev1.EnvVar{
{Name: "PROJECTS_ROOT", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
//{Name: "PROJECT_SOURCE", Value: "/projects"},
},
ImagePullPolicy: corev1.PullAlways,
SecurityContext: &corev1.SecurityContext{
Expand Down Expand Up @@ -1630,7 +1626,7 @@ func TestGetPodTemplateSpec(t *testing.T) {
Env: []corev1.EnvVar{
{Name: "PROJECTS_ROOT", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
//{Name: "PROJECT_SOURCE", Value: "/projects"},
},
ImagePullPolicy: corev1.PullAlways,
Ports: []corev1.ContainerPort{},
Expand Down Expand Up @@ -1685,7 +1681,7 @@ func TestGetPodTemplateSpec(t *testing.T) {
Env: []corev1.EnvVar{
{Name: "PROJECTS_ROOT", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
//{Name: "PROJECT_SOURCE", Value: "/projects"},
},
ImagePullPolicy: corev1.PullAlways,
SecurityContext: &corev1.SecurityContext{
Expand Down Expand Up @@ -1752,7 +1748,7 @@ func TestGetPodTemplateSpec(t *testing.T) {
Env: []corev1.EnvVar{
{Name: "PROJECTS_ROOT", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
//{Name: "PROJECT_SOURCE", Value: "/projects"},
},
ImagePullPolicy: corev1.PullAlways,
Ports: []corev1.ContainerPort{},
Expand Down Expand Up @@ -1822,7 +1818,7 @@ func TestGetPodTemplateSpec(t *testing.T) {
Env: []corev1.EnvVar{
{Name: "PROJECTS_ROOT", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
//{Name: "PROJECT_SOURCE", Value: "/projects"},
},
ImagePullPolicy: corev1.PullAlways,
Ports: []corev1.ContainerPort{},
Expand Down Expand Up @@ -1886,7 +1882,7 @@ func TestGetPodTemplateSpec(t *testing.T) {
Env: []corev1.EnvVar{
{Name: "PROJECTS_ROOT", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
{Name: "PROJECT_SOURCE", Value: "/projects"},
//{Name: "PROJECT_SOURCE", Value: "/projects"},
},
ImagePullPolicy: corev1.PullAlways,
Ports: []corev1.ContainerPort{},
Expand Down Expand Up @@ -1949,7 +1945,7 @@ func TestGetPodTemplateSpec(t *testing.T) {
Env: []corev1.EnvVar{
{Name: "PROJECTS_ROOT", Value: "/projects"},
{Name: "PROJECT_SOURCE", 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 8689e44

Please sign in to comment.