Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow overriding the location of the build cache #18

Closed
pablochacin opened this issue Oct 5, 2023 · 5 comments
Closed

Allow overriding the location of the build cache #18

pablochacin opened this issue Oct 5, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@pablochacin
Copy link

Enhancement Description

Add a flag such as --cache to allow overriding the location of the build cache.

Suggested Solution (optional)

No response

Already existing or connected issues / PRs (optional)

No response

@pablochacin pablochacin added the enhancement New feature or request label Oct 5, 2023
@szkiba
Copy link
Collaborator

szkiba commented Oct 6, 2023

Hi @pablochacin , I would like to ask you for clarification. What do you mean by build cache? What is the use case that this flag solves?

The binary location of k6 can be specified using the --bin-dir flag. In general, the location of the cache (used by k6x and e.g. go builder) can be specified in the XDG_CACHE_HOME environment variable. The go build cache can be specified in the GOCACHE environment variable. The go module cache can be specified in the GOMODCACHE environment variable.

Since k6x is primarily a k6 launcher, I try to minimize the number of flags to avoid potential conflicts with k6 flags.

It is conceivable that the k6x cache directory (which is currently k6x under XDG_CACHE_HOME) could be specified in a K6X_CACHE_DIR environment variable (and with a --cache-dir flag). Is this what you mean by build cache? This directory contains the k6x bin directory and the http cache used for build preparation. The http cache contains GitHub API responses to avoid restrictions caused by the rate limit. This is a small cache.

@pablochacin
Copy link
Author

pablochacin commented Oct 6, 2023

It is conceivable that the k6x cache directory (which is currently k6x under XDG_CACHE_HOME) could be specified in a K6X_CACHE_DIR environment variable (and with a --cache-dir flag). Is this what you mean by build cache?

Yes. This is precisely what this issue is about.

Since k6x is primarily a k6 launcher, I try to minimize the number of flags to avoid potential conflicts with k6 flags.

This is a valid point. A simple way to overcome this is to use k6x as a prefix for options. For example k6x-build-cache

@szkiba
Copy link
Collaborator

szkiba commented Oct 6, 2023

The next release will include --cache-dir and K6X_CACHE_DIR support.

I also thought about prefixing the flag, but it doesn't seem like an aesthetic solution. I have put the topic on hold for now until it causes a problem.

@pablochacin
Copy link
Author

Awesome, thanks.

@szkiba szkiba mentioned this issue Oct 10, 2023
@szkiba
Copy link
Collaborator

szkiba commented Oct 10, 2023

Hi @pablochacin , The v0.4.0 release includes this feature.

@szkiba szkiba closed this as completed Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants