-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable Log Updates for JIB ProgressBar - supporting jib.console = plain functionality #894
Comments
We should reuse (the existing This is what we are doing in with AnsiLogger: Which is initialized in (amongst other places): |
@manusa that gave me the thought to implement a simple solution based on the static nature of the JibServiceUtil class. The output on a useColor=false run will just output when the progress is complete for each task. If it's an acceptable approach/implementation I'll create a pull request. --- a/jkube-kit/build/service/jib/src/main/java/org/eclipse/jkube/kit/service/jib/JibServiceUtil.java
+++ b/jkube-kit/build/service/jib/src/main/java/org/eclipse/jkube/kit/service/jib/JibServiceUtil.java
@@ -39,6 +39,7 @@ import org.eclipse.jkube.kit.config.image.ImageConfiguration;
import org.eclipse.jkube.kit.config.image.ImageName;
import org.eclipse.jkube.kit.config.image.build.Arguments;
import org.eclipse.jkube.kit.config.image.build.BuildConfiguration;
+import org.fusesource.jansi.Ansi;
import com.google.cloud.tools.jib.api.CacheDirectoryCreationException;
import com.google.cloud.tools.jib.api.Containerizer;
@@ -253,7 +254,11 @@ public class JibServiceUtil {
if (progressDisplay.size() > 2 && progressDisplay.stream().allMatch(Objects::nonNull)) {
final String progressBar = progressDisplay.get(1);
final String task = progressDisplay.get(2);
- System.out.println(ansi().cursorUpLine(1).eraseLine().a(JIB_LOG_PREFIX).a(progressBar).a(" ").a(task));
+ if (Ansi.isEnabled()) {
+ System.out.println(ansi().cursorUpLine(1).eraseLine().a(JIB_LOG_PREFIX).a(progressBar).a(" ").a(task));
+ } else if (update.getProgress() == 1.0F) {
+ System.out.println(task);
+ }
}
};
} |
} else if (update.getProgress() == 0.0F) { |
We'll need to refactor the whole Ansi configuration inference to provide a consistent behavior. We already have some work in progress in the Gradle Plugin implementation. Once we merge those changes we can start to consider how to properly implement this. As a note to your approach, even if the terminal supports Ansi, users might still want to opt-out. |
Sounds good. In the approach (hack) I used jkube.useColor allows users to opt out, apparently because jkube calls Ansi.setEnabled(true/flase); in 2 locations based on useColor. |
If you run a jib build in a non ansi terminal (like any CICD build tool) then the jib build will generate endless update messages and fill almost the entire build log. Would be nice to support an option like jukbe.jib.console = plain for that. Basically just print the begin and end messages, not the update ones.
The method I think that does it is static so I'm not sure the best way that should be structured in the code base.
https://github.com/eclipse/jkube/blob/master/jkube-kit/build/service/jib/src/main/java/org/eclipse/jkube/kit/service/jib/JibServiceUtil.java#L253
The log file generates endless messages like:
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 59.9% complete > scheduling building manifests
JIB> [================== ] 60.0% complete > scheduling building manifests
JIB> [================== ] 60.0% complete > scheduling building manifests
JIB> [================== ] 60.0% complete > scheduling building manifests
JIB> [================== ] 60.0% complete > scheduling building manifests
JIB> [================== ] 60.0% complete > scheduling building manifests
JIB> [================== ] 60.0% complete > scheduling building manifests
JIB> [================== ] 60.0% complete > scheduling building manifests
JIB> [================== ] 60.0% complete > scheduling building manifests
JIB> [================== ] 60.0% complete > scheduling building manifests
JIB> [================== ] 60.0% complete > scheduling building manifests
JIB> [================== ] 60.0% complete > scheduling building manifests
JIB> [================== ] 60.0% complete > scheduling building manifests
JIB> [================== ] 60.0% complete > scheduling building manifests
JIB> [================== ] 60.0% complete > scheduling building manifests
JIB> [================== ] 60.0% complete > scheduling building manifests
JIB> [================== ] 60.0% complete > scheduling building manifests
JIB> [================== ] 60.0% complete > scheduling building manifests
JIB> [================== ] 60.0% complete > scheduling building manifests
JIB> [================== ] 60.0% complete > scheduling building manifests
JIB> [================== ] 60.0% complete > scheduling building manifests
and
JIB> [================ ] 54.5% complete > scheduling pushing manifests
JIB> [=================== ] 63.6% complete > scheduling pushing manifests
JIB> [=================== ] 63.6% complete > scheduling pushing manifests
JIB> [=================== ] 63.6% complete > scheduling pushing manifests
JIB> [=================== ] 63.6% complete > scheduling pushing manifests
JIB> [=================== ] 63.6% complete > scheduling pushing manifests
JIB> [================ ] 54.5% complete > scheduling pushing manifests
JIB> [=================== ] 63.6% complete > scheduling pushing manifests
JIB> [=================== ] 63.6% complete > scheduling pushing manifests
JIB> [=================== ] 63.6% complete > scheduling pushing manifests
The text was updated successfully, but these errors were encountered: