sphinx: Fix the creation of the pre-commit file during the mr update
Change the default permission of the ~jenkins/.cache directory created by the --mount option on the RUN command It fixes all the following errors:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/jenkins/.local/bin/pre-commit", line 10, in <module>
sys.exit(main())
File "/home/jenkins/.local/lib/python3.7/site-packages/pre_commit/main.py", line 398, in main
f'Command {args.command} failed to exit with a returncode',
File "/usr/lib/python3.7/contextlib.py", line 130, in __exit__
self.gen.throw(type, value, traceback)
File "/home/jenkins/.local/lib/python3.7/site-packages/pre_commit/error_handler.py", line 73, in error_handler
_log_and_exit(msg, ret_code, e, traceback.format_exc())
File "/home/jenkins/.local/lib/python3.7/site-packages/pre_commit/error_handler.py", line 24, in _log_and_exit
storedir = Store().directory
File "/home/jenkins/.local/lib/python3.7/site-packages/pre_commit/store.py", line 52, in __init__
os.makedirs(self.directory, exist_ok=True)
File "/usr/lib/python3.7/os.py", line 221, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/home/jenkins/.cache/pre-commit'
Test Plan
make
docker run --rm -ti --entrypoint bash swh-jenkins/sphinx
mkdir ~/workspace
cd ~/workspace
git clone https://forge.softwareheritage.org/source/swh-environment.git
mr -j 4 -t update
there is no more errors
Migrated from D5674 (view on Phabricator)