Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pkg/apis/resource/v1alpha1/storage/artifact_pvc.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ func (p *ArtifactPVC) GetCopyFromStorageToSteps(name, sourcePath, destinationPat
Name: names.SimpleNameGenerator.RestrictLengthWithRandomSuffix(fmt.Sprintf("source-copy-%s", name)),
Image: p.ShellImage,
Command: []string{"cp", "-r", fmt.Sprintf("%s/.", sourcePath), destinationPath},
Env: []corev1.EnvVar{{
Name: "TEKTON_RESOURCE_NAME",
Value: name,
}},
}}}
}

Expand All @@ -69,6 +73,10 @@ func (p *ArtifactPVC) GetCopyToStorageFromSteps(name, sourcePath, destinationPat
Image: p.ShellImage,
Command: []string{"cp", "-r", fmt.Sprintf("%s/.", sourcePath), destinationPath},
VolumeMounts: []corev1.VolumeMount{GetPvcMount(p.Name)},
Env: []corev1.EnvVar{{
Name: "TEKTON_RESOURCE_NAME",
Value: name,
}},
}}}
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/resource/v1alpha1/storage/artifact_pvc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func TestPVCGetCopyFromContainerSpec(t *testing.T) {
Image: "busybox",

Command: []string{"cp", "-r", "src-path/.", "/workspace/destination"},
Env: []corev1.EnvVar{{Name: "TEKTON_RESOURCE_NAME", Value: "workspace"}},
}}}

got := pvc.GetCopyFromStorageToSteps("workspace", "src-path", "/workspace/destination")
Expand All @@ -65,6 +66,7 @@ func TestPVCGetCopyToContainerSpec(t *testing.T) {
Image: "busybox",
Command: []string{"cp", "-r", "src-path/.", "/workspace/destination"},
VolumeMounts: []corev1.VolumeMount{{MountPath: "/pvc", Name: "pipelinerun-pvc"}},
Env: []corev1.EnvVar{{Name: "TEKTON_RESOURCE_NAME", Value: "workspace"}},
}}}

got := pvc.GetCopyToStorageFromSteps("workspace", "src-path", "/workspace/destination")
Expand Down
2 changes: 2 additions & 0 deletions pkg/reconciler/taskrun/resources/input_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ func TestAddInputResourceToTask(t *testing.T) {
Image: "busybox",
Command: []string{"cp", "-r", "prev-task-path/.", "/workspace/gitspace"},
VolumeMounts: []corev1.VolumeMount{{MountPath: "/pvc", Name: "pipelinerun-pvc"}},
Env: []corev1.EnvVar{{Name: "TEKTON_RESOURCE_NAME", Value: "gitspace"}},
}}},
Volumes: []corev1.Volume{{
Name: "pipelinerun-pvc",
Expand Down Expand Up @@ -727,6 +728,7 @@ gsutil cp gs://fake-bucket/rules.zip /workspace/gcs-dir
Image: "busybox",
Command: []string{"cp", "-r", "prev-task-path/.", "/workspace/gcs-dir"},
VolumeMounts: []corev1.VolumeMount{{MountPath: "/pvc", Name: "pipelinerun-pvc"}},
Env: []corev1.EnvVar{{Name: "TEKTON_RESOURCE_NAME", Value: "workspace"}},
}}},
Volumes: []corev1.Volume{{
Name: "pipelinerun-pvc",
Expand Down
5 changes: 4 additions & 1 deletion pkg/reconciler/taskrun/resources/output_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ func TestValidOutputResources(t *testing.T) {
Name: "pipelinerun-pvc",
MountPath: "/pvc",
}},
Env: []corev1.EnvVar{{Name: "TEKTON_RESOURCE_NAME", Value: "source-git"}},
}}},
wantVolumes: []corev1.Volume{
{
Expand Down Expand Up @@ -311,6 +312,7 @@ func TestValidOutputResources(t *testing.T) {
Name: "pipelinerun-pvc",
MountPath: "/pvc",
}},
Env: []corev1.EnvVar{{Name: "TEKTON_RESOURCE_NAME", Value: "source-git"}},
}}},
wantVolumes: []corev1.Volume{
{
Expand Down Expand Up @@ -483,6 +485,7 @@ func TestValidOutputResources(t *testing.T) {
Image: "busybox",
Command: []string{"cp", "-r", "/workspace/output/source-workspace/.", "pipeline-task-path"},
VolumeMounts: []corev1.VolumeMount{{Name: "pipelinerun-parent-pvc", MountPath: "/pvc"}},
Env: []corev1.EnvVar{{Name: "TEKTON_RESOURCE_NAME", Value: "source-gcs"}},
}},
{Container: corev1.Container{
Name: "upload-source-gcs-78c5n",
Expand Down Expand Up @@ -573,6 +576,7 @@ func TestValidOutputResources(t *testing.T) {
Image: "busybox",
Command: []string{"cp", "-r", "/workspace/output/source-workspace/.", "pipeline-task-path"},
VolumeMounts: []corev1.VolumeMount{{Name: "pipelinerun-pvc", MountPath: "/pvc"}},
Env: []corev1.EnvVar{{Name: "TEKTON_RESOURCE_NAME", Value: "source-gcs"}},
}},
{Container: corev1.Container{
Name: "upload-source-gcs-78c5n",
Expand Down Expand Up @@ -1471,7 +1475,6 @@ func TestInputOutputBucketResources(t *testing.T) {
VolumeMounts: nil,
Command: []string{"gsutil"},
Args: []string{"rsync", "-d", "-r", "/workspace/output/source-workspace", "gs://some-bucket"},
Env: nil,
}},
},
wantVolumes: []corev1.Volume{{
Expand Down