Skip to content

Add experimental feature to export functions' IaC#10117

Open
inlined wants to merge 4 commits intomainfrom
inlined.iac.1-basic-structure
Open

Add experimental feature to export functions' IaC#10117
inlined wants to merge 4 commits intomainfrom
inlined.iac.1-basic-structure

Conversation

@inlined
Copy link
Member

@inlined inlined commented Mar 17, 2026

Fragment of #10115 for easier reviewing

Adds experiment-guarded command to export IaC for functions codebases. Has a variety of purposes, including allowing functions to be managed with other deployment engines.

This fragment is a PoC that just exports functions.yaml. This can be used to verify SDKs work as expected before building a corresponding feature in the CLI

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces an experimental feature to export Cloud Functions' Infrastructure as Code (IaC). The primary goal is to enable the management of Firebase Functions through external deployment tools by providing a standardized output format. This initial version focuses on generating a functions.yaml file as a proof-of-concept to validate the underlying SDKs and pave the way for a more comprehensive CLI feature.

Highlights

  • New Experimental Command: Introduced a new experimental command, functions:export, which allows users to export Cloud Functions code and configuration as Infrastructure as Code (IaC).
  • IaC Export Functionality: The initial implementation of the export functionality focuses on generating a functions.yaml file, serving as a proof-of-concept for managing functions with other deployment engines.
  • Experiment Guard: The functions:export command is guarded by a new experiment flag, functionsiac, ensuring it is only accessible when explicitly enabled.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/commands/functions-export.ts
    • Added the definition for the new functions:export command, including options for format and codebase selection, and the core logic for invoking the IaC exporter.
  • src/commands/index.ts
    • Modified the command loading mechanism to conditionally include the functions:export command based on the functionsiac experiment flag.
  • src/experiments.ts
    • Defined a new experiment flag, functionsiac, with a short description indicating its purpose to export functions IaC code.
  • src/functions/iac/export.spec.ts
    • Added unit tests for the getInternalIac function, verifying its ability to correctly discover and dump build configurations into a functions.yaml file.
  • src/functions/iac/export.ts
    • Implemented the core logic for getInternalIac, which retrieves project and runtime configurations, validates and builds the function source, and then discovers the build manifest to be exported as YAML.
Activity
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new experimental command, functions:export, to export function configurations as Infrastructure as Code. The changes are well-structured, adding the command definition, core export logic, tests, and enabling it behind an experiment flag. My review focuses on improving type safety by removing any, enhancing code structure to reduce nesting, making the code more robust with better checks, and expanding test coverage to include error cases, all in alignment with the repository's style guide.

@inlined inlined force-pushed the inlined.iac.1-basic-structure branch from f6bfce9 to f1df64a Compare March 17, 2026 19:20
@inlined
Copy link
Member Author

inlined commented Mar 17, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new experimental command functions:export to export function configurations as IaC, starting with a functions.yaml format. The implementation is well-structured, with the new command guarded by an experiment flag and supported by new logic and tests for IaC export.

My review focuses on improving type safety and fixing a logic issue in the new command. I've suggested using specific types instead of any to align with the repository's style guide. More importantly, I've identified and proposed a fix for a critical bug where the --codebase option was being ignored.

Overall, this is a good proof-of-concept. Addressing the feedback will make the new feature more robust and reliable.

await runtimeDelegate.build();

logger.debug(`Discovering ${runtimeDelegate.language} source`);
const build = await runtimeDelegate.discoverBuild(
Copy link
Contributor

Choose a reason for hiding this comment

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

Wanted to double-check, could passing in empty {} here be problematic for any kinds of functions (v1 or other)?

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.

3 participants