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(
276
276
map. get_mut ( & target) . expect ( "map must have key" ) . push ( image) ;
277
277
}
278
278
}
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 ( ) ;
280
280
keys. sort_unstable ( ) ;
281
281
282
282
let print_string =
Original file line number Diff line number Diff line change @@ -163,7 +163,32 @@ impl<'a> Dockerfile<'a> {
163
163
docker_build. arg ( paths. host_root ( ) ) ;
164
164
}
165
165
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?;
167
192
Ok ( image_name)
168
193
}
169
194
Original file line number Diff line number Diff line change @@ -69,6 +69,8 @@ pub struct Engine {
69
69
}
70
70
71
71
impl Engine {
72
+ pub const CROSS_CONTAINER_ENGINE_NO_BUILDKIT_ENV : & ' static str =
73
+ "CROSS_CONTAINER_ENGINE_NO_BUILDKIT" ;
72
74
pub fn new (
73
75
in_docker : Option < bool > ,
74
76
is_remote : Option < bool > ,
@@ -135,7 +137,7 @@ impl Engine {
135
137
136
138
#[ must_use]
137
139
pub fn has_buildkit ( ) -> bool {
138
- !env:: var ( "CROSS_CONTAINER_ENGINE_NO_BUILDKIT" )
140
+ !env:: var ( Self :: CROSS_CONTAINER_ENGINE_NO_BUILDKIT_ENV )
139
141
. map ( |x| bool_from_envvar ( & x) )
140
142
. unwrap_or_default ( )
141
143
}
You can’t perform that action at this time.
0 commit comments