Buildkit-based output processed a bit differently.
This commit is contained in:
parent
8041d0ae78
commit
f3629ebd09
|
@ -18,12 +18,16 @@ module VagrantPlugins
|
|||
def build(dir, **opts, &block)
|
||||
args = Array(opts[:extra_args])
|
||||
args << dir
|
||||
result = execute('docker', 'build', '-q', *args, &block)
|
||||
matches = result.scan(/^sha256:([0-9a-f]+)$/i)
|
||||
result = execute('docker', 'build', '--progress', 'plain', *args, &block)
|
||||
matches = result.scan(/Successfully built (.+)$/i)
|
||||
if matches.empty?
|
||||
# This will cause a stack trace in Vagrant, but it is a bug
|
||||
# if this happens anyways.
|
||||
raise "UNKNOWN OUTPUT: #{result}"
|
||||
# Check for the new output format 'writing image sha256...'
|
||||
matches = result.scan(/writing image sha256:([0-9a-z]+) done$/i)
|
||||
if matches.empty?
|
||||
# This will cause a stack trace in Vagrant, but it is a bug
|
||||
# if this happens anyways.
|
||||
raise "UNKNOWN OUTPUT: #{result}"
|
||||
end
|
||||
end
|
||||
|
||||
# Return the last match, and the capture of it
|
||||
|
|
|
@ -27,7 +27,12 @@ module VagrantPlugins
|
|||
stdout: result.stdout
|
||||
end
|
||||
|
||||
result.stdout
|
||||
# If the new buildkit-based docker build is used, stdout is empty, and the output is in stderr
|
||||
if result.stdout.to_s.strip.length == 0
|
||||
result.stderr
|
||||
else
|
||||
result.stdout
|
||||
end
|
||||
end
|
||||
|
||||
def windows?
|
||||
|
|
Loading…
Reference in New Issue