dash 4.2.1 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/dash/cli/build.rb +26 -2
- data/lib/dash/configuration/builder.rb +6 -0
- data/lib/dash/configuration/docs/builder.yml +20 -0
- data/lib/dash/configuration/validator/builder.rb +12 -0
- data/lib/dash/configuration.rb +7 -4
- data/lib/dash/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b4da415bef9c24e1cb953025f5b613e252adc7a5e701022d45ef3a5ead57c5e7
|
|
4
|
+
data.tar.gz: 44e8b217a33121af0ce8817610a12c820bbc44b2cf91377fbd46f3a1ae1d3258
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ee1355429c12f34ee0bcd27da1849e196db86aa8761b5e03c0e485870a46c8b583fe1b6aba44d134d169ebbc625be846c676771dd84f50b38bb887419ddf7354
|
|
7
|
+
data.tar.gz: d48f6487c407811f6edba7da6c140773eb37d72e18a44811bf4acd285b1f25bb095a8b63d9c9e3d201c641230e202f76da68a1fb5d6bb76f1949547736debb95
|
data/lib/dash/cli/build.rb
CHANGED
|
@@ -62,7 +62,7 @@ class Dash::Cli::Build < Dash::Cli::Base
|
|
|
62
62
|
# Get the command here to ensure the Dir.chdir doesn't interfere with it
|
|
63
63
|
push = DASH.builder.push(cli.options[:output], no_cache: cli.options[:no_cache])
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
cli.send(:with_build_output) do
|
|
66
66
|
Dir.chdir(DASH.config.builder.build_directory) { execute *push, env: DASH.builder.push_env, **handler }
|
|
67
67
|
end
|
|
68
68
|
end
|
|
@@ -156,7 +156,7 @@ class Dash::Cli::Build < Dash::Cli::Base
|
|
|
156
156
|
with_env(DASH.config.builder.secrets) do
|
|
157
157
|
run_locally do
|
|
158
158
|
build = DASH.builder.push(cli.options[:output], tag_as_dirty: true, no_cache: cli.options[:no_cache])
|
|
159
|
-
|
|
159
|
+
cli.send(:with_build_output) do
|
|
160
160
|
execute(*build, **handler)
|
|
161
161
|
end
|
|
162
162
|
end
|
|
@@ -168,6 +168,30 @@ class Dash::Cli::Build < Dash::Cli::Base
|
|
|
168
168
|
end
|
|
169
169
|
|
|
170
170
|
private
|
|
171
|
+
# BuildKit's lines are SSHKit command data, which prints at debug. They stream when the
|
|
172
|
+
# operator asked for -v, or at the default verbosity unless `builder.output: quiet`; -q
|
|
173
|
+
# and quiet run the build at the caller's level instead. Nothing is lost either way:
|
|
174
|
+
# SSHKit hands every line to the interaction handler and keeps it on the command before
|
|
175
|
+
# the formatter decides what to print, so the progress parser still reads it all, and a
|
|
176
|
+
# failed build raises SSHKit::Command::Failed carrying its stdout and stderr, which
|
|
177
|
+
# bin/dash prints. Printing it here as well would show a failed build's log twice.
|
|
178
|
+
def with_build_output(&block)
|
|
179
|
+
if stream_build_output?
|
|
180
|
+
DASH.with_verbosity(:debug, &block)
|
|
181
|
+
else
|
|
182
|
+
yield
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
# The config applies only at the default verbosity; -v and -q win, as over hooks_output.
|
|
187
|
+
def stream_build_output?
|
|
188
|
+
case DASH.verbosity
|
|
189
|
+
when :debug then true
|
|
190
|
+
when :info then DASH.config.builder.output != :quiet
|
|
191
|
+
else false
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
|
|
171
195
|
# Buildpacks print a total and nothing else, so there is nothing for the parser to
|
|
172
196
|
# read and no reason to attach it.
|
|
173
197
|
def build_progress_parser
|
|
@@ -65,6 +65,12 @@ class Dash::Configuration::Builder
|
|
|
65
65
|
!!builder_config["pack"]
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
+
# How much of the build's own output (BuildKit's progress lines) is printed. nil means
|
|
69
|
+
# the default, which streams it; see Dash::Cli::Build#with_build_output.
|
|
70
|
+
def output
|
|
71
|
+
builder_config["output"]&.to_sym
|
|
72
|
+
end
|
|
73
|
+
|
|
68
74
|
def args
|
|
69
75
|
builder_config["args"] || {}
|
|
70
76
|
end
|
|
@@ -31,6 +31,26 @@ builder:
|
|
|
31
31
|
# Defaults to true:
|
|
32
32
|
local: true
|
|
33
33
|
|
|
34
|
+
# Build output
|
|
35
|
+
#
|
|
36
|
+
# How much of the build's own output (BuildKit's progress lines) dash prints.
|
|
37
|
+
# Not to be confused with `dash build push --output`, which picks where the image
|
|
38
|
+
# goes, or the top-level `output` key, which configures log destinations.
|
|
39
|
+
#
|
|
40
|
+
# - `verbose` - every build line is streamed (the default)
|
|
41
|
+
# - `quiet` - build lines are not printed; the build report still is
|
|
42
|
+
#
|
|
43
|
+
# CLI flags override this setting: `-v` always streams, `-q` never does.
|
|
44
|
+
#
|
|
45
|
+
# A quiet build prints nothing while it runs, so a CI job with a no-output timeout
|
|
46
|
+
# needs that timeout to cover the longest build.
|
|
47
|
+
#
|
|
48
|
+
# A failed build always prints its output, in the error that ends the command,
|
|
49
|
+
# and configured output loggers record every build line whatever this says.
|
|
50
|
+
#
|
|
51
|
+
# Defaults to `verbose`:
|
|
52
|
+
output: quiet
|
|
53
|
+
|
|
34
54
|
# Buildpack configuration
|
|
35
55
|
#
|
|
36
56
|
# The build configuration for using pack to build a Cloud Native Buildpack image.
|
|
@@ -11,5 +11,17 @@ class Dash::Configuration::Validator::Builder < Dash::Configuration::Validator
|
|
|
11
11
|
error "buildpacks only support building for one arch" if config["pack"] && config["arch"].is_a?(Array) && config["arch"].size > 1
|
|
12
12
|
|
|
13
13
|
error "Cannot disable local builds, no remote is set" if config["local"] == false && config["remote"].blank?
|
|
14
|
+
|
|
15
|
+
validate_output_level!(config["output"]) if config.key?("output")
|
|
14
16
|
end
|
|
17
|
+
|
|
18
|
+
private
|
|
19
|
+
def validate_output_level!(level)
|
|
20
|
+
# The type check lets a boolean or a number through as a string; this rejects it.
|
|
21
|
+
return if Dash::Configuration::HOOKS_OUTPUT_LEVELS.include?(level.to_s.to_sym)
|
|
22
|
+
|
|
23
|
+
with_context("output") do
|
|
24
|
+
error "Invalid output '#{level}', must be one of: #{Dash::Configuration::HOOKS_OUTPUT_LEVELS.join(', ')}"
|
|
25
|
+
end
|
|
26
|
+
end
|
|
15
27
|
end
|
data/lib/dash/configuration.rb
CHANGED
|
@@ -771,17 +771,20 @@ class Dash::Configuration
|
|
|
771
771
|
raw_config.servers.is_a?(Array) ? [ "web" ] : raw_config.servers.keys.sort
|
|
772
772
|
end
|
|
773
773
|
|
|
774
|
+
# The validator's type check lets a boolean or a number through as a string, so this
|
|
775
|
+
# is what rejects one.
|
|
774
776
|
def ensure_valid_hooks_output!
|
|
775
777
|
case raw_config.hooks_output
|
|
776
|
-
when
|
|
777
|
-
validate_hooks_output_level!(raw_config.hooks_output.to_sym)
|
|
778
|
+
when nil
|
|
778
779
|
when Hash
|
|
779
|
-
raw_config.hooks_output.each { |hook, level| validate_hooks_output_level!(level
|
|
780
|
+
raw_config.hooks_output.each { |hook, level| validate_hooks_output_level!(level, hook) }
|
|
781
|
+
else
|
|
782
|
+
validate_hooks_output_level!(raw_config.hooks_output)
|
|
780
783
|
end
|
|
781
784
|
end
|
|
782
785
|
|
|
783
786
|
def validate_hooks_output_level!(level, hook = nil)
|
|
784
|
-
return if HOOKS_OUTPUT_LEVELS.include?(level)
|
|
787
|
+
return if HOOKS_OUTPUT_LEVELS.include?(level.to_s.to_sym)
|
|
785
788
|
context = hook ? " for hook '#{hook}'" : ""
|
|
786
789
|
raise Dash::ConfigurationError, "Invalid hooks_output '#{level}'#{context}, must be one of: #{HOOKS_OUTPUT_LEVELS.join(', ')}"
|
|
787
790
|
end
|
data/lib/dash/version.rb
CHANGED