buildkite-builder 3.1.0 → 3.2.0
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 +3 -0
- data/VERSION +1 -1
- data/lib/buildkite/builder/extensions/sub_pipelines.rb +47 -37
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d50f76bdcfda9a7561fce2b86dbae5b0ea99d37c0dbd6c763b35541a39e904c8
|
4
|
+
data.tar.gz: 2fbd91625db37b0bf88546931254b4f4024de25d3d20d09267318eafae2e3646
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5902b46da66c6ec7828d1bdf4f148f5445f2c7820e9f209e4a7ea22dae1ac8e62ea397660cca1f512737681c4c9397b97d5361f0fd64dba95066cb32751489ad
|
7
|
+
data.tar.gz: f67169e9bbdb7b84ccc1a6a8fec9593e878b70759e74f7236f595a3772649ce140d3ae99a329e090fb514c9bbbb450d70e58ea6362459404bced23f4a575cab1
|
data/CHANGELOG.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.2.0
|
@@ -7,7 +7,7 @@ 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
|
attribute :depends_on, append: true
|
13
13
|
attribute :key
|
@@ -16,26 +16,33 @@ module Buildkite
|
|
16
16
|
name.split('::').last.downcase.to_sym
|
17
17
|
end
|
18
18
|
|
19
|
-
def initialize(name,
|
19
|
+
def initialize(name, context, &block)
|
20
|
+
@context = context
|
20
21
|
@name = name
|
21
22
|
@data = Data.new
|
22
23
|
@data.steps = StepCollection.new(
|
23
|
-
steps.templates,
|
24
|
-
steps.plugins
|
24
|
+
context.data.steps.templates,
|
25
|
+
context.data.steps.plugins
|
25
26
|
)
|
26
27
|
@data.notify = []
|
27
28
|
@data.env = {}
|
28
29
|
|
29
|
-
|
30
|
-
@dsl.
|
31
|
-
|
32
|
-
@dsl.
|
30
|
+
# Use `clone` to copy over dsl's extended extensions
|
31
|
+
@dsl = context.dsl.clone
|
32
|
+
# Override dsl context to current pipeline
|
33
|
+
@dsl.instance_variable_set(:@context, self)
|
34
|
+
|
33
35
|
instance_eval(&block) if block_given?
|
34
36
|
self
|
35
37
|
end
|
36
38
|
|
37
39
|
def to_h
|
38
40
|
attributes = super
|
41
|
+
# Merge envs from main pipeline, since ruby does not have `reverse_merge` and
|
42
|
+
# `data` does not allow keys override, we have to reset the data hash per key.
|
43
|
+
@context.data.env.merge(data.env).each do |key, value|
|
44
|
+
data.env[key] = value
|
45
|
+
end
|
39
46
|
attributes.merge(data.to_definition)
|
40
47
|
end
|
41
48
|
|
@@ -53,40 +60,43 @@ module Buildkite
|
|
53
60
|
end
|
54
61
|
|
55
62
|
dsl do
|
56
|
-
def pipeline(name,
|
63
|
+
def pipeline(name, **options, &block)
|
57
64
|
raise "Subpipeline must have a name" if name.empty?
|
58
65
|
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
66
|
|
67
|
+
sub_pipeline = Buildkite::Builder::Extensions::SubPipelines::Pipeline.new(name, context, &block)
|
61
68
|
context.data.pipelines.add(sub_pipeline)
|
62
69
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
context
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
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
|
78
|
+
|
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
|
90
100
|
end
|
91
101
|
end
|
92
102
|
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.
|
4
|
+
version: 3.2.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-
|
12
|
+
date: 2022-06-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rainbow
|