Fix lock file permissions for multi-user/container access
Problem
Lock files created by Docker containers (running as UID 2000/hived_admin) were not writable by other users, causing Permission denied errors:
touch: setting times of '/nfs/ci-cache/.global_lock': Permission denied
This caused cache-manager.sh put to fail silently, and downstream jobs that depended on the cache would fail with cache miss errors.
Solution
Add _touch_lock() helper function that:
- Creates new lock files with 666 permissions using
install -m 666 - Attempts to fix permissions on existing lock files with
chmod 666
All lock file touch operations now use this helper.
Testing
Tested manually on hive-builder-10:
# Before fix
$ /tmp/cache-manager.sh put test testkey123 /tmp/test-cache
touch: setting times of '/nfs/ci-cache/.global_lock': Permission denied
Exit code: 1
# After fix
$ /tmp/cache-manager.sh put test testkey456 /tmp/test-cache
[cache-manager] Storing cache on NFS host: /nfs/ci-cache/test/testkey456.tar
[cache-manager] Cache stored successfully on NFS host
Exit code: 0