kamal 1.8.0 → 1.8.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3cf788692b64036e48979bd965c6cc205442f308173c921f1b7e7f3d53e9f279
4
- data.tar.gz: c81142cad28e8fdfab7ae68259569f1754791952993c323cbc46760252a8b42c
3
+ metadata.gz: 6586f8ce83674c95b6e7cd4172b1925586fc98cf8e7faac78b9b7fe0122752bb
4
+ data.tar.gz: ba02a0a974161f4f8ceb1dd38fb91920b2759904b01398edede27e1e1a42e8bd
5
5
  SHA512:
6
- metadata.gz: b461f6c47a6b77d3cd35aff8198dc85e8db8b840a14ffd492127042d5acb3cd2603578f59eba9629726dfd918cddceed978b7554b00045a5fe64a0ec656b6d44
7
- data.tar.gz: 1d446485c62f5285c82d92a49f3b8b821fefd7695ac651bc5e8531a16e8c1739bd4c20e4ff4012a4a42b8c73f0d681cfd64a9f6b90da791ab27df97679ae2d0b
6
+ metadata.gz: 7bad7fe1bab6996df978a5814f05af2d3bd4845c17f480c5a5ceadedfbf23c5a8f5c33682dfc89e7eee87a6dd8adcb130a79de015e5d16217413d95cc498d745
7
+ data.tar.gz: 546762e7e5855e45d6a7e1cf97874a3241d591efb7ac35aa8ec81f87a9afbd5cb08d6eea07f46c18fc752aa34169f404d0b97fbad2180fe53eda674726a662e4
@@ -140,7 +140,7 @@ class Kamal::Cli::Build < Kamal::Cli::Base
140
140
  mirror_hosts = Concurrent::Hash.new
141
141
  on(KAMAL.hosts) do |host|
142
142
  first_mirror = capture_with_info(*KAMAL.builder.first_mirror).strip.presence
143
- mirror_hosts[first_mirror] ||= host if first_mirror
143
+ mirror_hosts[first_mirror] ||= host.to_s if first_mirror
144
144
  rescue SSHKit::Command::Failed => e
145
145
  raise unless e.message =~ /error calling index: reflect: slice index out of range/
146
146
  end
@@ -2,13 +2,24 @@
2
2
  #
3
3
  # Configuration is read from the `config/deploy.yml`
4
4
  #
5
+
6
+ # Destinations
7
+ #
5
8
  # When running commands, you can specify a destination with the `-d` flag,
6
9
  # e.g. `kamal deploy -d staging`
7
10
  #
8
11
  # In this case the configuration will also be read from `config/deploy.staging.yml`
9
12
  # and merged with the base configuration.
13
+
14
+ # Extensions
15
+ #
16
+ # Kamal will not accept unrecognized keys in the configuration file.
17
+ #
18
+ # However, you might want to declare a configuration block using YAML anchors
19
+ # and aliases to avoid repetition.
10
20
  #
11
- # The available configuration options are explained below.
21
+ # You can use prefix a configuration section with `x-` to indicate that it is an
22
+ # extension. Kamal will ignore the extension and not raise an error.
12
23
 
13
24
  # The service name
14
25
  # This is a required value. It is used as the container name prefix.
@@ -0,0 +1,6 @@
1
+ class Kamal::Configuration::Validator::Configuration < Kamal::Configuration::Validator
2
+ private
3
+ def allow_extensions?
4
+ true
5
+ end
6
+ end
@@ -15,11 +15,10 @@ class Kamal::Configuration::Validator
15
15
  def validate_against_example!(validation_config, example)
16
16
  validate_type! validation_config, Hash
17
17
 
18
- if (unknown_keys = validation_config.keys - example.keys).any?
19
- unknown_keys_error unknown_keys
20
- end
18
+ check_unknown_keys! validation_config, example
21
19
 
22
20
  validation_config.each do |key, value|
21
+ next if extension?(key)
23
22
  with_context(key) do
24
23
  example_value = example[key]
25
24
 
@@ -137,4 +136,18 @@ class Kamal::Configuration::Validator
137
136
  ensure
138
137
  @context = old_context
139
138
  end
139
+
140
+ def allow_extensions?
141
+ false
142
+ end
143
+
144
+ def extension?(key)
145
+ key.to_s.start_with?("x-")
146
+ end
147
+
148
+ def check_unknown_keys!(config, example)
149
+ unknown_keys = config.keys - example.keys
150
+ unknown_keys.reject! { |key| extension?(key) } if allow_extensions?
151
+ unknown_keys_error unknown_keys if unknown_keys.present?
152
+ end
140
153
  end
@@ -47,7 +47,7 @@ class Kamal::Configuration
47
47
  @destination = destination
48
48
  @declared_version = version
49
49
 
50
- validate! raw_config, example: validation_yml.symbolize_keys, context: ""
50
+ validate! raw_config, example: validation_yml.symbolize_keys, context: "", with: Kamal::Configuration::Validator::Configuration
51
51
 
52
52
  # Eager load config to validate it, these are first as they have dependencies later on
53
53
  @servers = Servers.new(config: self)
data/lib/kamal/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kamal
2
- VERSION = "1.8.0"
2
+ VERSION = "1.8.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kamal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-15 00:00:00.000000000 Z
11
+ date: 2024-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -295,6 +295,7 @@ files:
295
295
  - lib/kamal/configuration/validator.rb
296
296
  - lib/kamal/configuration/validator/accessory.rb
297
297
  - lib/kamal/configuration/validator/builder.rb
298
+ - lib/kamal/configuration/validator/configuration.rb
298
299
  - lib/kamal/configuration/validator/env.rb
299
300
  - lib/kamal/configuration/validator/registry.rb
300
301
  - lib/kamal/configuration/validator/role.rb