Skip to content

Commit 6ad364a

Browse files
author
Thierry Corbin
authored
Accelerate map_uidgid
Hi, I use the function "map_uidgid" and each restart of the container is at least 30 seconds for the command chown. With this change I am 1 second. I added the path ${GITLAB_HOME} at the end to not get an error if the "find" finds nothing. does this change suit you?
1 parent 31a7a7e commit 6ad364a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

assets/runtime/functions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,7 @@ map_uidgid() {
11441144
echo "Mapping UID and GID for ${GITLAB_USER}:${GITLAB_USER} to $USERMAP_UID:$USERMAP_GID"
11451145
groupmod -o -g ${USERMAP_GID} ${GITLAB_USER}
11461146
sed -i -e "s|:${USERMAP_ORIG_UID}:${USERMAP_GID}:|:${USERMAP_UID}:${USERMAP_GID}:|" /etc/passwd
1147-
find ${GITLAB_HOME} -path ${GITLAB_DATA_DIR}/\* -prune -o -print0 | xargs -0 chown -h ${GITLAB_USER}:
1147+
find ${GITLAB_HOME} -path ${GITLAB_DATA_DIR}/\* \( ! -uid ${USERMAP_ORIG_UID} -o ! -gid ${USERMAP_ORIG_GID} \) -print0 | xargs -0 chown -h ${GITLAB_USER}: ${GITLAB_HOME}
11481148
fi
11491149
}
11501150

0 commit comments

Comments
 (0)