Skip to content

Conversation

@brittanycho
Copy link
Contributor

Cloud Run No Build Initial MVP Implementation v2

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @brittanycho, 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 lays the groundwork for deploying functions to Cloud Run using a 'no-build' approach. It extends the existing functions deployment framework to support direct deployment of container images or source code archives, bypassing the traditional build process. Key changes include new configuration options for Cloud Run services, integration with the Cloud Run V2 API for lifecycle management, and the introduction of a dedicated runtime delegate for discovering and deploying these new function types.

Highlights

  • Cloud Run No Build Support: Introduced initial MVP implementation for deploying functions to Cloud Run without a build step, allowing direct deployment of pre-built container images or source code archives.
  • New Endpoint Configuration Fields: Added baseImageUri, command, and args fields to the Endpoint type, enabling detailed configuration for Cloud Run services.
  • Cloud Run V2 API Integration: Integrated with the Cloud Run V2 API for creating, updating, and deleting Cloud Run services, replacing previous placeholder error messages.
  • New No-Build Runtime Delegate: Added a new nobuild runtime delegate that discovers functions from a functions.yaml file, specifically targeting Dart functions for the 'run' platform.
  • Updated Source Packaging: Modified the source upload logic to support tar.gz archives for 'run' platform endpoints, alongside the existing zip format for other platforms.
  • Platform and Language Expansion: Expanded the FunctionsPlatform type to include 'run' and added 'dart' as a supported language with 'dart3' as an experimental runtime.
  • Concurrency Metric Renaming: Updated containerConcurrency to maxInstanceRequestConcurrency in runv2 related types and tests to align with the Cloud Run V2 API specification.

🧠 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.

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 'no-build' deployment option for Cloud Run, which seems to be the initial MVP targeting Dart. The changes are comprehensive, touching upon type definitions, source packaging to support .tar.gz, and new deployment logic using the Cloud Run v2 API. The overall implementation is solid, but I've identified several areas for improvement regarding code comments, code duplication, and minor code style issues. My review comments provide specific suggestions to enhance maintainability and clarity.

export type MemoryOption = 128 | 256 | 512 | 1024 | 2048 | 4096 | 8192 | 16384 | 32768;
const allMemoryOptions: MemoryOption[] = [128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768];

// Run is an automatic migration from gcfv2 and is not used on the wire.
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This comment appears to be outdated. With the changes in this pull request, the 'run' platform is now being used. Please update or remove this comment to avoid confusion.

Comment on lines +55 to +57
/**
*
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This JSDoc comment is empty. Please add a meaningful description for the createReadStream function or remove the comment block if it's not needed.

Comment on lines +62 to +64
/**
*
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This JSDoc comment is empty. Please add a meaningful description for the uploadSourceV2 function or remove the comment block if it's not needed.

Comment on lines +27 to +29
/**
*
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This JSDoc comment is empty. Please add a meaningful description for the getFunctionsConfig function or remove the comment block.

Comment on lines +138 to +140
/**
*
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This JSDoc comment is empty. Please add a meaningful description for the prepareFunctionsUpload function or remove the comment block.

Comment on lines +150 to +152
/**
*
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This JSDoc comment is empty. Please add a meaningful description for the convertToSortedKeyValueArray function or remove the comment block.

Comment on lines +602 to +662
async createRunService(endpoint: backend.Endpoint): Promise<void> {
const storageSource = this.sources[endpoint.codebase!]?.storage;
if (!storageSource) {
logger.debug("Precondition failed. Cannot create a Cloud Run function without storage");
throw new Error("Precondition failed");
}
const service: Omit<runV2.Service, runV2.ServiceOutputFields> = {
name: `projects/${endpoint.project}/locations/${endpoint.region}/services/${endpoint.id}`,
template: {
containers: [
{
name: "worker",
image: "scratch",
command: endpoint.command,
args: endpoint.args,
baseImageUri: endpoint.baseImageUri,
sourceCode: {
cloudStorageSource: {
bucket: storageSource.bucket,
object: storageSource.object,
generation: storageSource.generation ? String(storageSource.generation) : undefined,
},
},
resources: {
limits: {
cpu: String(endpoint.cpu || 1),
memory: `${endpoint.availableMemoryMb || 256}Mi`,
},
cpuIdle: true,
startupCpuBoost: true,
},
},
],
maxInstanceRequestConcurrency: endpoint.concurrency || 80,
scaling: {
minInstanceCount: endpoint.minInstances || 0,
maxInstanceCount: endpoint.maxInstances || 100,
},
},
client: "cli-firebase",
labels: { ...endpoint.labels, "goog-managed-by": "firebase-functions" },
annotations: {},
};

await this.executor
.run(async () => {
const op = await runV2.createService(
endpoint.project,
endpoint.region,
endpoint.id,
service,
);
endpoint.uri = op.uri;
endpoint.runServiceId = endpoint.id;
})
.catch(rethrowAs(endpoint, "create"));

await this.setInvoker(endpoint);
}

async updateRunService(update: planner.EndpointUpdate): Promise<void> {
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The logic for creating the service object inside createRunService is nearly identical to the logic inside updateRunService. To reduce code duplication and improve maintainability, consider extracting this logic into a private helper method. This helper could take an endpoint and storage source, and return the runV2.Service object. Both createRunService and updateRunService could then call this helper.

// If runtime is specified, use it. Otherwise default to "dart3".
// "dart" is often used as a generic alias, map it to "dart3"
let runtime = context.runtime || "dart3";
if ((runtime as string) === "dart") {
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The type cast (runtime as string) is redundant here, as runtime is guaranteed to be a string at this point. You can simplify this to if (runtime === "dart").

Suggested change
if ((runtime as string) === "dart") {
if (runtime === "dart") {

@brittanycho brittanycho closed this Jan 6, 2026
@brittanycho brittanycho deleted the zip-deploy-4 branch January 6, 2026 20:43
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.

1 participant