Skip to content

Commit

Permalink
Support OutputPaths in OutputDirectory
Browse files Browse the repository at this point in the history
Specifying any number of OutputPaths will ignore OutputFiles (consistent
with uploads). Where an OutputPath specifies an output directory, the
action must be able to create the directory itself.
  • Loading branch information
werkt committed Oct 25, 2023
1 parent f6459d1 commit 018e177
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/main/java/build/buildfarm/worker/shard/CFCExecFileSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -397,16 +397,25 @@ private Set<String> linkedDirectories(
return ImmutableSet.of();
}

private OutputDirectory createOutputDirectory(Command command) {
Iterable<String> files;
Iterable<String> dirs;
if (command.getOutputPathsCount() != 0) {
files = command.getOutputPathsList();
dirs = ImmutableList.of(); // output paths require the action to create their own directory
} else {
files = command.getOutputFilesList();
dirs = command.getOutputDirectoriesList();
}
return OutputDirectory.parse(files, dirs, command.getEnvironmentVariablesList());
}

@Override
public Path createExecDir(
String operationName, Map<Digest, Directory> directoriesIndex, Action action, Command command)
throws IOException, InterruptedException {
Digest inputRootDigest = action.getInputRootDigest();
OutputDirectory outputDirectory =
OutputDirectory.parse(
command.getOutputFilesList(),
command.getOutputDirectoriesList(),
command.getEnvironmentVariablesList());
OutputDirectory outputDirectory = createOutputDirectory(command);

Path execDir = root.resolve(operationName);
if (Files.exists(execDir)) {
Expand Down

0 comments on commit 018e177

Please sign in to comment.