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

Add new command for discoverying function triggers. #5213

Merged
merged 7 commits into from
Dec 13, 2022
Merged

Conversation

taeold
Copy link
Contributor

@taeold taeold commented Nov 4, 2022

Adds an internal CLI command for discovering function triggers in a given project directory:

$ cd my-project
$ ls
firebase.json
functions/
$ firebase internaltesting:functions:discover
{
  "default": {
    "requiredAPIs": [],
    "endpoints": [
      {
        id: "helloWorld",
        platform: "gcfv2",
        ...
      },
      ...
    ]
  }
}

I intend to use the command to wire up integration test for discovery portion of a function deployment in the follow up PR.

This PR makes a small refactoring of the function deployment code to extract out the pieces for discovering functions. I verified that the function deploy integration test still passes after this refactor (Test Run).

DO NOT MERGE: New command requires an internal API proposal approval.

@taeold
Copy link
Contributor Author

taeold commented Nov 4, 2022

@codecov-commenter
Copy link

codecov-commenter commented Nov 4, 2022

Codecov Report

Base: 56.36% // Head: 56.33% // Decreases project coverage by -0.03% ⚠️

Coverage data is based on head (cfdb639) compared to base (2e88691).
Patch coverage: 14.28% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5213      +/-   ##
==========================================
- Coverage   56.36%   56.33%   -0.04%     
==========================================
  Files         313      313              
  Lines       21056    21066      +10     
  Branches     4278     4278              
==========================================
- Hits        11869    11868       -1     
- Misses       8161     8172      +11     
  Partials     1026     1026              
Impacted Files Coverage Δ
src/deploy/functions/prepare.ts 31.57% <7.69%> (-1.09%) ⬇️
src/deploy/functions/params.ts 37.50% <100.00%> (ø)
src/emulator/auth/state.ts 84.87% <0.00%> (-0.57%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@taeold taeold marked this pull request as ready for review November 7, 2022 14:08
@colerogers
Copy link
Contributor

I would take the side of running this through API council since it has to be public facing and they might have naming suggestions for internal only commands.

Alternatively, I think we should at least get @bkendall's sign-off as the CLI TL before merging this

@taeold
Copy link
Contributor Author

taeold commented Nov 7, 2022

@colerogers Since @bkendall won't be back for some time, I'll go ahead and draft an API proposal.

const builds = await loadCodebases(fnConfig, options, firebaseConfig, {
firebase: firebaseConfig,
});
logger.info(JSON.stringify(builds, null, 2));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this JSON.stringify be try/catch'd ?

Copy link
Contributor Author

@taeold taeold Nov 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like that edge case is rare enough, and we can rely on the CLI's global try-catch mechanism. We are going to rethrow the error anyway right?

WDYT?

@taeold taeold force-pushed the dl-fn-discovery-cmd branch 2 times, most recently from 6ac68b8 to 68889a4 Compare December 1, 2022 19:51
@taeold taeold changed the base branch from master to dl-internal-only-cmds December 1, 2022 19:51
Copy link
Contributor

@colerogers colerogers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

src/commands/internaltesting-functions-discover.ts Outdated Show resolved Hide resolved
src/deploy/functions/prepare.ts Outdated Show resolved Hide resolved
src/commands/internaltesting-functions-discover.ts Outdated Show resolved Hide resolved
@taeold taeold requested a review from bkendall December 7, 2022 00:08
@taeold taeold changed the base branch from dl-internal-only-cmds to master December 13, 2022 18:11
@taeold
Copy link
Contributor Author

taeold commented Dec 13, 2022

Graphite Merge Job

Current status: ✅ Merged

This pull request was successfully merged as part of a stack.

This comment was auto-generated by Graphite.

Job Reference: Uhty8UE38l3MKEIRA9gp

@taeold taeold merged commit 87c71fa into master Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants