Skip to content

Binary provisioning/add cache dir flag #4743

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

Merged

Conversation

pablochacin
Copy link
Contributor

@pablochacin pablochacin commented Apr 24, 2025

What?

Adds a flag for configuring the directory used to cache provisioned binaries.

Why?

The default value may result confusing as it makes reference to the k6provider library.

Fixes #4741

Checklist

  • I have performed a self-review of my code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests for my changes.
  • I have run linter and tests locally (make check) and all pass.

Checklist: Documentation (only for k6 maintainers and if relevant)

Please do not merge this PR until the following items are filled out.

  • I have added the correct milestone and labels to the PR.
  • I have updated the release notes: link
  • I have updated or added an issue to the k6-documentation: grafana/k6-docs#NUMBER if applicable
  • I have updated or added an issue to the TypeScript definitions: grafana/k6-DefinitelyTyped#NUMBER if applicable

Related PR(s)/Issue(s)

Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
@pablochacin pablochacin changed the base branch from master to feat/binary-provisioning April 24, 2025 18:33
Copy link
Contributor

@codebien codebien left a comment

Choose a reason for hiding this comment

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

LGTM, just one comment

Comment on lines 230 to 232
if val, ok := env["K6_BINARY_CACHE"]; ok {
result.BinaryCache = val
}
Copy link
Contributor

@codebien codebien Apr 29, 2025

Choose a reason for hiding this comment

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

Suggested change
if val, ok := env["K6_BINARY_CACHE"]; ok {
result.BinaryCache = val
}

I don't think we have to introduce this option. Go already provides a way to override the OS cache dir, if they really need it. However, even if it would be required, I would prefer if we wait for a real feature-request instead of introducing it now so we can keep the API very essential.

Copy link
Contributor Author

@pablochacin pablochacin Apr 29, 2025

Choose a reason for hiding this comment

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

I introduced it because IIRC we use it in the cloud, when we have a distroless image and UserCacheDir doesn't behave as expected.

Also, I'm not sure I want a k6 user to have to deal with a go setting ($GOCACHE) instead of a setting related to a feature they are using.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Elaborating on my previous comment, the cache dir we are discussing is for storing the custom binaries downloaded from the build service, there's no go involved (users don't need to have it). Moreover, if in the future we support local builds, these two caches will be different

@pablochacin pablochacin marked this pull request as ready for review April 29, 2025 16:31
@pablochacin pablochacin requested a review from a team as a code owner April 29, 2025 16:31
@pablochacin pablochacin requested review from mstoykov and the-it and removed request for a team April 29, 2025 16:31
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
@codebien codebien merged commit 7034e39 into feat/binary-provisioning Apr 30, 2025
18 of 25 checks passed
@codebien codebien deleted the binary-provisioning/add-cache-dir-flag branch April 30, 2025 09:59
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