... |
... |
@@ -56,7 +56,10 @@ class CASCache(ArtifactCache): |
56
|
56
|
super().__init__(context)
|
57
|
57
|
|
58
|
58
|
self.casdir = os.path.join(context.artifactdir, 'cas')
|
59
|
|
- os.makedirs(os.path.join(self.casdir, 'tmp'), exist_ok=True)
|
|
59
|
+ os.makedirs(self.casdir, exist_ok=True)
|
|
60
|
+
|
|
61
|
+ self.tmpdir = os.path.join(context.artifactdir, 'tmp')
|
|
62
|
+ os.makedirs(self.tmpdir, exist_ok=True)
|
60
|
63
|
|
61
|
64
|
self._enable_push = enable_push
|
62
|
65
|
|
... |
... |
@@ -394,7 +397,7 @@ class CASCache(ArtifactCache): |
394
|
397
|
try:
|
395
|
398
|
h = hashlib.sha256()
|
396
|
399
|
# Always write out new file to avoid corruption if input file is modified
|
397
|
|
- with tempfile.NamedTemporaryFile(dir=os.path.join(self.casdir, 'tmp')) as out:
|
|
400
|
+ with tempfile.NamedTemporaryFile(dir=self.tmpdir) as out:
|
398
|
401
|
# Set mode bits to 0644
|
399
|
402
|
os.chmod(out.name, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH)
|
400
|
403
|
|
... |
... |
@@ -764,7 +767,7 @@ class CASCache(ArtifactCache): |
764
|
767
|
# already in local cache
|
765
|
768
|
return
|
766
|
769
|
|
767
|
|
- with tempfile.NamedTemporaryFile(dir=os.path.join(self.casdir, 'tmp')) as out:
|
|
770
|
+ with tempfile.NamedTemporaryFile(dir=self.tmpdir) as out:
|
768
|
771
|
self._fetch_blob(remote, tree, out)
|
769
|
772
|
|
770
|
773
|
directory = remote_execution_pb2.Directory()
|
... |
... |
@@ -778,7 +781,7 @@ class CASCache(ArtifactCache): |
778
|
781
|
# already in local cache
|
779
|
782
|
continue
|
780
|
783
|
|
781
|
|
- with tempfile.NamedTemporaryFile(dir=os.path.join(self.casdir, 'tmp')) as f:
|
|
784
|
+ with tempfile.NamedTemporaryFile(dir=self.tmpdir) as f:
|
782
|
785
|
self._fetch_blob(remote, filenode.digest, f)
|
783
|
786
|
|
784
|
787
|
digest = self.add_object(path=f.name)
|