buchgr / bazel-remote

A remote cache for Bazel
https://bazel.build
Apache License 2.0
594 stars 154 forks source link

BAZEL_REMOTE_MAX_SIZE env variable overwritten when using docker container #689

Closed Ryang20718 closed 1 year ago

Ryang20718 commented 1 year ago
docker run --rm -p 8080:8080 --env "BAZEL_REMOTE_MAX_SIZE=50" buchgr/bazel-remote-cache:v2.4.1
> curl localhost:8080/status
{
 "CurrSize": 0,
 "UncompressedSize": 0,
 "ReservedSize": 0,
 "MaxSize": 5368709120,
 "NumFiles": 0,
 "ServerTime": 1692208091,
 "GitCommit": "c5bf6e13938aa89923c637b5a4f01c2203a3c9f8",
 "NumGoroutines": 9
}
Ryang20718 commented 1 year ago

it seems like --max_size is getting appended to the docker run arg

mostynb commented 1 year ago

I think this is a result of https://github.com/buchgr/bazel-remote/pull/660 - we provide a default value to the docker image with the --max_size command line, and the command line arguments override environment variables.

If you provide a --max_size argument on the docker command line, things should work for you. But it might be better if we could provide a default to the docker image via environment variable instead.

Ryang20718 commented 1 year ago

If you provide a --max_size argument on the docker command line, things should work for you

Yeah, that's what we ended up doing.

But it might be better if we could provide a default to the docker image via environment variable instead.

yeah, we were hoping to have this behaviour as it was before

mostynb commented 1 year ago

Oh, wait... #660 landed on the master branch after v2.4.1, I think it actually fixes this issue. If you run the latest docker image tag instead of v2.4.1 it behaves as expected. Could you check if that works for you too?

Ryang20718 commented 1 year ago

@mostynb works for us!

Wondering when this will a release version?

mostynb commented 1 year ago

I made a v2.4.2 release just now, which should include the fix you want.