When building a change for operations/software/gerrit/plugins/events-wikimedia the job wipe the log dir but fails due to a missing permission:
+ exec docker run --entrypoint=/usr/bin/find --user=nobody --volume /srv/jenkins/workspace/gerrit-events-wikimedia-bazel-docker:/workspace --security-opt seccomp=unconfined --init --rm --label jenkins.job=gerrit-events-wikimedia-bazel-docker --label jenkins.build=26 --env-file /dev/fd/63 docker-registry.wikimedia.org/buster:latest /workspace/log -mindepth 1 -delete ++ /usr/bin/env ++ egrep -v '^(HOME|SHELL|PATH|LOGNAME|MAIL)=' /usr/bin/find: cannot delete ‘/workspace/log/execroot/eventsWikimedia/bazel-out/k8-fastbuild/bin/external/bazel_tools/tools/jdk/platformclasspath_classes/DumpPlatformClassPath.class’: Permission denied /usr/bin/find: cannot delete ‘/workspace/log/execroot/eventsWikimedia/bazel-out/k8-fastbuild/bin/external/bazel_tools/tools/jdk/platformclasspath_classes’: Directory not empty /usr/bin/find: cannot delete ‘/workspace/log/execroot/eventsWikimedia/bazel-out/k8-fastbuild/bin/external/bazel_tools/tools/jdk’: Directory not empty /usr/bin/find: cannot delete ‘/workspace/log/execroot/eventsWikimedia/bazel-out/k8-fastbuild/bin/external/bazel_tools/tools’: Directory not empty /usr/bin/find: cannot delete ‘/workspace/log/execroot/eventsWikimedia/bazel-out/k8-fastbuild/bin/external/bazel_tools’: Directory not empty /usr/bin/find: cannot delete ‘/workspace/log/execroot/eventsWikimedia/bazel-out/k8-fastbuild/bin/external’: Directory not empty /usr/bin/find: cannot delete ‘/workspace/log/execroot/eventsWikimedia/bazel-out/k8-fastbuild/bin’: Directory not empty /usr/bin/find: cannot delete ‘/workspace/log/execroot/eventsWikimedia/bazel-out/k8-fastbuild’: Directory not empty /usr/bin/find: cannot delete ‘/workspace/log/execroot/eventsWikimedia/bazel-out’: Directory not empty /usr/bin/find: cannot delete ‘/workspace/log/execroot/eventsWikimedia’: Directory not empty /usr/bin/find: cannot delete ‘/workspace/log/execroot’: Directory not empty Build step 'Execute shell' marked build as failure Finished: FAILURE
The file bazel-out/k8-fastbuild/bin/external/bazel_tools/tools/jdk/platformclasspath_classes/DumpPlatformClassPath.class has permissions -r-xr-xr-x and the parent directory has dr-xr-xr-x. The find command is thus unable to delete the file since the directory lack the write permission.
Seems to be related to https://github.com/bazelbuild/bazel/issues/15616
The Docker image uses Bazelisk and loads Bazel 5.3.1:
+ bazelisk version 2022/10/07 13:08:16 Downloading https://releases.bazel.build/5.3.1/release/bazel-5.3.1-linux-x86_64... + bazel info ... release: release 5.3.1 ...