summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-06-11 20:20:57 +0200
committerCarl Hetherington <cth@carlh.net>2020-06-11 20:20:57 +0200
commitb08c842ef460a6ba2cf1edea34e27a93c48fb3d7 (patch)
treedf14b24c5c74262ae0c8eb3cbc5b90b0354211e8
parent9f221ed6181407a13c89d2a8168e9f510e5bb426 (diff)
Work around for permissions problems when different users share a ccache.
-rwxr-xr-xcdist2
-rwxr-xr-xmake-ccache-volume8
2 files changed, 6 insertions, 4 deletions
diff --git a/cdist b/cdist
index 84814ac..01e016c 100755
--- a/cdist
+++ b/cdist
@@ -554,7 +554,7 @@ class DockerTarget(Target):
if self.privileged:
opts += '--privileged=true '
if self.ccache:
- opts += "-e CCACHE_DIR=/ccache/%s --mount source=ccache,target=/ccache" % self.image
+ opts += "-e CCACHE_DIR=/ccache/%s-%d --mount source=ccache,target=/ccache" % (self.image, os.getuid())
tag = self.image
if config.has('docker_hub_repository'):
diff --git a/make-ccache-volume b/make-ccache-volume
index 60a2e42..aa284d2 100755
--- a/make-ccache-volume
+++ b/make-ccache-volume
@@ -2,8 +2,10 @@
docker volume create ccache
id=$(docker run --mount source=ccache,target=/ccache -itd ubuntu-18.04-64 bash)
-for t in ubuntu-18.04-64 windows windows_2.15.x; do
- docker exec $id mkdir /ccache/$t
- docker exec $id chown carl /ccache/$t
+for u in 127 1000; do
+ for t in ubuntu-18.04-64 windows windows_2.15.x; do
+ docker exec $id mkdir /ccache/$t-$u
+ docker exec $id chmod 777 /ccache/$t-$u
+ done
done
docker kill $id