-
Notifications
You must be signed in to change notification settings - Fork 1.1k
App Distribution: Add commands to manage groups #5978
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
Changes from all commits
6be8ba7
807a5a8
b111a9b
e69af9c
d91b70c
e728e79
a670362
1b4d7e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,5 @@ | ||
| - Added `appdistribution:group:create` and | ||
| `appdistribution:group:delete`. | ||
| - Added `--group-alias` option to `appdistribution:testers:add` and | ||
| `appdistribution:testers:remove`. | ||
| - Fixed an issue where Storage rules could not be deployed to projects without a billing plan. (#5955) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { Command } from "../command"; | ||
| import * as utils from "../utils"; | ||
| import { requireAuth } from "../requireAuth"; | ||
| import { AppDistributionClient } from "../appdistribution/client"; | ||
| import { getProjectName } from "../appdistribution/options-parser-util"; | ||
|
|
||
| export const command = new Command("appdistribution:group:create <displayName> [alias]") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should alias be a named option for clarity? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had it as an option before, but then changed my mind and decided against it. Mainly because it's an argument in |
||
| .description("create group in project") | ||
| .before(requireAuth) | ||
| .action(async (displayName: string, alias?: string, options?: any) => { | ||
| const projectName = await getProjectName(options); | ||
| const appDistroClient = new AppDistributionClient(); | ||
| utils.logBullet(`Creating group in project`); | ||
| const group = await appDistroClient.createGroup(projectName, displayName, alias); | ||
| alias = group.name.split("/").pop(); | ||
| utils.logSuccess(`Group '${group.displayName}' (alias: ${alias}) created successfully`); | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { Command } from "../command"; | ||
| import * as utils from "../utils"; | ||
| import { requireAuth } from "../requireAuth"; | ||
| import { FirebaseError } from "../error"; | ||
| import { AppDistributionClient } from "../appdistribution/client"; | ||
| import { getProjectName } from "../appdistribution/options-parser-util"; | ||
|
|
||
| export const command = new Command("appdistribution:group:delete <alias>") | ||
| .description("delete group from a project") | ||
| .before(requireAuth) | ||
| .action(async (alias: string, options: any) => { | ||
| const projectName = await getProjectName(options); | ||
| const appDistroClient = new AppDistributionClient(); | ||
| try { | ||
| utils.logBullet(`Deleting group from project`); | ||
| await appDistroClient.deleteGroup(`${projectName}/groups/${alias}`); | ||
| } catch (err: any) { | ||
| throw new FirebaseError(`Failed to delete group ${err}`); | ||
| } | ||
| utils.logSuccess(`Group ${alias} has successfully been deleted`); | ||
| }); |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -5,13 +5,24 @@ import { AppDistributionClient } from "../appdistribution/client"; | |||
| import { getEmails, getProjectName } from "../appdistribution/options-parser-util"; | ||||
|
|
||||
| export const command = new Command("appdistribution:testers:add [emails...]") | ||||
| .description("add testers to project") | ||||
| .description("add testers to project (and possibly group)") | ||||
| .option("--file <file>", "a path to a file containing a list of tester emails to be added") | ||||
| .option( | ||||
| "--group-alias <group-alias>", | ||||
| "if specified, the testers are also added to the group identified by this alias" | ||||
| ) | ||||
| .before(requireAuth) | ||||
| .action(async (emails: string[], options?: any) => { | ||||
| const projectName = await getProjectName(options); | ||||
| const appDistroClient = new AppDistributionClient(); | ||||
| const emailsToAdd = getEmails(emails, options.file); | ||||
| utils.logBullet(`Adding ${emailsToAdd.length} testers to project`); | ||||
| await appDistroClient.addTesters(projectName, emailsToAdd); | ||||
| if (options.groupAlias) { | ||||
| utils.logBullet(`Adding ${emailsToAdd.length} testers to group`); | ||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Consider changing the plurality of firebase-tools/src/commands/ext-configure.ts Line 145 in f5671f1
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm too lazy - there are too many places to change |
||||
| await appDistroClient.addTestersToGroup( | ||||
| `${projectName}/groups/${options.groupAlias}`, | ||||
| emailsToAdd | ||||
| ); | ||||
| } | ||||
| }); | ||||
Uh oh!
There was an error while loading. Please reload this page.