Skip to content

Commit

Permalink
Only copy certain output resource to intermediate storage
Browse files Browse the repository at this point in the history
Accidentally in Pr tektoncd#442 I
introduced the bug for processing image resource. Added test this time
to catch this. Hopefully this should not surface again
  • Loading branch information
Shash Reddy committed Feb 6, 2019
1 parent 284f0be commit f79cd1d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func AddOutputResources(
}
}

if taskRun.HasPipelineRunOwnerReference() {
if allowedOutputResources[resource.Spec.Type] && taskRun.HasPipelineRunOwnerReference() {
var newSteps []corev1.Container
for _, dPath := range boundResource.Paths {
containers := as.GetCopyToContainerSpec(resource.GetName(), sourcePath, dPath)
Expand Down
41 changes: 41 additions & 0 deletions pkg/reconciler/v1alpha1/taskrun/resources/output_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,47 @@ func Test_Valid_OutputResources(t *testing.T) {
}},
}},
build: build(),
}, {
name: "image resource in output with pipelinerun with owner",
desc: "image resource declared as output with pipelinerun owner reference should not generate any steps",
taskRun: &v1alpha1.TaskRun{
ObjectMeta: metav1.ObjectMeta{
Name: "test-taskrun-run-output-steps",
Namespace: "marshmallow",
OwnerReferences: []metav1.OwnerReference{{
Kind: "PipelineRun",
Name: "pipelinerun",
}},
},
Spec: v1alpha1.TaskRunSpec{
Outputs: v1alpha1.TaskRunOutputs{
Resources: []v1alpha1.TaskResourceBinding{{
Name: "source-workspace",
ResourceRef: v1alpha1.PipelineResourceRef{
Name: "source-image",
},
Paths: []string{"pipeline-task-name"},
}},
},
},
},
task: &v1alpha1.Task{
ObjectMeta: metav1.ObjectMeta{
Name: "task1",
Namespace: "marshmallow",
},
Spec: v1alpha1.TaskSpec{
Outputs: &v1alpha1.Outputs{
Resources: []v1alpha1.TaskResource{{
Name: "source-workspace",
Type: "image",
}},
},
},
},
wantSteps: nil,
wantVolumes: nil,
build: build(),
}, {
name: "git resource in output",
desc: "git resource declared in output without pipelinerun owner reference",
Expand Down

0 comments on commit f79cd1d

Please sign in to comment.