buildkite-builder 3.1.0 → 3.3.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 +4 -4
- data/CHANGELOG.md +10 -0
- data/VERSION +1 -1
- data/lib/buildkite/builder/extensions/sub_pipelines.rb +51 -39
- data/lib/buildkite/builder/pipeline_collection.rb +1 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad16f8a66cf5c9c52bbbce15ccbd29589294309739a63f67a8982403f51b9b36
|
4
|
+
data.tar.gz: d148df13c7489629bb2d23c772fa309f937cf65ceafd46eb0303d199b4292f0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7be78bd7cf1891adaf95c557861c6f5b8cc8b16e28ecabae1406eba44526e0e16fc13df245d253f73892dae0324255d2ecb6837643ef1058b18bfdb87801521b
|
7
|
+
data.tar.gz: 2ae512dbf1f76794531d5f4ef278fffc061e10d21074d8eb0de7454cc55b2dc50b61c5b30695152283790234a3a9da52ccd4b734067ed7bdc90b7898304feec9
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## 3.3.1
|
2
|
+
* Add support to iterate over subpipelines.
|
3
|
+
* Allow build options to be passed to subpipelines.
|
4
|
+
|
5
|
+
## 3.3.0
|
6
|
+
* Remove arguments in sub-pipeline's trigger step setup and use dsl delegation instead.
|
7
|
+
|
8
|
+
## 3.2.0
|
9
|
+
* Remove `template` from sub-pipeline trigger step setup and use arguments instead.
|
10
|
+
|
1
11
|
## 3.1.0
|
2
12
|
* Add subpipeline support to save triggered pipeline's YML definition beforehand to artifacts and pass down the file to an ENV for pipeline setup.
|
3
13
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1
|
1
|
+
3.3.1
|
@@ -7,35 +7,50 @@ module Buildkite
|
|
7
7
|
class Pipeline
|
8
8
|
include Buildkite::Pipelines::Attributes
|
9
9
|
|
10
|
-
attr_reader :data, :name
|
10
|
+
attr_reader :data, :name, :dsl
|
11
11
|
|
12
|
-
|
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
|
21
|
+
attribute :build
|
14
22
|
|
15
23
|
def self.to_sym
|
16
24
|
name.split('::').last.downcase.to_sym
|
17
25
|
end
|
18
26
|
|
19
|
-
def initialize(name,
|
27
|
+
def initialize(name, context, &block)
|
28
|
+
@context = context
|
20
29
|
@name = name
|
21
30
|
@data = Data.new
|
22
31
|
@data.steps = StepCollection.new(
|
23
|
-
steps.templates,
|
24
|
-
steps.plugins
|
32
|
+
context.data.steps.templates,
|
33
|
+
context.data.steps.plugins
|
25
34
|
)
|
26
35
|
@data.notify = []
|
27
36
|
@data.env = {}
|
28
37
|
|
29
|
-
|
30
|
-
@dsl.
|
31
|
-
|
32
|
-
@dsl.
|
38
|
+
# Use `clone` to copy over dsl's extended extensions
|
39
|
+
@dsl = context.dsl.clone
|
40
|
+
# Override dsl context to current pipeline
|
41
|
+
@dsl.instance_variable_set(:@context, self)
|
42
|
+
|
33
43
|
instance_eval(&block) if block_given?
|
34
44
|
self
|
35
45
|
end
|
36
46
|
|
37
47
|
def to_h
|
38
48
|
attributes = super
|
49
|
+
# Merge envs from main pipeline, since ruby does not have `reverse_merge` and
|
50
|
+
# `data` does not allow keys override, we have to reset the data hash per key.
|
51
|
+
@context.data.env.merge(data.env).each do |key, value|
|
52
|
+
data.env[key] = value
|
53
|
+
end
|
39
54
|
attributes.merge(data.to_definition)
|
40
55
|
end
|
41
56
|
|
@@ -53,41 +68,38 @@ module Buildkite
|
|
53
68
|
end
|
54
69
|
|
55
70
|
dsl do
|
56
|
-
def pipeline(name,
|
71
|
+
def pipeline(name, &block)
|
57
72
|
raise "Subpipeline must have a name" if name.empty?
|
58
73
|
raise "Subpipeline does not allow nested in another Subpipeline" if context.is_a?(Buildkite::Builder::Extensions::SubPipelines::Pipeline)
|
59
|
-
sub_pipeline = Buildkite::Builder::Extensions::SubPipelines::Pipeline.new(name, context.data.steps, &block)
|
60
74
|
|
75
|
+
sub_pipeline = Buildkite::Builder::Extensions::SubPipelines::Pipeline.new(name, context, &block)
|
61
76
|
context.data.pipelines.add(sub_pipeline)
|
62
77
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
)
|
89
|
-
end
|
90
|
-
end
|
78
|
+
trigger_step = context.data.steps.add(Pipelines::Steps::Trigger)
|
79
|
+
trigger_step.trigger(name)
|
80
|
+
|
81
|
+
build_options = {
|
82
|
+
message: '${BUILDKITE_MESSAGE}',
|
83
|
+
commit: '${BUILDKITE_COMMIT}',
|
84
|
+
branch: '${BUILDKITE_BRANCH}',
|
85
|
+
env: {
|
86
|
+
BUILDKITE_PULL_REQUEST: '${BUILDKITE_PULL_REQUEST}',
|
87
|
+
BUILDKITE_PULL_REQUEST_BASE_BRANCH: '${BUILDKITE_PULL_REQUEST_BASE_BRANCH}',
|
88
|
+
BUILDKITE_PULL_REQUEST_REPO: '${BUILDKITE_PULL_REQUEST_REPO}',
|
89
|
+
BKB_SUBPIPELINE_FILE: sub_pipeline.pipeline_yml
|
90
|
+
}
|
91
|
+
}
|
92
|
+
build_options.merge!(sub_pipeline.build) if sub_pipeline.build
|
93
|
+
|
94
|
+
trigger_step.build(build_options)
|
95
|
+
trigger_step.key(sub_pipeline.key || "subpipeline_#{name}_#{context.data.pipelines.count}")
|
96
|
+
trigger_step.label(sub_pipeline.label || name.capitalize)
|
97
|
+
trigger_step.async(sub_pipeline.async || false)
|
98
|
+
trigger_step.branches(sub_pipeline.branches) if sub_pipeline.branches
|
99
|
+
trigger_step.condition(sub_pipeline.condition) if sub_pipeline.condition
|
100
|
+
trigger_step.depends_on(*sub_pipeline.get('depends_on')) if sub_pipeline.get('depends_on')
|
101
|
+
trigger_step.allow_dependency_failure(sub_pipeline.allow_dependency_failure || false)
|
102
|
+
trigger_step.skip(sub_pipeline.skip || false)
|
91
103
|
end
|
92
104
|
end
|
93
105
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buildkite-builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1
|
4
|
+
version: 3.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ngan Pham
|
8
8
|
- Andrew Lee
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-06-
|
12
|
+
date: 2022-06-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rainbow
|
@@ -177,7 +177,7 @@ metadata:
|
|
177
177
|
source_code_uri: https://github.com/Gusto/buildkite-builder
|
178
178
|
changelog_uri: https://github.com/Gusto/buildkite-builder/blob/master/CHANGELOG.md
|
179
179
|
bug_tracker_uri: https://github.com/Gusto/buildkite-builder/issues
|
180
|
-
post_install_message:
|
180
|
+
post_install_message:
|
181
181
|
rdoc_options: []
|
182
182
|
require_paths:
|
183
183
|
- lib
|
@@ -192,8 +192,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
192
|
- !ruby/object:Gem::Version
|
193
193
|
version: '0'
|
194
194
|
requirements: []
|
195
|
-
rubygems_version: 3.
|
196
|
-
signing_key:
|
195
|
+
rubygems_version: 3.0.3.1
|
196
|
+
signing_key:
|
197
197
|
specification_version: 4
|
198
198
|
summary: A gem for programmatically creating Buildkite pipelines.
|
199
199
|
test_files: []
|