Skip to content

test(build): support build cache inside tests via env var#4815

Open
geertj wants to merge 1 commit into
GoogleCloudPlatform:masterfrom
geertj:test-build-cache
Open

test(build): support build cache inside tests via env var#4815
geertj wants to merge 1 commit into
GoogleCloudPlatform:masterfrom
geertj:test-build-cache

Conversation

@geertj

@geertj geertj commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

Checking GCSFUSE_USE_BUILD_CACHE environment variable in buildBinaries. If it is set to "true", we skip creating temporary, isolated GOPATH and GOCACHE folders and compile in standard module mode.

This keeps GCSFuse building cleanly/isolated by default, but allows unit tests to set GCSFUSE_USE_BUILD_CACHE to speed up TestVersion execution time from ~24s to ~3.6s.

TAG=agy
CONV=8c7b5ab6-91ae-4a84-911e-1788917d5ab8

@geertj
geertj requested review from a team and meet2mky as code owners June 27, 2026 22:57
@geertj
geertj requested a review from charith87 June 27, 2026 22:57
@gemini-code-assist

Copy link
Copy Markdown
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 optimizes the build process for gcsfuse by providing an opt-in mechanism to use the standard Go build cache. By allowing the build system to skip the creation of temporary, isolated directories when requested, the change improves developer productivity and reduces CI test execution times.

Highlights

  • Build Cache Support: Introduced the GCSFUSE_USE_BUILD_CACHE environment variable to allow bypassing isolated GOPATH and GOCACHE creation during builds.
  • Performance Optimization: Enabled build caching in unit tests, significantly reducing the execution time of TestVersion from approximately 24 seconds to 3.6 seconds.
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 the 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 counterproductive. 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.

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.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces build cache support for gcsfuse builds by checking the GCSFUSE_USE_BUILD_CACHE environment variable. When enabled, it skips creating temporary GOPATH and GOCACHE directories, which speeds up the build process and is also utilized in tests. The review feedback suggests improving the robustness of the environment variable check by supporting case-insensitive values and alternative truthy representations like '1'.

Comment thread tools/build_gcsfuse/main.go Outdated
@geertj
geertj force-pushed the test-build-cache branch from 01db922 to bab899e Compare June 29, 2026 19:12
Comment thread tools/build_gcsfuse/main.go Outdated
@geertj
geertj force-pushed the test-build-cache branch from bab899e to 09dcc05 Compare June 30, 2026 11:50
Checking GCSFUSE_USE_BUILD_CACHE environment variable in buildBinaries. If it is
set to "1", we skip creating temporary, isolated GOPATH and GOCACHE folders
and compile in standard module mode.

This keeps GCSFuse building cleanly/isolated by default, but allows unit tests
to set GCSFUSE_USE_BUILD_CACHE to speed up TestVersion execution time from ~24s
to ~3.6s.

TAG=agy
CONV=312f09e2-2411-4455-9356-e38ad717168f
@geertj
geertj force-pushed the test-build-cache branch from 09dcc05 to af023f8 Compare June 30, 2026 11:55
@charith87
charith87 self-requested a review June 30, 2026 15:57
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.

2 participants