aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2024-04-03 11:55:51 +0200
committerosmith <osmith@sysmocom.de>2024-04-03 12:41:11 +0000
commit363e268cdcd3e7409f80ac1b9a8e6a78ff1c0ad1 (patch)
treefb3c5f84fd18ebc58654e2dd9d7ec4f1913939b6
parentc1056236b5b504bdc27be8088f503adfda9467b3 (diff)
jenkins-common: fix_perms: chown files too
Ensure the user that runs docker owns files in cache and data dirs during fix_perms, if an old job created them as root. Change-Id: I43af48bd87e27abad5ad52e734256d78651f67c3
-rw-r--r--jenkins-common.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/jenkins-common.sh b/jenkins-common.sh
index 59224a0..f22158b 100644
--- a/jenkins-common.sh
+++ b/jenkins-common.sh
@@ -386,7 +386,10 @@ fix_perms() {
-v $CACHE_DIR:/cache \
--name ${BUILD_TAG}-cleaner \
"debian:$DEBIAN_DEFAULT" \
- chmod -R a+rX /data/ /cache/
+ sh -e -x -c "
+ chmod -R a+rX /data/ /cache/
+ chown -R $(id -u):$(id -g) /data /cache
+ "
}
collect_logs() {