buildkite-builder 3.3.0 → 3.4.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: 2946cdcde9aa6a6474bb3f9464d77b5ac9831fe1c5f3a27e289017e215f711a4
4
- data.tar.gz: 6cbc69d2ea605f0427577daf28ed0243f56ccb3b12338662c08d377774ac5177
3
+ metadata.gz: 2e74780f14a94f7db9cdac81ed2f28657f94dc9547d5b8bc54c10b7f8797c256
4
+ data.tar.gz: 0c2191c768092e804eb7b9623234d46c9c1496fdc8062bd5dcaf45a2de48c7a9
5
5
  SHA512:
6
- metadata.gz: 04b63489255060c1237b8c25094b0aba3e99fe08079d23ab13173392e36908bf9db798224b70e5c28dfaccbb9323dfd2c11c8e4446bad0a9fd6fd4d74b44de8a
7
- data.tar.gz: b1685985083035299d690371891f05d16c0dc932b159551f1b1ae23d645c4764d63456f44d29ce72e97251ad38ac6229622ba7795d173f8acc72a1ad09e8756e
6
+ metadata.gz: 9632e4990ba1d48ea5231d256e8a9143a99ff3a6fdabc41635e71c3092a0a89a839359819a6feffdb0357f006f894d3d40235efd0ebece5d4e4bca85f3d59c64
7
+ data.tar.gz: bd5848e4a08412331d740aebacd0f9373009ca12427598943c7de630302a4ad7ab6f2907d790052e496433f8cd1463f7cc340212ef4dead044691bd5081f0657
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 3.4.0
2
+ * `automatically_retry(status:, limit:)` has been renamed to `automatic_retry_on(exit_status:, limit:)`
3
+ * Added `automatic_retry` for setting boolean for `retry.automatic`
4
+ * Added `manual_retry` for setting `retry.manual`
5
+
6
+ ## 3.3.2
7
+ * Fix subpipeline trigger step attributes leak to subpipeline.
8
+
9
+ ## 3.3.1
10
+ * Add support to iterate over subpipelines.
11
+ * Allow build options to be passed to subpipelines.
12
+
1
13
  ## 3.3.0
2
14
  * Remove arguments in sub-pipeline's trigger step setup and use dsl delegation instead.
3
15
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.3.0
1
+ 3.4.0
@@ -18,6 +18,7 @@ module Buildkite
18
18
  attribute :allow_dependency_failure
19
19
  attribute :branches
20
20
  attribute :async
21
+ attribute :build
21
22
 
22
23
  def self.to_sym
23
24
  name.split('::').last.downcase.to_sym
@@ -44,13 +45,12 @@ module Buildkite
44
45
  end
45
46
 
46
47
  def to_h
47
- attributes = super
48
48
  # Merge envs from main pipeline, since ruby does not have `reverse_merge` and
49
49
  # `data` does not allow keys override, we have to reset the data hash per key.
50
50
  @context.data.env.merge(data.env).each do |key, value|
51
51
  data.env[key] = value
52
52
  end
53
- attributes.merge(data.to_definition)
53
+ data.to_definition
54
54
  end
55
55
 
56
56
  def method_missing(method_name, *args, **kwargs, &_block)
@@ -76,7 +76,8 @@ module Buildkite
76
76
 
77
77
  trigger_step = context.data.steps.add(Pipelines::Steps::Trigger)
78
78
  trigger_step.trigger(name)
79
- trigger_step.build(
79
+
80
+ build_options = {
80
81
  message: '${BUILDKITE_MESSAGE}',
81
82
  commit: '${BUILDKITE_COMMIT}',
82
83
  branch: '${BUILDKITE_BRANCH}',
@@ -86,8 +87,10 @@ module Buildkite
86
87
  BUILDKITE_PULL_REQUEST_REPO: '${BUILDKITE_PULL_REQUEST_REPO}',
87
88
  BKB_SUBPIPELINE_FILE: sub_pipeline.pipeline_yml
88
89
  }
89
- )
90
+ }
91
+ build_options.merge!(sub_pipeline.build) if sub_pipeline.build
90
92
 
93
+ trigger_step.build(build_options)
91
94
  trigger_step.key(sub_pipeline.key || "subpipeline_#{name}_#{context.data.pipelines.count}")
92
95
  trigger_step.label(sub_pipeline.label || name.capitalize)
93
96
  trigger_step.async(sub_pipeline.async || false)
@@ -8,6 +8,7 @@ module Buildkite
8
8
  attr_reader :pipelines
9
9
 
10
10
  def_delegator :@pipelines, :count
11
+ def_delegator :@pipelines, :each
11
12
 
12
13
  def initialize(artifacts)
13
14
  @artifacts = artifacts
@@ -4,15 +4,26 @@ module Buildkite
4
4
  module Pipelines
5
5
  module Helpers
6
6
  module Retry
7
- def automatically_retry(status:, limit:)
8
- retry_value = get(:retry)&.[](:automatic)
7
+ def automatic_retry_on(exit_status:, limit:)
8
+ retry_value = get(:retry) || set(:retry, {})
9
9
 
10
- unless retry_value.is_a?(Array)
11
- retry_value = []
12
- self.retry(automatic: retry_value)
10
+ unless retry_value[:automatic].is_a?(Array)
11
+ retry_value[:automatic] = []
13
12
  end
14
13
 
15
- retry_value.push(exit_status: status, limit: limit)
14
+ retry_value[:automatic].push(exit_status: exit_status, limit: limit)
15
+ end
16
+
17
+ def automatic_retry(enabled)
18
+ retry_value = get(:retry) || set(:retry, {})
19
+ retry_value[:automatic] = enabled
20
+ end
21
+
22
+ def manual_retry(allowed, reason: nil, permit_on_passed: nil)
23
+ retry_value = get(:retry) || set(:retry, {})
24
+ retry_value[:manual] = { allowed: allowed }
25
+ retry_value[:manual][:reason] = reason unless reason.nil?
26
+ retry_value[:manual][:permit_on_passed] = permit_on_passed unless permit_on_passed.nil?
16
27
  end
17
28
  end
18
29
  end
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.3.0
4
+ version: 3.4.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-06-15 00:00:00.000000000 Z
12
+ date: 2022-09-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rainbow
@@ -40,21 +40,7 @@ dependencies:
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
- name: byebug
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - ">="
47
- - !ruby/object:Gem::Version
48
- version: '0'
49
- type: :development
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: '0'
56
- - !ruby/object:Gem::Dependency
57
- name: pry-byebug
43
+ name: debug
58
44
  requirement: !ruby/object:Gem::Requirement
59
45
  requirements:
60
46
  - - ">="