Skip to content

Add new command for discoverying function triggers. - #5213

Merged
taeold merged 7 commits into
masterfrom
dl-fn-discovery-cmd
Dec 13, 2022
Merged

taeold merged 7 commits into
masterfrom
dl-fn-discovery-cmd

Conversation

@taeold

@taeold taeold commented Nov 4, 2022 •

Copy link
Copy Markdown
Contributor

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

taeold commented Nov 4, 2022 •

Copy link
Copy Markdown
Contributor Author

@codecov-commenter

codecov-commenter commented Nov 4, 2022 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 14.28571% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.34%. Comparing base (2e88691) to head (cfdb639).

Files with missing lines Patch % Lines
src/deploy/functions/prepare.ts 7.69% 24 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5213      +/-   ##
==========================================
- Coverage   56.36%   56.34%   -0.03%     
==========================================
  Files         313      313              
  Lines       21056    21066      +10     
  Branches     4278     4278              
==========================================
+ Hits        11869    11870       +1     
- Misses       8161     8170       +9     
  Partials     1026     1026              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@taeold
taeold force-pushed the dl-fn-discovery-cmd branch from 0b62447 to 0d6179a Compare November 5, 2022 03:15
@taeold
taeold marked this pull request as ready for review November 7, 2022 14:08
@colerogers

Copy link
Copy Markdown
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

taeold commented Nov 7, 2022

Copy link
Copy Markdown
Contributor Author

@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
Copy Markdown
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 ?

@taeold taeold Nov 7, 2022 •

Copy link
Copy Markdown
Contributor Author

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
@taeold
taeold force-pushed the dl-fn-discovery-cmd branch from 68889a4 to 8144450 Compare December 1, 2022 19:54
@taeold
taeold requested a review from TheIronDev December 1, 2022 23:52

@colerogers colerogers left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔥

Comment thread src/deploy/functions/prepare.ts Resolved
@taeold
taeold requested a review from bkendall December 7, 2022 00:08
@taeold
taeold force-pushed the dl-internal-only-cmds branch from 19cb747 to 0078352 Compare December 7, 2022 18:48
@taeold
taeold force-pushed the dl-fn-discovery-cmd branch from eecb3dc to 15e23ca Compare December 7, 2022 18:48
@taeold
taeold changed the base branch from dl-internal-only-cmds to master December 13, 2022 18:11
@taeold

taeold commented Dec 13, 2022 •

Copy link
Copy Markdown
Contributor Author

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.

5 participants