File tree Expand file tree Collapse file tree 3 files changed +30
-3
lines changed
Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -276,7 +276,7 @@ pub fn list_images(
276276 map. get_mut ( & target) . expect ( "map must have key" ) . push ( image) ;
277277 }
278278 }
279- let mut keys: Vec < & str > = map. iter ( ) . map ( |( k , _ ) | k. as_ref ( ) ) . collect ( ) ;
279+ let mut keys: Vec < & str > = map. keys ( ) . map ( |k | k. as_ref ( ) ) . collect ( ) ;
280280 keys. sort_unstable ( ) ;
281281
282282 let print_string =
Original file line number Diff line number Diff line change @@ -163,7 +163,32 @@ impl<'a> Dockerfile<'a> {
163163 docker_build. arg ( paths. host_root ( ) ) ;
164164 }
165165
166- docker_build. run ( msg_info, true ) ?;
166+ let mut res = docker_build. run ( msg_info, true ) . with_warning ( || {
167+ format ! (
168+ "call to {} failed" ,
169+ options
170+ . engine
171+ . path
172+ . file_name( )
173+ . and_then( |s| s. to_str( ) )
174+ . map_or_else( || "container engine" , |s| s)
175+ )
176+ } ) ;
177+
178+ // FIXME: Inspect the error message, while still inheriting stdout on verbose mode to
179+ // conditionally apply this suggestion and note. This could then inspect if a help string is emitted,
180+ // if the daemon is not running, etc.
181+ if docker:: Engine :: has_buildkit ( ) {
182+ res = res
183+ . suggestion ( "is `buildx` available for the container engine?" )
184+ . with_note ( || {
185+ format ! (
186+ "disable the `buildkit` dependency optionally with `{}=1`" ,
187+ docker:: Engine :: CROSS_CONTAINER_ENGINE_NO_BUILDKIT_ENV
188+ )
189+ } ) ;
190+ }
191+ res?;
167192 Ok ( image_name)
168193 }
169194
Original file line number Diff line number Diff line change @@ -69,6 +69,8 @@ pub struct Engine {
6969}
7070
7171impl Engine {
72+ pub const CROSS_CONTAINER_ENGINE_NO_BUILDKIT_ENV : & ' static str =
73+ "CROSS_CONTAINER_ENGINE_NO_BUILDKIT" ;
7274 pub fn new (
7375 in_docker : Option < bool > ,
7476 is_remote : Option < bool > ,
@@ -135,7 +137,7 @@ impl Engine {
135137
136138 #[ must_use]
137139 pub fn has_buildkit ( ) -> bool {
138- !env:: var ( "CROSS_CONTAINER_ENGINE_NO_BUILDKIT" )
140+ !env:: var ( Self :: CROSS_CONTAINER_ENGINE_NO_BUILDKIT_ENV )
139141 . map ( |x| bool_from_envvar ( & x) )
140142 . unwrap_or_default ( )
141143 }
You can’t perform that action at this time.
0 commit comments