buildkite-builder 3.2.0 → 3.3.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: d50f76bdcfda9a7561fce2b86dbae5b0ea99d37c0dbd6c763b35541a39e904c8
4
- data.tar.gz: 2fbd91625db37b0bf88546931254b4f4024de25d3d20d09267318eafae2e3646
3
+ metadata.gz: 2946cdcde9aa6a6474bb3f9464d77b5ac9831fe1c5f3a27e289017e215f711a4
4
+ data.tar.gz: 6cbc69d2ea605f0427577daf28ed0243f56ccb3b12338662c08d377774ac5177
5
5
  SHA512:
6
- metadata.gz: 5902b46da66c6ec7828d1bdf4f148f5445f2c7820e9f209e4a7ea22dae1ac8e62ea397660cca1f512737681c4c9397b97d5361f0fd64dba95066cb32751489ad
7
- data.tar.gz: f67169e9bbdb7b84ccc1a6a8fec9593e878b70759e74f7236f595a3772649ce140d3ae99a329e090fb514c9bbbb450d70e58ea6362459404bced23f4a575cab1
6
+ metadata.gz: 04b63489255060c1237b8c25094b0aba3e99fe08079d23ab13173392e36908bf9db798224b70e5c28dfaccbb9323dfd2c11c8e4446bad0a9fd6fd4d74b44de8a
7
+ data.tar.gz: b1685985083035299d690371891f05d16c0dc932b159551f1b1ae23d645c4764d63456f44d29ce72e97251ad38ac6229622ba7795d173f8acc72a1ad09e8756e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 3.3.0
2
+ * Remove arguments in sub-pipeline's trigger step setup and use dsl delegation instead.
3
+
1
4
  ## 3.2.0
2
5
  * Remove `template` from sub-pipeline trigger step setup and use arguments instead.
3
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.2.0
1
+ 3.3.0
@@ -9,8 +9,15 @@ module Buildkite
9
9
 
10
10
  attr_reader :data, :name, :dsl
11
11
 
12
- attribute :depends_on, append: true
12
+ # These attributes are for triggered step
13
+ attribute :label
13
14
  attribute :key
15
+ attribute :skip
16
+ attribute :if, as: :condition
17
+ attribute :depends_on, append: true
18
+ attribute :allow_dependency_failure
19
+ attribute :branches
20
+ attribute :async
14
21
 
15
22
  def self.to_sym
16
23
  name.split('::').last.downcase.to_sym
@@ -60,44 +67,35 @@ module Buildkite
60
67
  end
61
68
 
62
69
  dsl do
63
- def pipeline(name, **options, &block)
70
+ def pipeline(name, &block)
64
71
  raise "Subpipeline must have a name" if name.empty?
65
72
  raise "Subpipeline does not allow nested in another Subpipeline" if context.is_a?(Buildkite::Builder::Extensions::SubPipelines::Pipeline)
66
73
 
67
74
  sub_pipeline = Buildkite::Builder::Extensions::SubPipelines::Pipeline.new(name, context, &block)
68
75
  context.data.pipelines.add(sub_pipeline)
69
76
 
70
- options = options.slice(:key, :label, :async, :branches, :condition, :depends_on, :allow_dependency_failure, :skip, :emoji)
71
- options[:key] ||= "subpipeline_#{name}_#{context.data.pipelines.count}"
72
- options[:label] ||= name.capitalize
73
-
74
- if options[:emoji]
75
- emoji = Array(options.delete(:emoji)).map { |name| ":#{name}:" }.join
76
- options[:label] = [emoji, options[:label]].compact.join(' ')
77
- end
77
+ trigger_step = context.data.steps.add(Pipelines::Steps::Trigger)
78
+ trigger_step.trigger(name)
79
+ trigger_step.build(
80
+ message: '${BUILDKITE_MESSAGE}',
81
+ commit: '${BUILDKITE_COMMIT}',
82
+ branch: '${BUILDKITE_BRANCH}',
83
+ env: {
84
+ BUILDKITE_PULL_REQUEST: '${BUILDKITE_PULL_REQUEST}',
85
+ BUILDKITE_PULL_REQUEST_BASE_BRANCH: '${BUILDKITE_PULL_REQUEST_BASE_BRANCH}',
86
+ BUILDKITE_PULL_REQUEST_REPO: '${BUILDKITE_PULL_REQUEST_REPO}',
87
+ BKB_SUBPIPELINE_FILE: sub_pipeline.pipeline_yml
88
+ }
89
+ )
78
90
 
79
- context.data.steps.add(Pipelines::Steps::Trigger, **options) do |context|
80
- key context[:key]
81
- label context[:label]
82
- trigger name
83
- build(
84
- message: '${BUILDKITE_MESSAGE}',
85
- commit: '${BUILDKITE_COMMIT}',
86
- branch: '${BUILDKITE_BRANCH}',
87
- env: {
88
- BUILDKITE_PULL_REQUEST: '${BUILDKITE_PULL_REQUEST}',
89
- BUILDKITE_PULL_REQUEST_BASE_BRANCH: '${BUILDKITE_PULL_REQUEST_BASE_BRANCH}',
90
- BUILDKITE_PULL_REQUEST_REPO: '${BUILDKITE_PULL_REQUEST_REPO}',
91
- BKB_SUBPIPELINE_FILE: sub_pipeline.pipeline_yml
92
- }
93
- )
94
- async context[:async] || false
95
- branches context[:branches] if context[:branches]
96
- condition context[:condition] if context[:condition]
97
- depends_on *context[:depends_on] if context[:depends_on]
98
- allow_dependency_failure context[:allow_dependency_failure] || false
99
- skip context[:skip] || false
100
- end
91
+ trigger_step.key(sub_pipeline.key || "subpipeline_#{name}_#{context.data.pipelines.count}")
92
+ trigger_step.label(sub_pipeline.label || name.capitalize)
93
+ trigger_step.async(sub_pipeline.async || false)
94
+ trigger_step.branches(sub_pipeline.branches) if sub_pipeline.branches
95
+ trigger_step.condition(sub_pipeline.condition) if sub_pipeline.condition
96
+ trigger_step.depends_on(*sub_pipeline.get('depends_on')) if sub_pipeline.get('depends_on')
97
+ trigger_step.allow_dependency_failure(sub_pipeline.allow_dependency_failure || false)
98
+ trigger_step.skip(sub_pipeline.skip || false)
101
99
  end
102
100
  end
103
101
  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.2.0
4
+ version: 3.3.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-13 00:00:00.000000000 Z
12
+ date: 2022-06-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rainbow