feat: show only the last step that was successful/failed
This commit is contained in:
parent
b24008ad3f
commit
aceaf96448
53
log.go
53
log.go
@ -207,6 +207,20 @@ func (cmd *LogMarkdownCmd) Run(g *Globals) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func center(s string, w int) string {
|
||||||
|
return fmt.Sprintf("%[1]*s", -w, fmt.Sprintf("%[1]*s", (w+len(s))/2, s))
|
||||||
|
}
|
||||||
|
|
||||||
|
func genOkFailCentered(name string, ok bool) (aurv aurora.Value) {
|
||||||
|
name = center(name, 10)
|
||||||
|
if ok {
|
||||||
|
aurv = aurora.BgGreen(aurora.Black(name))
|
||||||
|
} else {
|
||||||
|
aurv = aurora.BgRed(aurora.White(aurora.Bold(name)))
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func logLogEntry(l logEntry) {
|
func logLogEntry(l logEntry) {
|
||||||
distroInfo := fmt.Sprintf("%s-%s {%s}", l.Distro.ID,
|
distroInfo := fmt.Sprintf("%s-%s {%s}", l.Distro.ID,
|
||||||
l.Distro.Release, l.KernelRelease)
|
l.Distro.Release, l.KernelRelease)
|
||||||
@ -215,22 +229,25 @@ func logLogEntry(l logEntry) {
|
|||||||
|
|
||||||
timestamp := l.Timestamp.Format("2006-01-02 15:04")
|
timestamp := l.Timestamp.Format("2006-01-02 15:04")
|
||||||
|
|
||||||
colored := ""
|
var status aurora.Value
|
||||||
if l.InternalErrorString != "" {
|
if l.InternalErrorString != "" {
|
||||||
colored = aurora.Sprintf("[%4d %4s] [%s] %20s %-70s: %s",
|
status = genOkFailCentered("INTERNAL", false)
|
||||||
l.ID, l.Tag, timestamp, artifactInfo, distroInfo,
|
|
||||||
genOkFail("", false))
|
|
||||||
} else if l.Type == config.KernelExploit {
|
} else if l.Type == config.KernelExploit {
|
||||||
colored = aurora.Sprintf("[%4d %4s] [%s] %20s %-70s: %s %s",
|
if l.Build.Ok {
|
||||||
l.ID, l.Tag, timestamp, artifactInfo, distroInfo,
|
status = genOkFailCentered("LPE", l.Test.Ok)
|
||||||
genOkFail("BUILD", l.Build.Ok),
|
} else {
|
||||||
genOkFail("LPE", l.Test.Ok))
|
status = genOkFailCentered("BUILD", l.Build.Ok)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
colored = aurora.Sprintf("[%4d %4s] [%s] %20s %-70s: %s %s %s",
|
if l.Build.Ok {
|
||||||
l.ID, l.Tag, timestamp, artifactInfo, distroInfo,
|
if l.Run.Ok {
|
||||||
genOkFail("BUILD", l.Build.Ok),
|
status = genOkFailCentered("TEST", l.Test.Ok)
|
||||||
genOkFail("INSMOD", l.Run.Ok),
|
} else {
|
||||||
genOkFail("TEST", l.Test.Ok))
|
status = genOkFailCentered("INSMOD", l.Run.Ok)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
status = genOkFailCentered("BUILD", l.Build.Ok)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
additional := ""
|
additional := ""
|
||||||
@ -240,11 +257,11 @@ func logLogEntry(l logEntry) {
|
|||||||
additional = "(timeout)"
|
additional = "(timeout)"
|
||||||
}
|
}
|
||||||
|
|
||||||
if additional != "" {
|
colored := aurora.Sprintf("[%4d %4s] [%s] %-40s %-70s: %s %s",
|
||||||
fmt.Println(colored, additional)
|
l.ID, l.Tag, timestamp, artifactInfo, distroInfo, status,
|
||||||
} else {
|
additional)
|
||||||
fmt.Println(colored)
|
|
||||||
}
|
fmt.Println(colored)
|
||||||
}
|
}
|
||||||
|
|
||||||
type runstat struct {
|
type runstat struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user