@@ -15,7 +15,6 @@ import (
1515
1616const (
1717 interval = 1 * time .Second
18- timeout = 120 * time .Minute
1918)
2019
2120type ConditionAccessorFn func (ca knativeapi.ConditionAccessor ) (bool , error )
@@ -83,11 +82,11 @@ func PipelineRunSucceed(name string) ConditionAccessorFn {
8382 return Succeed (name )
8483}
8584
86- func PollImmediateWithContext (ctx context.Context , fn func () (bool , error )) error {
87- return wait .PollImmediate (interval , timeout , func () (bool , error ) {
85+ func PollImmediateWithContext (ctx context.Context , pollTimeout time. Duration , fn func () (bool , error )) error {
86+ return wait .PollImmediate (interval , pollTimeout , func () (bool , error ) {
8887 select {
8988 case <- ctx .Done ():
90- return true , ctx . Err ( )
89+ return true , fmt . Errorf ( "polling timed out, pipelinerun has exceeded its timeout: %v" , pollTimeout )
9190 default :
9291 }
9392 return fn ()
@@ -101,7 +100,8 @@ func PollImmediateWithContext(ctx context.Context, fn func() (bool, error)) erro
101100func waitForPipelineRunState (ctx context.Context , tektonbeta1 tektonv1beta1client.TektonV1beta1Interface , pr * v1beta1.PipelineRun , polltimeout time.Duration , inState ConditionAccessorFn ) error {
102101 ctx , cancel := context .WithTimeout (ctx , polltimeout )
103102 defer cancel ()
104- return PollImmediateWithContext (ctx , func () (bool , error ) {
103+
104+ return PollImmediateWithContext (ctx , polltimeout , func () (bool , error ) {
105105 r , err := tektonbeta1 .PipelineRuns (pr .Namespace ).Get (ctx , pr .Name , metav1.GetOptions {})
106106 if err != nil {
107107 return true , err
0 commit comments