Skip to content

Commit 3e2ef3f

Browse files
committed
[status] Fix PR status when no tasks has run
When no task has started (ie: bad pr spec) we were showing the raw template. The test as well was buggy since we were testing for that raw template 🤮, I am not sure how I came to that point but such is life. We are now showing properly that no tasks has been detecred since PR has not been run. Closes #414 Signed-off-by: Chmouel Boudjnah <[email protected]>
1 parent 1877a63 commit 3e2ef3f

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

pkg/pipelineascode/pipelinesascode_github_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func TestRun(t *testing.T) {
135135
ProviderInfoFromRepo bool
136136
}{
137137
{
138-
name: "pull request/apps",
138+
name: "pull request/fail-to-start-apps",
139139
runevent: info.Event{
140140
SHA: "principale",
141141
Organization: "organizationes",
@@ -148,7 +148,7 @@ func TestRun(t *testing.T) {
148148
},
149149
tektondir: "testdata/pull_request",
150150
finalStatus: "neutral",
151-
finalStatusText: "<th>Status</th><th>Duration</th><th>Name</th>",
151+
finalStatusText: "PipelineRun has failed to start",
152152
},
153153
{
154154
name: "pull request/with webhook",
@@ -295,7 +295,7 @@ func TestRun(t *testing.T) {
295295
},
296296
tektondir: "testdata/max-keep-runs",
297297
finalStatus: "neutral",
298-
finalStatusText: "<th>Status</th><th>Duration</th><th>Name</th>",
298+
finalStatusText: "PipelineRun has failed to start",
299299
expectedNumberofCleanups: 10,
300300
},
301301
}

pkg/sort/task_status.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ func TaskStatusTmpl(pr *tektonv1beta1.PipelineRun, console consoleui.Interface,
4242
outputBuffer := bytes.Buffer{}
4343

4444
if len(pr.Status.TaskRuns) == 0 {
45-
// Nada?
46-
return statusTemplate + "No tasks has been found", nil
45+
return "<b>PipelineRun has failed to start</b><br>", nil
4746
}
4847

4948
for _, taskrunStatus := range pr.Status.TaskRuns {

pkg/sort/task_status_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func TestStatusTmpl(t *testing.T) {
5252
},
5353
{
5454
name: "test sorted status nada",
55-
wantRegexp: regexp.MustCompile("No tasks has been found"),
55+
wantRegexp: regexp.MustCompile("PipelineRun has failed to start"),
5656
pr: tektontest.MakePR("nada", "ns", nil, nil),
5757
},
5858
}

0 commit comments

Comments
 (0)