Skip to content

Commit

Permalink
Remove 0s timeout as this is the default but causing failures
Browse files Browse the repository at this point in the history
  • Loading branch information
SaschaSchwarze0 committed Oct 8, 2021
1 parent 7e33efe commit 7d2f69b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/shp/flags/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,7 @@ func SanitizeBuildSpec(b *buildv1alpha1.BuildSpec) {
b.Builder = nil
}
}
if b.Timeout != nil && b.Timeout.Duration == 0 {
b.Timeout = nil
}
}
6 changes: 6 additions & 0 deletions pkg/shp/flags/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ func TestSanitizeBuildSpec(t *testing.T) {
name: "should not clean-up complete objects",
in: completeBuildSpec,
out: completeBuildSpec,
}, {
name: "should clean-up 0s duration",
in: buildv1alpha1.BuildSpec{Timeout: &metav1.Duration{
Duration: time.Duration(0),
}},
out: buildv1alpha1.BuildSpec{Timeout: nil},
}}

for _, tt := range testCases {
Expand Down
3 changes: 3 additions & 0 deletions pkg/shp/flags/buildrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,7 @@ func SanitizeBuildRunSpec(br *buildv1alpha1.BuildRunSpec) {
br.Output = nil
}
}
if br.Timeout != nil && br.Timeout.Duration == 0 {
br.Timeout = nil
}
}
6 changes: 6 additions & 0 deletions pkg/shp/flags/buildrun_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ func TestSanitizeBuildRunSpec(t *testing.T) {
name: "should not clean-up complete objects",
in: completeBuildRunSpec,
out: completeBuildRunSpec,
}, {
name: "should clean-up 0s duration",
in: buildv1alpha1.BuildRunSpec{Timeout: &metav1.Duration{
Duration: time.Duration(0),
}},
out: buildv1alpha1.BuildRunSpec{Timeout: nil},
}}

for _, tt := range testCases {
Expand Down

0 comments on commit 7d2f69b

Please sign in to comment.