File tree Expand file tree Collapse file tree 2 files changed +41
-1
lines changed
Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ use clap::Args;
2828use colored:: Colorize ;
2929use indicatif:: { ProgressBar , ProgressStyle } ;
3030use log:: { info, trace, warn} ;
31- use miette:: { Context , Result } ;
31+ use miette:: { Context , Result , bail } ;
3232use oci_client:: Reference ;
3333use uuid:: Uuid ;
3434
@@ -306,6 +306,24 @@ fn get_version_run_image(oci_ref: &Reference) -> Result<Version> {
306306 . build ( ) ,
307307 ) ?;
308308
309+ if !output. status . success ( ) {
310+ let stderr = String :: from_utf8_lossy ( & output. stderr ) ;
311+ if stderr. contains ( "docker: failed to register layer: max depth exceeded" ) {
312+ bail ! (
313+ help = format!(
314+ "Try using podman as your container runtime with `{}`" ,
315+ "--run-driver=podman" . bright_yellow( )
316+ ) ,
317+ "Docker cannot handle images with too many layers!"
318+ ) ;
319+ }
320+ bail ! (
321+ "Failed to run version script on the base image {}:\n {}" ,
322+ oci_ref. to_string( ) . cyan( ) ,
323+ String :: from_utf8_lossy( & output. stderr)
324+ ) ;
325+ }
326+
309327 if should_remove {
310328 Driver :: remove_image ( RemoveImageOpts :: builder ( ) . image ( oci_ref) . build ( ) ) ?;
311329 }
Original file line number Diff line number Diff line change 11use blue_build:: commands:: { BlueBuildArgs , BlueBuildCommand , CommandArgs } ;
22use blue_build_process_management:: { logging:: Logger , signal_handler} ;
33use clap:: Parser ;
4+ use colored:: Colorize ;
45use log:: LevelFilter ;
56
67fn main ( ) {
78 let args = BlueBuildArgs :: parse ( ) ;
89
10+ miette:: set_hook ( Box :: new ( |_| {
11+ Box :: new (
12+ miette:: MietteHandlerOpts :: new ( )
13+ . terminal_links ( true )
14+ . footer ( format ! (
15+ concat!(
16+ "Try running with `{arg}` for trace logging.\n " ,
17+ "You can also open an issue at https://github.com/blue-build/cli/issues"
18+ ) ,
19+ arg = "-vv" . bright_yellow( ) ,
20+ ) )
21+ . context_lines ( 3 )
22+ . tab_width ( 4 )
23+ . wrap_lines ( false )
24+ . with_cause_chain ( )
25+ . show_related_errors_as_nested ( )
26+ . build ( ) ,
27+ )
28+ } ) )
29+ . expect ( "Miette hook should be set" ) ;
30+
931 Logger :: new ( )
1032 . filter_level ( args. verbosity . log_level_filter ( ) )
1133 . filter_modules ( if args. no_log_filter {
You can’t perform that action at this time.
0 commit comments