-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
more fixes for image consolidation / bazel caching #6713
Conversation
I'm still committed to refactoring how we make the bazel cache RCs once (if?) we move nursery out of experimental, but for now yes: more bash 🙃 |
/area images |
262f704
to
b4a4707
Compare
GCC_VERSION=$(package_version gcc) | ||
echo "build --action_env=__CACHE_GCC_VERSION__=${GCC_VERSION}" >> $1 | ||
PYTHON_VERSION=$(package_version python) | ||
echo "build --action_env=__CACHE_PYTHON_VERSION__=${PYTHON_VERSION}" >> $1 |
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.
FYI if you want to stop writing echo ... >> $1
all the time, you can probably do something like
cat >$1 <<EOF
# this is the default for recent releases but we set it explicitly
# since this is the only hash our cache supports
startup --host_jvm_args=-Dbazel.DigestFunction=sha256
# use remote caching for all the things
build --experimental_remote_spawn_cache
# point it at our http cache ...
build --remote_http_cache=${CACHE_HOST}
...
EOF
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.
hmm the downside to this is that I have to deindent the block being written and the whole block highlights as a string 🤷♂️
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.
other alternatives:
- wrap everything in a subshell
( )
, e.g.
(
echo "blah"
) > $1
- Rather than having
make_bazel_rc
take an argument, just pipe it to a file below, e.g.
make_bazel_rc > "${HOME}/.bazelrc"
make_bazel_rc > /etc/bazel.bazelrc
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.
(don't consider these comments blocking, though)
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! I'll go with one of these. Blocking this myself on verifying that I can disrupt the cache with GCC version locally and then fix it with these args. Will do one of these first.
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.
done
what do you mean by "clean test-infra logs"? |
We get a lot of spam in the new builds: https://k8s-gubernator.appspot.com/build/kubernetes-jenkins/pr-logs/pull/test-infra/6713/pull-test-infra-bazel/12990/?log#log which I suspect is due to missing tooling, not much else has changed so my best bet right now is outdated python tools. |
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.
/lgtm
/hold
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: BenTheElder, krzyzacy The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these OWNERS Files:
Approvers can indicate their approval by writing |
@@ -19,6 +19,10 @@ | |||
# TODO(bentheelder): verify that this works and move it into the images | |||
CACHE_HOST="http://bazel-cache.default:8080" | |||
|
|||
package_version () { | |||
dpkg-query --showformat='${Version}' --show $1 |
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.
This is correct for getting a package version but not sufficient for tracking what $CC
actually points to if we install other versions etc. updating in a bit with something smarter based on intentionally breaking the cache with planter and a local instance of the remote cache.
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 $CC --version
? contains spaces and strings, so needs quoting.
I'm also curious how stdlib includes are accounted for in caching.
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.
also curious: does the caching take into account the --crosstool
and --cpu
flags?
GCC_VERSION=$(package_version gcc) | ||
echo "build --action_env=__CACHE_GCC_VERSION__=${GCC_VERSION}" >> $1 | ||
PYTHON_VERSION=$(package_version python) | ||
echo "build --action_env=__CACHE_PYTHON_VERSION__=${PYTHON_VERSION}" >> $1 |
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.
I think you also need build --experimental_strict_action_env
for these to take effect.. https://docs.bazel.build/versions/master/command-line-reference.html
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.
nope..
Today I proved locally that if you switch GCC versions system-wide inside planter and try to reuse the remote cache you get poisoned results because bazel doesn't have any way to track the host binaries that aren't actually registered with bazel currently. The proposed work around of My next thought is to use the tooling tracking to create a meta "cache version" key we insert into bazelrc like https://docs.bazel.build/versions/master/remote-caching.html#http-caching-protocol |
b4a4707
to
9c795fb
Compare
/hold cancel |
Following up with @buchgr on this idea, will experiment locally a bit. |
/assign @ixdy @krzyzacy