Use repository specific work dirs (#1510)

With this change, work dirs are created in the
directory of the repository and no longer in the
global scm work dir directory. This is relevant due
to two facts:

1. Repositories may contain confidential data and therefore
   reside in special directories (that may be mounted on
   special drives). It may be considered a breach when these
   directories are cloned or otherwise copied to global
   temporary drives.
2. Big repositories may overload global temp spaces. It may be
   easier to create special drives with more space for such
   big repositories.
This commit is contained in:
René Pfeuffer
2021-01-28 12:53:39 +01:00
committed by GitHub
parent 57c9484d41
commit bd3671b428
23 changed files with 167 additions and 43 deletions

View File

@@ -107,7 +107,7 @@ public class FullScmRepositoryExporter {
}
private void writeRepository(RepositoryService service, TarArchiveOutputStream taos) throws IOException {
File newWorkdir = workdirProvider.createNewWorkdir();
File newWorkdir = workdirProvider.createNewWorkdir(service.getRepository().getId());
try {
File repositoryFile = Files.createFile(Paths.get(newWorkdir.getPath(), "repository")).toFile();
try (FileOutputStream repositoryFos = new FileOutputStream(repositoryFile)) {
@@ -124,7 +124,7 @@ public class FullScmRepositoryExporter {
}
private void writeStoreData(Repository repository, TarArchiveOutputStream taos) throws IOException {
File newWorkdir = workdirProvider.createNewWorkdir();
File newWorkdir = workdirProvider.createNewWorkdir(repository.getId());
try {
File metadata = Files.createFile(Paths.get(newWorkdir.getPath(), "metadata")).toFile();
try (FileOutputStream metadataFos = new FileOutputStream(metadata)) {