-
Notifications
You must be signed in to change notification settings - Fork 155
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
Add configs for readonly and writeonly proxies. #76
Conversation
This is configured via separate In the code it's represented as a Happy to change the config to be a mode enum in yaml as well if that is preferable. |
cache/http/http.go
Outdated
@@ -26,6 +34,7 @@ type remoteHTTPProxyCache struct { | |||
remote *http.Client | |||
baseURL *url.URL | |||
local cache.Cache | |||
mode Mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe 'accessMode'?
cache/http/http.go
Outdated
@@ -92,6 +102,10 @@ func (r *remoteHTTPProxyCache) Put(kind cache.EntryKind, hash string, size int64 | |||
} | |||
r.local.Put(kind, hash, size, data) | |||
|
|||
if r.mode&Write == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding spaces: r.mode & Write?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gofmt
formats this without spaces.
@@ -14,10 +14,14 @@ type GoogleCloudStorageConfig struct { | |||
Bucket string `yaml:"bucket"` | |||
UseDefaultCredentials bool `yaml:"use_default_credentials"` | |||
JSONCredentialsFile string `yaml:"json_credentials_file"` | |||
DisableReads bool `yaml:"disable_reads"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just curious, what is the use case for disable_reads?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Write through from a cache that is less likely to get poisoned to one that is more likely to, and being able to shared cached artefacts without blocking any builds.
For example if your CI cache is in a data center and your developer cache is in the office, the link between them might not be as fast as the link between developers and the developer cache. In that case waiting to download the artefact from the data center cache might be generally slower than building locally. But if you set up write through the data center cache can slowly send artefacts to the developer cache without blocking any builds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! If the network is slow and is blocking the Dev box's build, understood we want to disable read. However, we may also want to disable write too as we may not want upload cache from Dev box? In this case 'disable_reads' and 'disable_writes' should be used at the same time, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Developer machine <===> developer cache <---> CI cache
^ ^
fast connection slow connection
Developer machines can quickly read and write to developer cache, developer cache can slowly write to CI cache without blocking developers because uploads are asynchronous, but it cannot slowly read from CI cache without blocking developers because downloads are synchronous.
One thing that trips me is the negated logic of |
ping @buchgr |
ping @buchgr |
1 similar comment
ping @buchgr |
We could really use this feature. @uri-canva would you reopen this if @buchgr would accept it? How about it @buchgr 🙏? |
We're not using this patch anymore ourselves, as it didn't fit our purpose as well as I thought, you're welcome to base a new PR on it though. |
Since there are a few interrelated issues/PRs on this topic, I want to make sure that I understand the use case... Is this the scenario:
|
I’ll let @uri-canva answer for their situation, but for us it is much simpler, we only really need the
Essentially, if |
Disregard the note around
We use it to fall back to reading from a remote cache too, which Bazel doesn't do. |
Implements #69.