Merge pull request #73 from gjrtimmer/fix/chown

fix apply chown permissions in parallel for large workspace
This commit is contained in:
aptalca 2021-09-16 13:43:44 -04:00 committed by GitHub
commit 44f7b9fc5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 2 deletions

View File

@ -260,6 +260,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
## Versions
* **16.09.21:** - Fix slow `chown` on large workspace (contents of workspace folder no longer chowned).
* **11.07.21:** - Bump node to 14 to fix builds
* **08.05.21:** - Fix doc link
* **04.02.20:** - Allow setting gui password via hash using env var `HASHED_PASSWORD`.

View File

@ -75,6 +75,7 @@ app_setup_block: |
# changelog
changelogs:
- { date: "16.09.21:", desc: "Fix slow `chown` on large workspace (contents of workspace folder no longer chowned)." }
- { date: "11.07.21:", desc: "Bump node to 14 to fix builds" }
- { date: "08.05.21:", desc: "Fix doc link" }
- { date: "04.02.20:", desc: "Allow setting gui password via hash using env var `HASHED_PASSWORD`." }

View File

@ -18,5 +18,20 @@ if [ -n "${SUDO_PASSWORD}" ] || [ -n "${SUDO_PASSWORD_HASH}" ]; then
fi
# permissions
chown -R abc:abc \
/config
if [ -f "/usr/bin/find" ] && [ -f "/usr/bin/xargs" ]; then
CORES=$(nproc --all)
# Split workload between config and workspace
echo "setting permissions::configuration"
find /config -path /config/workspace -prune -false -o -type d -print0 | \
xargs --null -r --max-args=1 --max-procs=$((CORES*2*8)) \
chown -R abc:abc
echo "setting permissions::workspace"
chown abc:abc /config/workspace
else
# Set permissions on data mount
# do not decend into the workspace
chown -R abc:abc "$(ls /config -I workspace)"
chown abc:abc /config/workspace
fi