buildkite-builder 2.0.0.beta2 → 2.0.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/buildkite/builder/extensions/steps.rb +4 -4
- data/lib/buildkite/builder/plugin.rb +19 -0
- data/lib/buildkite/builder/plugin_collection.rb +45 -0
- data/lib/buildkite/builder/{plugin_registry.rb → plugin_manager.rb} +3 -3
- data/lib/buildkite/builder/{template_registry.rb → template_manager.rb} +1 -1
- data/lib/buildkite/builder.rb +4 -2
- data/lib/buildkite/pipelines/helpers/plugins.rb +9 -10
- metadata +6 -5
- data/lib/buildkite/pipelines/plugin.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4927ec61e94b42ab3c54f0cdafa0c9773b24876e9f5fd067eed495269db3e08
|
4
|
+
data.tar.gz: c730432ae672df3893b03e1ee0a6097f0f525c2f5236df642159ae93882cdbbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92fe3fea6d81dabd5da1eacb55445e54845ba6d53c6b059f17e665de6e794341367cdedcad6d89d14cd47a229e8503bf59120bbb6e0ccad40c2e49fa49f51589
|
7
|
+
data.tar.gz: fb4b849e2987e39c6bef52c3896822900151e1c8f12a00b4e825e405348bba62c3dc91275ecc93ae2ac892a96efbcb1d7b12a5962723e8b84664d96249908630
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.0.
|
1
|
+
2.0.0.beta3
|
@@ -4,8 +4,8 @@ module Buildkite
|
|
4
4
|
class Steps < Extension
|
5
5
|
def prepare
|
6
6
|
context.data.steps = StepCollection.new(
|
7
|
-
|
8
|
-
|
7
|
+
TemplateManager.new(context.root),
|
8
|
+
PluginManager.new
|
9
9
|
)
|
10
10
|
end
|
11
11
|
|
@@ -16,8 +16,8 @@ module Buildkite
|
|
16
16
|
context.data.steps.push(Buildkite::Builder::Group.new(label, context.data.steps, &block))
|
17
17
|
end
|
18
18
|
|
19
|
-
def plugin(name, uri
|
20
|
-
context.data.steps.plugins.add(name, uri
|
19
|
+
def plugin(name, uri)
|
20
|
+
context.data.steps.plugins.add(name, uri)
|
21
21
|
end
|
22
22
|
|
23
23
|
def block(template = nil, **args, &block)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Buildkite
|
4
|
+
module Builder
|
5
|
+
class Plugin
|
6
|
+
attr_reader :uri, :source, :version, :options
|
7
|
+
|
8
|
+
def initialize(uri, options = nil)
|
9
|
+
@uri = uri
|
10
|
+
@source, @version = uri.split('#')
|
11
|
+
@options = options
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_h
|
15
|
+
Buildkite::Pipelines::Helpers.sanitize(uri => options)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Buildkite
|
2
|
+
module Builder
|
3
|
+
class PluginCollection
|
4
|
+
attr_reader :plugin_manager
|
5
|
+
|
6
|
+
def initialize(plugin_manager)
|
7
|
+
@plugin_manager = plugin_manager
|
8
|
+
@collection = []
|
9
|
+
end
|
10
|
+
|
11
|
+
def add(resource, options = nil)
|
12
|
+
plugin =
|
13
|
+
case resource
|
14
|
+
when Symbol
|
15
|
+
uri = plugin_manager.fetch(resource.to_s)
|
16
|
+
|
17
|
+
raise ArgumentError, "Plugin `#{resource}` does not exist" unless uri
|
18
|
+
|
19
|
+
Plugin.new(uri, options)
|
20
|
+
when String
|
21
|
+
Plugin.new(resource, options)
|
22
|
+
when Plugin
|
23
|
+
resource
|
24
|
+
else
|
25
|
+
raise ArgumentError, "Unknown plugin `#{resource.inspect}`"
|
26
|
+
end
|
27
|
+
|
28
|
+
@collection.push(plugin).last
|
29
|
+
end
|
30
|
+
|
31
|
+
def find(source)
|
32
|
+
source_string =
|
33
|
+
case source
|
34
|
+
when String then source
|
35
|
+
when Plugin then source.source
|
36
|
+
else raise ArgumentError, "Unknown source #{source.inpect}"
|
37
|
+
end
|
38
|
+
|
39
|
+
@collection.select do |plugin|
|
40
|
+
plugin.source == source_string
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -1,18 +1,18 @@
|
|
1
1
|
module Buildkite
|
2
2
|
module Builder
|
3
|
-
class
|
3
|
+
class PluginManager
|
4
4
|
def initialize
|
5
5
|
@plugins = {}
|
6
6
|
end
|
7
7
|
|
8
|
-
def add(name, uri
|
8
|
+
def add(name, uri)
|
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] =
|
15
|
+
@plugins[name] = uri
|
16
16
|
end
|
17
17
|
|
18
18
|
def fetch(name)
|
data/lib/buildkite/builder.rb
CHANGED
@@ -20,9 +20,11 @@ module Buildkite
|
|
20
20
|
autoload :Manifest, File.expand_path('builder/manifest', __dir__)
|
21
21
|
autoload :Processors, File.expand_path('builder/processors', __dir__)
|
22
22
|
autoload :Rainbow, File.expand_path('builder/rainbow', __dir__)
|
23
|
+
autoload :Plugin, File.expand_path('builder/plugin', __dir__)
|
24
|
+
autoload :PluginCollection, File.expand_path('builder/plugin_collection', __dir__)
|
23
25
|
autoload :StepCollection, File.expand_path('builder/step_collection', __dir__)
|
24
|
-
autoload :
|
25
|
-
autoload :
|
26
|
+
autoload :TemplateManager, File.expand_path('builder/template_manager', __dir__)
|
27
|
+
autoload :PluginManager, File.expand_path('builder/plugin_manager', __dir__)
|
26
28
|
|
27
29
|
BUILDKITE_DIRECTORY_NAME = Pathname.new('.buildkite').freeze
|
28
30
|
|
@@ -4,19 +4,18 @@ module Buildkite
|
|
4
4
|
module Pipelines
|
5
5
|
module Helpers
|
6
6
|
module Plugins
|
7
|
-
def plugin(
|
8
|
-
|
9
|
-
|
7
|
+
def plugin(name_or_source, options = nil)
|
8
|
+
append(:plugins, plugin_collection.add(name_or_source, options).to_h)
|
9
|
+
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
def plugins
|
12
|
+
plugin_collection
|
13
|
+
end
|
14
14
|
|
15
|
-
|
16
|
-
new_plugin = Plugin.new(uri, version, options)
|
17
|
-
@plugins[plugin_name] = new_plugin
|
15
|
+
private
|
18
16
|
|
19
|
-
|
17
|
+
def plugin_collection
|
18
|
+
@plugin_collection ||= Buildkite::Builder::PluginCollection.new(step_collection.plugins)
|
20
19
|
end
|
21
20
|
end
|
22
21
|
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: 2.0.0.
|
4
|
+
version: 2.0.0.beta3
|
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: 2021-08-
|
12
|
+
date: 2021-08-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sorted_set
|
@@ -155,10 +155,12 @@ files:
|
|
155
155
|
- lib/buildkite/builder/manifest.rb
|
156
156
|
- lib/buildkite/builder/manifest/rule.rb
|
157
157
|
- lib/buildkite/builder/pipeline.rb
|
158
|
-
- lib/buildkite/builder/
|
158
|
+
- lib/buildkite/builder/plugin.rb
|
159
|
+
- lib/buildkite/builder/plugin_collection.rb
|
160
|
+
- lib/buildkite/builder/plugin_manager.rb
|
159
161
|
- lib/buildkite/builder/rainbow.rb
|
160
162
|
- lib/buildkite/builder/step_collection.rb
|
161
|
-
- lib/buildkite/builder/
|
163
|
+
- lib/buildkite/builder/template_manager.rb
|
162
164
|
- lib/buildkite/env.rb
|
163
165
|
- lib/buildkite/pipelines.rb
|
164
166
|
- lib/buildkite/pipelines/api.rb
|
@@ -175,7 +177,6 @@ files:
|
|
175
177
|
- lib/buildkite/pipelines/helpers/skip.rb
|
176
178
|
- lib/buildkite/pipelines/helpers/soft_fail.rb
|
177
179
|
- lib/buildkite/pipelines/helpers/timeout_in_minutes.rb
|
178
|
-
- lib/buildkite/pipelines/plugin.rb
|
179
180
|
- lib/buildkite/pipelines/step_context.rb
|
180
181
|
- lib/buildkite/pipelines/steps.rb
|
181
182
|
- lib/buildkite/pipelines/steps/abstract.rb
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Buildkite
|
4
|
-
module Pipelines
|
5
|
-
class Plugin
|
6
|
-
attr_reader :uri, :version, :options
|
7
|
-
|
8
|
-
def initialize(uri, version, options = nil)
|
9
|
-
@uri = uri
|
10
|
-
@version = version
|
11
|
-
@options = options
|
12
|
-
end
|
13
|
-
|
14
|
-
def full_uri
|
15
|
-
"#{uri}##{version}"
|
16
|
-
end
|
17
|
-
|
18
|
-
def to_h
|
19
|
-
Helpers.sanitize(full_uri => options)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|