Skip to content

[Bazel] Check cache directory exists before changing owners #1241

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
merged 1 commit into from
Aug 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/workflows/bazelBuildAndTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,15 @@ jobs:
path: ~/.cache/bazel
key: ubuntu_x86_64_torch_mlir_bazel_build_cache

# Change bazel cache directory to root ownership
# to allow writing to it from within the docker container.
# If no cache hits, this directory is not present
# so don't run chown (will error otherwise).
- name: Set bazel cache permissions
run: |
sudo chown -R root:root "${HOME}/.cache/bazel"
if [ -d "${HOME}/.cache/bazel" ]; then
sudo chown -R root:root "${HOME}/.cache/bazel"
fi

- name: Build docker image
run: |
Expand All @@ -49,9 +55,14 @@ jobs:
torch-mlir:ci \
./utils/bazel/docker/run_bazel_build.sh

# Switch back bazel cache directory to user ownership
# to allow GHA post-cache step to save cache without
# permissions issue.
- name: Switch bazel cache permissions
run: |
sudo chown -R "$USER":"$USER" "${HOME}/.cache/bazel"
if [ -d "${HOME}/.cache/bazel" ]; then
sudo chown -R "$USER":"$USER" "${HOME}/.cache/bazel"
fi

- name: Send mail
if: failure()
Expand Down