Skip to content

Commit

Permalink
Merge pull request #8850 from concourse/backport-7.11
Browse files Browse the repository at this point in the history
Backport 7.11
  • Loading branch information
xtremerui committed Oct 27, 2023
2 parents ebeefc5 + 750512a commit aee88e2
Show file tree
Hide file tree
Showing 13 changed files with 196 additions and 160 deletions.
5 changes: 5 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
{
"matchPackageNames": ["k8s.io/client-go"],
"allowedVersions": "!/1\\.(4\\.0|5\\.0|5\\.1|5\\.2)$/"
},
{
"matchPackageNames": ["gopkg.in/yaml.v2"],
"allowedVersions": "<3.0.0",
"_context": "v3 will cause indent problem when marshalling, which requires test updates and we dont know the full impact. See https://github.com/go-yaml/yaml/issues/661."
}
],
"ignoreDeps": ["elm", "client-go"],
Expand Down
2 changes: 1 addition & 1 deletion atc/metric/emitter/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func (config *PrometheusConfig) NewEmitter(attributes map[string]string) (metric
Namespace: "concourse",
Subsystem: "builds",
Name: "latest_completed_build_status",
Help: "Status of Latest Completed Build",
Help: "Status of Latest Completed Build. 0=Success, 1=Failed, 2=Aborted, 3=Errored.",
ConstLabels: attributes,
}, []string{"jobName", "pipelineName", "teamName"})
prometheus.MustRegister(latestCompletedBuildStatus)
Expand Down
62 changes: 41 additions & 21 deletions fly/commands/builds.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,37 +73,57 @@ func (command *BuildsCommand) Execute([]string) error {

func (command *BuildsCommand) getBuilds(builds []atc.Build, currentTeam concourse.Team, page concourse.Page, client concourse.Client, teams []concourse.Team) ([]atc.Build, error) {
var err error
if command.pipelineFlag() {
builds, err = command.validatePipelineBuilds(builds, currentTeam, page)
if err != nil {
return nil, err
}
} else if command.jobFlag() {
builds, err = command.validateJobBuilds(builds, currentTeam, page)
if err != nil {
return nil, err
}
} else if command.AllTeams {

if command.AllTeams {
teams, err = command.getAllTeams(client, teams)
if err != nil {
return nil, err
}
} else if len(command.Teams) > 0 || command.CurrentTeam {
teams = command.validateCurrentTeam(teams, currentTeam, client)
} else {
builds, _, err = client.Builds(page)
if err != nil {
return nil, err
}
}

for _, team := range teams {
teamBuilds, _, err := team.Builds(page)
if err != nil {
return nil, err
if len(teams) > 0 {
for _, team := range teams {
var teamBuilds []atc.Build
if command.pipelineFlag() {
teamBuilds, err = command.validatePipelineBuilds(builds, team, page)
if err != nil {
return nil, err
}
} else if command.jobFlag() {
teamBuilds, err = command.validateJobBuilds(builds, team, page)
if err != nil {
return nil, err
}
} else {
teamBuilds, _, err = team.Builds(page)
if err != nil {
return nil, err
}

}

builds = append(builds, teamBuilds...)
}
} else {
if command.pipelineFlag() {
builds, err = command.validatePipelineBuilds(builds, currentTeam, page)
if err != nil {
return nil, err
}
} else if command.jobFlag() {
builds, err = command.validateJobBuilds(builds, currentTeam, page)
if err != nil {
return nil, err
}
} else {
builds, _, err = client.Builds(page)
if err != nil {
return nil, err
}
}

builds = append(builds, teamBuilds...)
}

return builds, err
Expand Down
2 changes: 1 addition & 1 deletion fly/commands/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/concourse/concourse/fly/ui"
"github.com/concourse/concourse/fly/ui/progress"
"github.com/concourse/concourse/go-concourse/concourse"
"github.com/vbauerster/mpb/v4"
"github.com/vbauerster/mpb/v8"
)

type ExecuteCommand struct {
Expand Down
2 changes: 1 addition & 1 deletion fly/commands/internal/executehelpers/downloads.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package executehelpers
import (
"github.com/concourse/concourse/go-concourse/concourse"
"github.com/concourse/go-archive/tgzfs"
"github.com/vbauerster/mpb/v4"
"github.com/vbauerster/mpb/v8"
)

func Download(bar *mpb.Bar, team concourse.Team, artifactID int, path string) error {
Expand Down
2 changes: 1 addition & 1 deletion fly/commands/internal/executehelpers/inputs.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/concourse/concourse/fly/commands/internal/flaghelpers"
"github.com/concourse/concourse/fly/ui/progress"
"github.com/concourse/concourse/go-concourse/concourse"
"github.com/vbauerster/mpb/v4"
"github.com/vbauerster/mpb/v8"
)

type Input struct {
Expand Down
2 changes: 1 addition & 1 deletion fly/commands/internal/executehelpers/uploads.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/concourse/concourse/atc"
"github.com/concourse/concourse/go-concourse/concourse"
"github.com/concourse/go-archive/tgzfs"
"github.com/vbauerster/mpb/v4"
"github.com/vbauerster/mpb/v8"
)

func Upload(bar *mpb.Bar, team concourse.Team, path string, includeIgnored bool, platform string, tags []string) (atc.WorkerArtifact, error) {
Expand Down
4 changes: 2 additions & 2 deletions fly/commands/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"strconv"

update "github.com/inconshreveable/go-update"
"github.com/vbauerster/mpb/v4"
"github.com/vbauerster/mpb/v4/decor"
"github.com/vbauerster/mpb/v8"
"github.com/vbauerster/mpb/v8/decor"

"github.com/concourse/concourse/atc"
"github.com/concourse/concourse/fly/commands/internal/displayhelpers"
Expand Down
81 changes: 81 additions & 0 deletions fly/integration/builds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,88 @@ var _ = Describe("Fly CLI", func() {
}))
Eventually(session).Should(gexec.Exit(0))
})
})

Context("when passing one team filter with pipeline flag", func() {
BeforeEach(func() {
cmdArgs = append(cmdArgs, "--team", "team1", "-p", "some-pipeline")

expectedURL = "/api/v1/teams/team1/pipelines/some-pipeline/builds"
queryParams = []string{"limit=50"}
returnedStatusCode = http.StatusOK
returnedBuilds = []atc.Build{
{
ID: 3,
PipelineName: "some-pipeline",
JobName: "some-job",
Name: "63",
Status: "succeeded",
StartTime: succeededBuildStartTime.Unix(),
EndTime: succeededBuildEndTime.Unix(),
TeamName: "team1",
},
}
})

It("returns the builds correctly", func() {
Eventually(session.Out).Should(PrintTable(ui.Table{
Headers: expectedHeaders,
Data: []ui.TableRow{
{
{Contents: "3"},
{Contents: "some-pipeline/some-job/63"},
{Contents: "succeeded"},
{Contents: succeededBuildStartTime.Local().Format(timeDateLayout)},
{Contents: succeededBuildEndTime.Local().Format(timeDateLayout)},
{Contents: "1h15m0s"},
{Contents: "team1"},
{Contents: "system"},
},
},
}))
Eventually(session).Should(gexec.Exit(0))
})
})

Context("when passing one team filter with job flag", func() {
BeforeEach(func() {
cmdArgs = append(cmdArgs, "--team", "team1", "-j", "some-pipeline/some-job")

expectedURL = "/api/v1/teams/team1/pipelines/some-pipeline/jobs/some-job/builds"
queryParams = []string{"limit=50"}
returnedStatusCode = http.StatusOK
returnedBuilds = []atc.Build{
{
ID: 3,
PipelineName: "some-pipeline",
JobName: "some-job",
Name: "63",
Status: "succeeded",
StartTime: succeededBuildStartTime.Unix(),
EndTime: succeededBuildEndTime.Unix(),
TeamName: "team1",
},
}
})

It("returns the builds correctly", func() {
Eventually(session.Out).Should(PrintTable(ui.Table{
Headers: expectedHeaders,
Data: []ui.TableRow{
{
{Contents: "3"},
{Contents: "some-pipeline/some-job/63"},
{Contents: "succeeded"},
{Contents: succeededBuildStartTime.Local().Format(timeDateLayout)},
{Contents: succeededBuildEndTime.Local().Format(timeDateLayout)},
{Contents: "1h15m0s"},
{Contents: "team1"},
{Contents: "system"},
},
},
}))
Eventually(session).Should(gexec.Exit(0))
})
})

Context("when passing multiple team filters", func() {
Expand Down
12 changes: 6 additions & 6 deletions fly/ui/progress/progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"

"github.com/concourse/concourse/fly/ui"
"github.com/vbauerster/mpb/v4"
"github.com/vbauerster/mpb/v4/decor"
"github.com/vbauerster/mpb/v8"
"github.com/vbauerster/mpb/v8/decor"
"golang.org/x/sync/errgroup"
)

Expand All @@ -22,9 +22,9 @@ func New() *Progress {
}

func (prog *Progress) Go(name string, f func(*mpb.Bar) error) {
bar := prog.progress.AddSpinner(
bar := prog.progress.New(
0,
mpb.SpinnerOnLeft,
mpb.SpinnerStyle().PositionLeft(),
mpb.PrependDecorators(
decor.Name(
name,
Expand All @@ -33,11 +33,11 @@ func (prog *Progress) Go(name string, f func(*mpb.Bar) error) {
),
mpb.AppendDecorators(
decor.OnComplete(
decor.AverageSpeed(decor.UnitKiB, "(%.1f)"),
decor.AverageSpeed(decor.SizeB1024(0), "(%.1f)"),
" "+ui.Embolden("done"),
),
),
mpb.BarClearOnComplete(),
mpb.BarFillerClearOnComplete(),
)

prog.errs.Go(func() error {
Expand Down
34 changes: 17 additions & 17 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@ go 1.21

require (
code.cloudfoundry.org/clock v1.1.0
code.cloudfoundry.org/credhub-cli v0.0.0-20230410130651-444cd52cc23d
code.cloudfoundry.org/garden v0.0.0-20230418162742-6c127706d54f
code.cloudfoundry.org/credhub-cli v0.0.0-20231016130351-b222b8e0beb7
code.cloudfoundry.org/garden v0.0.0-20231010181202-f61f4780fa7d
code.cloudfoundry.org/lager/v3 v3.0.2
code.cloudfoundry.org/localip v0.0.0-20230406154131-9ff4293aa842
code.cloudfoundry.org/localip v0.0.0-20230612151424-f52ecafaffc4
code.cloudfoundry.org/urljoiner v0.0.0-20170223060717-5cabba6c0a50
dario.cat/mergo v1.0.0
github.com/DataDog/datadog-go/v5 v5.3.0
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v1.20.0
github.com/Masterminds/squirrel v1.5.4
github.com/NYTimes/gziphandler v1.1.1
github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b
github.com/aws/aws-sdk-go v1.45.24
github.com/caarlos0/env/v6 v6.10.1
github.com/aws/aws-sdk-go v1.45.26
github.com/caarlos0/env/v9 v9.0.0
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/concourse/dex v1.8.0
Expand Down Expand Up @@ -45,7 +44,7 @@ require (
github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c
github.com/jackpal/gateway v1.0.10
github.com/jessevdk/go-flags v1.5.0
github.com/klauspost/compress v1.17.0
github.com/klauspost/compress v1.17.1
github.com/kr/pty v1.1.8
github.com/krishicks/yaml-patch v0.0.10
github.com/lib/pq v1.10.9
Expand Down Expand Up @@ -73,8 +72,7 @@ require (
github.com/tedsuo/ifrit v0.0.0-20230516164442-7862c310ad26
github.com/tedsuo/rata v1.0.1-0.20170830210128-07d200713958
github.com/txn2/txeh v1.5.4
github.com/vbauerster/mpb/v4 v4.12.2
github.com/vbauerster/mpb/v8 v8.6.1
github.com/vbauerster/mpb/v8 v8.6.2
github.com/vito/go-interact v1.0.1
github.com/vito/go-sse v1.0.0
github.com/vito/houdini v1.1.3
Expand All @@ -91,9 +89,8 @@ require (
golang.org/x/sync v0.4.0
golang.org/x/sys v0.13.0
golang.org/x/time v0.3.0
google.golang.org/grpc v1.58.2
google.golang.org/grpc v1.58.3
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.28.2
k8s.io/apimachinery v0.28.2
k8s.io/client-go v0.28.2
Expand All @@ -115,7 +112,7 @@ require (
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/charlievieth/fs v0.0.3 // indirect
github.com/cloudfoundry/go-socks5 v0.0.0-20180221174514-54f73bdb8a8e // indirect
github.com/cloudfoundry/socks5-proxy v0.2.87 // indirect
github.com/cloudfoundry/socks5-proxy v0.2.101 // indirect
github.com/containerd/cgroups v1.1.0 // indirect
github.com/containerd/continuity v0.4.2 // indirect
github.com/containerd/fifo v1.1.0 // indirect
Expand All @@ -130,7 +127,7 @@ require (
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-sql-driver/mysql v1.7.1 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/gax-go/v2 v2.11.0 // indirect
Expand Down Expand Up @@ -173,11 +170,11 @@ require (
github.com/stretchr/objx v0.5.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.16.0 // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/tools v0.13.0 // indirect
golang.org/x/tools v0.14.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.129.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand Down Expand Up @@ -218,17 +215,19 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v5 v5.0.0-rc.1 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/pprof v0.0.0-20230406165453-00490a63f317 // indirect
github.com/google/pprof v0.0.0-20230926050212-f7f687d19a98 // indirect
github.com/google/s2a-go v0.1.4 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattermost/xml-roundtrip-validator v0.1.0 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/openzipkin/zipkin-go v0.4.1 // indirect
github.com/openzipkin/zipkin-go v0.4.2 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/zalando/go-keyring v0.2.3-0.20230503081219-17db2e5354bd // indirect
Expand All @@ -238,4 +237,5 @@ require (
google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230731190214-cbb8c96f2d6d // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

0 comments on commit aee88e2

Please sign in to comment.