-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Upgrades functions::list command to utilize Cloud Run API #9425
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
Open
brittanycho
wants to merge
35
commits into
master
Choose a base branch
from
fr/cloud-run-fns-list
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+276
−186
Open
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
12b9257
adds listServices fn and adds trigger to endpointFromService fn
brittanycho 0a30722
updates functions-list to use listServices to use cloud run api instead
brittanycho df189ee
adds listServices tests
brittanycho 66cf473
fix linting errors
brittanycho 3af536c
Merge branch 'master' into fr/cloud-run-fns-list
brittanycho f6ef8c0
Update src/commands/functions-list.ts
brittanycho d9fd843
Update src/gcp/runv2.ts
brittanycho 84725cf
corrects import error
brittanycho 6a45457
add relevant labelSelectors
brittanycho 9cedf12
adding v1 fns in
brittanycho 481d02f
adding in deduplication
brittanycho 0362303
Merge branch 'master' into fr/cloud-run-fns-list
brittanycho d4ed0f9
Update src/gcp/runv2.ts
brittanycho 2de426f
linting
brittanycho 7cb75d8
Merge branch 'master' into fr/cloud-run-fns-list
brittanycho 4d06024
Merge branch 'master' into fr/cloud-run-fns-list
brittanycho 3712d0c
Merge branch 'master' into fr/cloud-run-fns-list
brittanycho d1986ac
follow-up on feedback: move parts of implementation to backend.ts, ad…
brittanycho 8f1c06d
correct lint error
brittanycho 1cef2a6
Update src/commands/functions-list.ts
brittanycho 0de7514
addressing feedback on parsing
brittanycho 66e5d6f
feat: upgrade functions::list to use Cloud Run API and bump version t…
brittanycho c1f2e7b
adjust how v2 functions are being called from listServices
brittanycho bd8ea09
add updated tests to backend.spec.ts
brittanycho 86ef3f6
addresses feedback from code review
brittanycho 9287590
updates changelog
brittanycho 896d3a1
Merge branch 'master' into fr/cloud-run-fns-list
brittanycho a38b669
Merge branch 'master' into fr/cloud-run-fns-list
brittanycho c253ae9
addresses feedback
brittanycho 0779bff
Merge branch 'master' into fr/cloud-run-fns-list
brittanycho a36e9d9
Merge remote-tracking branch 'origin/fr/cloud-run-fns-list' into fr/c…
brittanycho 5acc3cf
Update src/gcp/runv2.ts
brittanycho 812fda9
correct linting errors
brittanycho 4ebc27b
Update src/deploy/functions/backend.spec.ts
brittanycho 369c402
updates error handling and tests
brittanycho File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| - [Added] support for new google-genai plugin during `init genkit` (#8957) | ||
| - Updated to v2.17.1 of the Data Connect emulator, which fixes an admin SDK bug for operation without argument #9449 (#9454). | ||
| - Upgraded functions::list command to use cloud run api for v2 functions (#9425) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,38 +1,57 @@ | ||
| import { Command } from "../command"; | ||
| import * as args from "../deploy/functions/args"; | ||
| import { needProjectId } from "../projectUtils"; | ||
| import { Options } from "../options"; | ||
| import { requirePermissions } from "../requirePermissions"; | ||
| import * as backend from "../deploy/functions/backend"; | ||
| import { logger } from "../logger"; | ||
| import * as Table from "cli-table3"; | ||
| import { Options } from "../options"; | ||
| import { FunctionsPlatform } from "../deploy/functions/backend"; | ||
|
|
||
| type PLATFORM_DISPLAY_NAME = "v1" | "v2" | "run"; | ||
| const PLATFORM_TO_DISPLAY_NAME: Record<FunctionsPlatform, PLATFORM_DISPLAY_NAME> = { | ||
| gcfv1: "v1", | ||
| gcfv2: "v2", | ||
| run: "run", | ||
| }; | ||
|
|
||
| export const command = new Command("functions:list") | ||
| .description("list all deployed functions in your Firebase project") | ||
| .before(requirePermissions, ["cloudfunctions.functions.list"]) | ||
| .before(requirePermissions, ["cloudfunctions.functions.list", "run.services.list"]) | ||
| .action(async (options: Options) => { | ||
| const projectId = needProjectId(options); | ||
| const context = { | ||
| projectId: needProjectId(options), | ||
| projectId, | ||
| } as args.Context; | ||
|
|
||
| const existing = await backend.existingBackend(context); | ||
| const endpointsList = backend.allEndpoints(existing).sort(backend.compareFunctions); | ||
| const endpoints = backend.allEndpoints(existing); | ||
|
|
||
| endpoints.sort(backend.compareFunctions); | ||
|
|
||
| if (endpoints.length === 0) { | ||
| logger.info(`No functions found in project ${projectId}.`); | ||
| return []; | ||
| } | ||
|
|
||
| const table = new Table({ | ||
| head: ["Function", "Version", "Trigger", "Location", "Memory", "Runtime"], | ||
| style: { head: ["yellow"] }, | ||
| }); | ||
| for (const endpoint of endpointsList) { | ||
| }) as any; | ||
|
|
||
| for (const endpoint of endpoints) { | ||
| const trigger = backend.endpointTriggerType(endpoint); | ||
| const availableMemoryMb = endpoint.availableMemoryMb || "---"; | ||
| const entry = [ | ||
| endpoint.id, | ||
| endpoint.platform === "gcfv2" ? "v2" : "v1", | ||
| PLATFORM_TO_DISPLAY_NAME[endpoint.platform] || "v1", | ||
brittanycho marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| trigger, | ||
| endpoint.region, | ||
| availableMemoryMb, | ||
| endpoint.runtime, | ||
| ]; | ||
| table.push(entry); | ||
|
Check warning on line 53 in src/commands/functions-list.ts
|
||
| } | ||
| logger.info(table.toString()); | ||
|
Check warning on line 55 in src/commands/functions-list.ts
|
||
| return endpointsList; | ||
| return endpoints; | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove and add our own changelist bullet?