##// END OF EJS Templates
Fixed docker build output handling. Handled with 'info' log level.
cin -
r21:452b9915903c v1.3.1 default
parent child
Show More
@@ -1,2 +1,2
1 1 group=org.implab.gradle
2 version=1.3.0 No newline at end of file
2 version=1.3.1 No newline at end of file
@@ -2,6 +2,7 package org.implab.gradle.containers.cli
2 2
3 3 import java.io.File;
4 4 import java.io.IOException;
5 import java.lang.ProcessBuilder.Redirect;
5 6 import java.util.ArrayList;
6 7 import java.util.Collection;
7 8 import java.util.List;
@@ -31,6 +32,15 public class ProcessSpec {
31 32 builder.command(this.command);
32 33 builder.directory(directory);
33 34
35 // discard stdout if not redirected
36 if (outputRedirect == null)
37 builder.redirectOutput(Redirect.DISCARD);
38
39 // discard stderr if not redirected
40 if (errorRedirect == null)
41 builder.redirectError(Redirect.DISCARD);
42
43 // run process
34 44 var proc = builder.start();
35 45
36 46 tasks.add(proc.onExit());
@@ -19,7 +19,6 import java.nio.file.Files;
19 19 import java.util.List;
20 20 import org.gradle.api.Action;
21 21 import org.gradle.api.GradleException;
22 import org.gradle.api.file.Directory;
23 22 import org.gradle.api.file.FileSystemLocation;
24 23 import org.gradle.internal.impldep.org.bouncycastle.util.Iterable;
25 24
@@ -24,6 +24,7 import java.io.File;
24 24 import java.io.IOException;
25 25
26 26 import org.implab.gradle.containers.cli.ImageRef;
27 import org.implab.gradle.containers.cli.RedirectTo;
27 28 import org.implab.gradle.containers.cli.Utils;
28 29 import org.implab.gradle.containers.dsl.MapPropertyEntry;
29 30 import org.implab.gradle.containers.dsl.OptionsMixin;
@@ -91,6 +92,12 public abstract class BuildImage extends
91 92 }
92 93 }
93 94
95 @Override
96 protected java.util.Optional<RedirectTo> loggerErrorRedirect() {
97 // https://github.com/moby/buildkit/issues/1186
98 return loggerInfoRedirect();
99 }
100
94 101 @TaskAction
95 102 public void run() throws Exception {
96 103 List<String> args = new ArrayList<>();
@@ -43,11 +43,15 public abstract class DockerCliTask exte
43 43 }
44 44
45 45 protected Optional<RedirectTo> loggerInfoRedirect() {
46 return getLogger().isInfoEnabled() ? Optional.of(RedirectTo.consumer(getLogger()::info)) : Optional.empty();
46 return getLogger().isInfoEnabled() ?
47 Optional.of(RedirectTo.consumer(getLogger()::info)) :
48 Optional.empty();
47 49 }
48 50
49 51 protected Optional<RedirectTo> loggerErrorRedirect() {
50 return getLogger().isErrorEnabled() ? Optional.of(RedirectTo.consumer(getLogger()::error)) : Optional.empty();
52 return getLogger().isErrorEnabled() ?
53 Optional.of(RedirectTo.consumer(getLogger()::error)) :
54 Optional.empty();
51 55 }
52 56
53 57 protected Optional<RedirectTo> stdoutRedirection() {
@@ -85,7 +89,6 public abstract class DockerCliTask exte
85 89 }
86 90
87 91 protected void exec(ProcessSpec spec) throws InterruptedException, ExecutionException, IOException {
88
89 92 stdoutRedirection().ifPresent(spec::redirectStdout);
90 93 stderrRedirection().ifPresent(spec::redirectStderr);
91 94 stdinRedirection().ifPresent(spec::redirectStdin);
General Comments 0
You need to be logged in to leave comments. Login now