Skip to content

Implement Cloud Run no build feature.#171

Draft
CoasterJX wants to merge 2 commits into
mainfrom
improve-cloud-run-from-source
Draft

Implement Cloud Run no build feature.#171
CoasterJX wants to merge 2 commits into
mainfrom
improve-cloud-run-from-source

Conversation

@CoasterJX
Copy link
Copy Markdown
Contributor

Added Cloud Run no build support for the following cases:

  • Node.js: Download dependencies locally (npm install), then deploy using a ready-made Node.js image to run index.js.
  • Python: Download dependencies locally into a ./vendor folder, then deploy using a ready-made Python image to run main.py.
  • Go: Compile a Linux binary file locally, then deploy using a lightweight OS-only image to run ./main.

The implementation is done as a dedicated MCP tool deploy_cloudrun_service_no_build. Currently using gcloud cmd as placeholder, will replace it with RestAPI call as the next step.

Also tried creating more structured subfolders rather than putting all in reference and it seems to work very well (ease the burden of SKILL.md). Maybe we can adopt this structure to other workflows as well.

@CoasterJX CoasterJX marked this pull request as draft May 14, 2026 22:02
Copy link
Copy Markdown
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 workflow for Google Cloud Run, enabling direct source deployment via a new MCP tool and supporting Node.js, Python, and Go. The implementation includes updates to the Cloud Run client, registration of the new tool, and detailed documentation guides. Review feedback highlights a critical error regarding an invalid Go version in the workspace configuration and identifies a potential bug in how command-line arguments and environment variables are delimited. Additionally, the reviewer suggested using more idiomatic Go patterns, such as strings.Join, to improve code efficiency and readability.

Comment thread go.work
@@ -0,0 +1,7 @@
go 1.25.5
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.

high

The Go version 1.25.5 specified here is not a valid release version (the current latest stable version is 1.24). This will cause build errors for users with standard Go toolchains. Please update it to a supported version like 1.24 or 1.23.

argStr += a
}
if argStr != "" {
args = append(args, "--args", argStr)
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.

high

The gcloud CLI's --args and --set-env-vars flags use commas as delimiters. If any argument or environment variable value contains a comma, gcloud will split it incorrectly. To handle values with commas safely, you should either escape them (e.g., using the ^ delimiter prefix supported by gcloud) or use a more robust method like --env-vars-file for environment variables.

Comment on lines +213 to +219
var argStr string
for i, a := range cmdArgs {
if i > 0 {
argStr += ","
}
argStr += a
}
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.

medium

Using strings.Join is more idiomatic and efficient than manual string concatenation in a loop, as it avoids multiple allocations. Note that this requires importing the strings package.

Suggested change
var argStr string
for i, a := range cmdArgs {
if i > 0 {
argStr += ","
}
argStr += a
}
argStr := strings.Join(cmdArgs, ",")

Comment on lines +225 to +233
var envStr string
i := 0
for k, v := range envVars {
if i > 0 {
envStr += ","
}
envStr += fmt.Sprintf("%s=%s", k, v)
i++
}
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.

medium

This manual loop for joining environment variables can be simplified and made more efficient using strings.Join.

		envPairs := make([]string, 0, len(envVars))
		for k, v := range envVars {
			envPairs = append(envPairs, fmt.Sprintf("%s=%s", k, v))
		}
		envStr := strings.Join(envPairs, ",")

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