Detail tests with "report"s
Some checks are pending
continuous-integration/drone/push Build is running
Some checks are pending
continuous-integration/drone/push Build is running
This commit is contained in:
parent
e90d55c07e
commit
2ee8901d8c
@ -153,9 +153,26 @@
|
||||
<h4>{trace.title}</h4>
|
||||
<TraceStatus status={trace.status} />
|
||||
</div>
|
||||
<div class="bg-dark text-light px-2 pt-2">
|
||||
<pre class="pb-2">{#each trace.logs as l (l.pos)}{l.out}{/each}</pre>
|
||||
</div>
|
||||
{#if trace.items}
|
||||
<ul class="list-group">
|
||||
{#each trace.items as item}
|
||||
<li class="list-group-item fw-bold">
|
||||
<i
|
||||
class="me-1 bi"
|
||||
class:bi-check-lg={item.status == "success"}
|
||||
class:bi-x-lg={item.status == "failure"}
|
||||
class:bi-question-lg={item.status != "success" && item.status != "failure"}
|
||||
></i>
|
||||
{item.title}
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
{#if trace.logs}
|
||||
<div class="bg-dark text-light px-2 pt-2">
|
||||
<pre class="pb-2">{#each trace.logs as l (l.pos)}{l.out}{/each}</pre>
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
{:catch error}
|
||||
<div class="alert alert-danger">
|
||||
|
38
works.go
38
works.go
@ -374,10 +374,16 @@ func declareAPIAdminWorksRoutes(router *gin.RouterGroup) {
|
||||
})
|
||||
}
|
||||
|
||||
type UserTraceItem struct {
|
||||
Title string `json:"title"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
type UserTrace struct {
|
||||
Title string `json:"title"`
|
||||
Status string `json:"status"`
|
||||
Logs []*drone.Line `json:"logs"`
|
||||
Title string `json:"title"`
|
||||
Status string `json:"status"`
|
||||
Logs []*drone.Line `json:"logs,omitempty"`
|
||||
Items []UserTraceItem `json:"items,omitempty"`
|
||||
}
|
||||
|
||||
func declareAPIAuthWorksRoutes(router *gin.RouterGroup) {
|
||||
@ -495,6 +501,32 @@ func declareAPIAuthWorksRoutes(router *gin.RouterGroup) {
|
||||
Status: step.Status,
|
||||
Logs: keeptLogs,
|
||||
})
|
||||
} else if step.Name == "Check steps" {
|
||||
result, err := client.Logs(slug[0], slug[1], int(buildn), stage.Number, step.Number)
|
||||
if err != nil {
|
||||
log.Printf("An error occurs when retrieving logs from Drone (%s/%s/%d/%d/%d): %s", slug[0], slug[1], buildn, stage.Number, step.Number, err.Error())
|
||||
continue
|
||||
}
|
||||
|
||||
items := []UserTraceItem{}
|
||||
for _, line := range result {
|
||||
if strings.HasPrefix(line.Message, "report:") {
|
||||
tmp := strings.Split(strings.TrimSpace(line.Message), ":")
|
||||
if len(tmp) != 3 {
|
||||
continue
|
||||
}
|
||||
items = append(items, UserTraceItem{
|
||||
Title: tmp[1],
|
||||
Status: tmp[2],
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
traces = append(traces, UserTrace{
|
||||
Title: step.Name,
|
||||
Status: step.Status,
|
||||
Items: items,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user