Bug 1409876 - Refuse to perform a VCS checkout into a cache root; r?dustin
This seems like a reasonable thing to enforce.
MozReview-Commit-ID: 3BZQSkwRYeN
--- a/taskcluster/docker/recipes/run-task
+++ b/taskcluster/docker/recipes/run-task
@@ -466,16 +466,24 @@ def main(args):
print_line(b'volume', b'changing ownership of volume %s '
b'to %d:%d\n' % (volume, uid, gid))
set_dir_permissions(volume, uid, gid)
def prepare_checkout_dir(checkout):
if not checkout:
return
+ # The checkout path becomes the working directory. Since there are
+ # special cache files in the cache's root directory and working
+ # directory purging could blow them away, disallow this scenario.
+ if os.path.exists(os.path.join(checkout, '.cacherequires')):
+ print('error: cannot perform vcs checkout into cache root: %s' %
+ checkout)
+ sys.exit(1)
+
# Ensure the directory for the source checkout exists.
try:
os.makedirs(os.path.dirname(checkout))
except OSError as e:
if e.errno != errno.EEXIST:
raise
# And that it is owned by the appropriate user/group.