From ac187cef0bbb2095e576b6e0043fa6309a050a27 Mon Sep 17 00:00:00 2001 From: Matt Butcher Date: Tue, 17 Jul 2018 10:32:52 -0600 Subject: [PATCH] feat(brig): Add AGE to brig build list (#545) This adds the AGE header with fuzzy durations to the `brig build list` command. --- Gopkg.lock | 3 ++- brig/cmd/brig/commands/build_list.go | 8 ++++++-- brigade.js | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 5ac5bc311..8338b11ff 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -427,6 +427,7 @@ "pkg/util/cache", "pkg/util/clock", "pkg/util/diff", + "pkg/util/duration", "pkg/util/errors", "pkg/util/framer", "pkg/util/httpstream", @@ -551,6 +552,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "c1e9edf42863b0e537ebf244adb7a8115529a3633a1dd9d819a1c2231c078808" + inputs-digest = "0681c62028366b0a4f0537b59e4c9c2940ad68f3a6c662990e0895b5f348415d" solver-name = "gps-cdcl" solver-version = 1 diff --git a/brig/cmd/brig/commands/build_list.go b/brig/cmd/brig/commands/build_list.go index dee9d74e7..6e042a3d0 100644 --- a/brig/cmd/brig/commands/build_list.go +++ b/brig/cmd/brig/commands/build_list.go @@ -3,10 +3,13 @@ package commands import ( "fmt" "io" + "time" "github.com/gosuri/uitable" "github.com/spf13/cobra" + "k8s.io/apimachinery/pkg/util/duration" + "github.com/Azure/brigade/pkg/storage/kube" ) @@ -41,14 +44,15 @@ func listBuilds(out io.Writer) error { } table := uitable.New() - table.AddRow("ID", "TYPE", "PROVIDER", "PROJECT", "STATUS") + table.AddRow("ID", "TYPE", "PROVIDER", "PROJECT", "STATUS", "AGE") for _, b := range bs { status := "???" if b.Worker != nil { status = b.Worker.Status.String() } - table.AddRow(b.ID, b.Type, b.Provider, b.ProjectID, status) + since := duration.ShortHumanDuration(time.Since(b.Worker.EndTime)) + table.AddRow(b.ID, b.Type, b.Provider, b.ProjectID, status, since) } fmt.Fprintln(out, table) return nil diff --git a/brigade.js b/brigade.js index dc44fbff9..3430d9a86 100644 --- a/brigade.js +++ b/brigade.js @@ -4,7 +4,7 @@ // ============================================================================ const { events, Job, Group} = require("brigadier") -const goImg = "golang:1.9" +const goImg = "golang:1.10" function build(e, project) { // This is a Go project, so we want to set it up for Go.