buildkite-builder 3.4.0 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e74780f14a94f7db9cdac81ed2f28657f94dc9547d5b8bc54c10b7f8797c256
4
- data.tar.gz: 0c2191c768092e804eb7b9623234d46c9c1496fdc8062bd5dcaf45a2de48c7a9
3
+ metadata.gz: 64089d229e28dcf07061f4a32178cbf29fc157f2004e03adb84a800f24c2b8fd
4
+ data.tar.gz: d4faa31aac7205a07c29ef2766ae3067079d6d72ddb938adfdcec943babd564c
5
5
  SHA512:
6
- metadata.gz: 9632e4990ba1d48ea5231d256e8a9143a99ff3a6fdabc41635e71c3092a0a89a839359819a6feffdb0357f006f894d3d40235efd0ebece5d4e4bca85f3d59c64
7
- data.tar.gz: bd5848e4a08412331d740aebacd0f9373009ca12427598943c7de630302a4ad7ab6f2907d790052e496433f8cd1463f7cc340212ef4dead044691bd5081f0657
6
+ metadata.gz: 67c3325a7b86690c80d771a4cf7738718f1d072481cd23a2b21e9cd1bdb9c9a76b96fc35bb270d09c2ca1e69fbbd7e1d81c8b334a6973e4b148a27ebbf98c504
7
+ data.tar.gz: 7f4263163c198d8158fbc93e52dab34369ec51e5957860f4203d602ed6c7e445c018d8cf842584fafbfa2e9d44e0722e0ded99efb754d373bbff96f45bb676c2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 3.5.0
2
+ * `plugin` registrations now takes an optional default attributes hash as the third argument.
3
+
4
+ ## 3.4.1
5
+ * `automatic_retry_on` now overwrites rules with the same exit status.
6
+
1
7
  ## 3.4.0
2
8
  * `automatically_retry(status:, limit:)` has been renamed to `automatic_retry_on(exit_status:, limit:)`
3
9
  * Added `automatic_retry` for setting boolean for `retry.automatic`
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.4.0
1
+ 3.5.0
@@ -21,8 +21,8 @@ module Buildkite
21
21
  context.data.steps.push(Buildkite::Builder::Group.new(label, context.data.steps, &block))
22
22
  end
23
23
 
24
- def plugin(name, uri)
25
- context.data.steps.plugins.add(name, uri)
24
+ def plugin(name, uri, default_attributes = {})
25
+ context.data.steps.plugins.add(name, uri, default_attributes)
26
26
  end
27
27
 
28
28
  def block(template = nil, **args, &block)
@@ -3,16 +3,16 @@
3
3
  module Buildkite
4
4
  module Builder
5
5
  class Plugin
6
- attr_reader :uri, :source, :version, :options
6
+ attr_reader :uri, :source, :version, :attributes
7
7
 
8
- def initialize(uri, options = nil)
8
+ def initialize(uri, attributes = {})
9
9
  @uri = uri
10
10
  @source, @version = uri.split('#')
11
- @options = options
11
+ @attributes = attributes
12
12
  end
13
13
 
14
14
  def to_h
15
- Buildkite::Pipelines::Helpers.sanitize(uri => options)
15
+ Buildkite::Pipelines::Helpers.sanitize(uri => (attributes&.empty? ? nil : attributes))
16
16
  end
17
17
  end
18
18
  end
@@ -8,17 +8,17 @@ module Buildkite
8
8
  @collection = []
9
9
  end
10
10
 
11
- def add(resource, options = nil)
11
+ def add(resource, attributes = {})
12
12
  plugin =
13
13
  case resource
14
14
  when Symbol
15
- uri = plugin_manager.fetch(resource.to_s)
15
+ registered_plugin = plugin_manager.fetch(resource.to_s)
16
16
 
17
- raise ArgumentError, "Plugin `#{resource}` does not exist" unless uri
17
+ raise ArgumentError, "Plugin `#{resource}` does not exist" unless registered_plugin
18
18
 
19
- Plugin.new(uri, options)
19
+ Plugin.new(registered_plugin[:uri], registered_plugin[:default_attributes].merge(attributes))
20
20
  when String
21
- Plugin.new(resource, options)
21
+ Plugin.new(resource, attributes)
22
22
  when Plugin
23
23
  resource
24
24
  else
@@ -5,14 +5,17 @@ module Buildkite
5
5
  @plugins = {}
6
6
  end
7
7
 
8
- def add(name, uri)
8
+ def add(name, uri, default_attributes = {})
9
9
  name = name.to_s
10
10
 
11
11
  if @plugins.key?(name)
12
12
  raise ArgumentError, "Plugin already defined: #{name}"
13
13
  end
14
14
 
15
- @plugins[name] = uri
15
+ @plugins[name] = {
16
+ uri: uri,
17
+ default_attributes: default_attributes
18
+ }
16
19
  end
17
20
 
18
21
  def fetch(name)
@@ -4,9 +4,9 @@ module Buildkite
4
4
  module Pipelines
5
5
  module Helpers
6
6
  module Plugins
7
- def plugin(name_or_source, options = nil)
7
+ def plugin(name_or_source, plugin_attributes = {})
8
8
  attributes['plugins'] ||= Buildkite::Builder::PluginCollection.new(step_collection.plugins)
9
- attributes['plugins'].add(name_or_source, options)
9
+ attributes['plugins'].add(name_or_source, plugin_attributes)
10
10
  end
11
11
 
12
12
  def plugins
@@ -11,6 +11,7 @@ module Buildkite
11
11
  retry_value[:automatic] = []
12
12
  end
13
13
 
14
+ retry_value[:automatic].delete_if { |rule| rule[:exit_status] == exit_status }
14
15
  retry_value[:automatic].push(exit_status: exit_status, limit: limit)
15
16
  end
16
17
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buildkite-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ngan Pham
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2022-09-08 00:00:00.000000000 Z
12
+ date: 2022-10-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rainbow
@@ -171,7 +171,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
171
171
  requirements:
172
172
  - - ">="
173
173
  - !ruby/object:Gem::Version
174
- version: 2.3.0
174
+ version: 3.0.0
175
175
  required_rubygems_version: !ruby/object:Gem::Requirement
176
176
  requirements:
177
177
  - - ">="