Skip to content

[fly] Add --team-name for all Fly commands #4196

@taylorsilva

Description

@taylorsilva

Epic #4192

Currently the only way for users to interact with multiple teams with Fly is to create multiple targets.
This story will leave this workflow possible (users may have scripts that switch targets based on teams)
and will enable a new "single target, many teams" workflow.

If a user wants to change their default team, they can login with the same target into a different team.

Another thing to note is that we already have the --team-name and -n flags for some commands. We should continue to use both of these flags everywhere.

Single-team scoped Commands

For single-team scoped commands the following should be possible for each command. This ensures a user's existing script/workflow will still work.

# use default team
fly -t ci <command> <command-options>
# use another team
fly -t ci <command> <command-options> --team-name team3
  • abort-build
  • hijack
  • resources
  • check-resource-type
  • check-resource
  • resource-versions
  • watch
  • checklist
  • clear-task-cache
  • execute
  • expose-pipeline
  • destroy-pipeline
  • get-pipeline
  • set-pipeline
  • hide-pipeline
  • pause-pipeline
  • unpause-pipeline
  • rename-pipeline
  • order-pipelines
  • jobs
  • trigger-job
  • pause-job
  • unpause-job

PR: #4406
PR is ready for review and can be merged

Remaining commands should be submitted as new PR's. One PR per command to make it easier for others to review.

Multi-team scoped commands

For these commands, they currently behave like the previous single-team commands. They hit a /api/v1/teams/... endpoint and return the result. We should change the behaviour of the --team-name to accept one or more team names by declaring the flag multiple times.
We can also implement a --all-teams flag to just get data for all teams in Concourse.

The following should be possible for the below commands:

# use default team
fly -t ci <command> <command-options>
# return data for specified team
fly -t ci <command> <command-options> --team-name team1
# return data for all teams given
fly -t ci <command> <command-options> --team-name team1 --team-name team2 -n team3
# return data for all teams in Concourse
fly -t ci <command> <command-options> --all-teams
  • containers
  • volumes
  • pipelines
  • builds (--all has been implemented, enhancement for --team)

Some of these commands already take a long time, fly volumes takes 9s to return for the main team on ci.concourse-ci.org. It may be more efficient to create a new API endpoint that returns this data for a subset/all teams.

PR: #4324 - For containers only

Create new PR's for volumes, and pipelines. Smaller PR's are easier for others to review.

N/A

These commands already focus on one team and only work for owners of the main team (Admins). They all have the --team-name flag already.
You don't need to be logged into the main team to run these commands either, they Just Work(TM). These commands should not be changed.

  • set-team
  • destroy-team
  • rename-team

Acceptance Criteria

  • All single-team and multi-team commands take an optional --team-name and -n flag and execute their API calls under that team
  • Multi-team commands take these optional flags:
    • --team-name flag which takes in a list of team names and returns data for only those teams
    • --all-teams flag, boolean, that will return the relevant data for all teams
  • Multi-team commands should display some kind of waiting text, like "fetching data..." before they start hitting the Concourse API because it can take a long time to return this data for even one team.

Metadata

Metadata

Labels

size/largeA ton of work, possibly in multiple places. Mostly understood, but there may be unknown unknowns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions