Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing the order-pipelines command to allow for selecting teams #8724

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 13 additions & 10 deletions fly/commands/ordering_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

"github.com/concourse/concourse/fly/commands/internal/displayhelpers"
"github.com/concourse/concourse/fly/rc"
"github.com/concourse/concourse/go-concourse/concourse"
)

var ErrMissingPipelineName = errors.New("Need to specify at least one pipeline name")
Expand All @@ -35,15 +34,25 @@ func (command *OrderPipelinesCommand) Execute(args []string) error {
if err != nil {
return err
}

teamName := command.Team.Name()
if teamName == "" {
teamName = target.Team().Name()
}
team, err := target.FindTeam(teamName)
if err != nil {
return err
}
var orderedNames []string
if command.Alphabetical {
seen := map[string]bool{}
ps, err := target.Team().ListPipelines()

if err != nil {
return err
}
ps, err := team.ListPipelines()
if err != nil {
return err
}

for _, p := range ps {
if !seen[p.Name] {
seen[p.Name] = true
Expand All @@ -60,12 +69,6 @@ func (command *OrderPipelinesCommand) Execute(args []string) error {
orderedNames = command.Pipelines
}

var team concourse.Team
team, err = command.Team.LoadTeam(target)
if err != nil {
return err
}

err = team.OrderingPipelines(orderedNames)
if err != nil {
displayhelpers.FailWithErrorf("failed to order pipelines", err)
Expand Down