Skip to content

Commit

Permalink
Fix PipelineTask timeout not correctly set 💦
Browse files Browse the repository at this point in the history
Those were missing during in the conversion code. This means any
Pipeline that defines timeout per tasks ends up with the default one
instead of the one set by the user.

Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
  • Loading branch information
vdemeester committed Apr 22, 2020
1 parent c62298b commit f389aa8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pkg/apis/pipeline/v1alpha1/pipeline_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func (source *PipelineTask) ConvertTo(ctx context.Context, sink *v1beta1.Pipelin
sink.Resources = source.Resources
sink.Params = source.Params
sink.Workspaces = source.Workspaces
sink.Timeout = source.Timeout
return nil
}

Expand Down Expand Up @@ -114,5 +115,6 @@ func (sink *PipelineTask) ConvertFrom(ctx context.Context, source v1beta1.Pipeli
sink.Resources = source.Resources
sink.Params = source.Params
sink.Workspaces = source.Workspaces
sink.Timeout = source.Timeout
return nil
}
2 changes: 2 additions & 0 deletions pkg/apis/pipeline/v1alpha1/pipeline_conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package v1alpha1
import (
"context"
"testing"
"time"

"github.com/google/go-cmp/cmp"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
Expand Down Expand Up @@ -100,6 +101,7 @@ func TestPipelineConversion(t *testing.T) {
Name: "w1",
Workspace: "workspace1",
}},
Timeout: &metav1.Duration{Duration: 5 * time.Minute},
}, {
Name: "task2",
TaskSpec: &TaskSpec{TaskSpec: v1beta1.TaskSpec{
Expand Down
2 changes: 1 addition & 1 deletion test/timeout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ func TestPipelineTaskTimeout(t *testing.T) {

t.Logf("Waiting for PipelineRun %s with PipelineTask timeout in namespace %s to fail", pipelineRun.Name, namespace)
if err := WaitForPipelineRunState(c, pipelineRun.Name, timeout, FailedWithReason(resources.ReasonFailed, pipelineRun.Name), "PipelineRunTimedOut"); err != nil {
t.Errorf("Error waiting for PipelineRun %s to finish: %s", pipelineRun.Name, err)
t.Fatalf("Error waiting for PipelineRun %s to finish: %s", pipelineRun.Name, err)
}

t.Logf("Waiting for TaskRun from PipelineRun %s in namespace %s to be timed out", pipelineRun.Name, namespace)
Expand Down

0 comments on commit f389aa8

Please sign in to comment.