concourse-objects 1.15.2
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 +7 -0
- checksums.yaml.gz.sig +0 -0
- data/.gitignore +59 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +22 -0
- data/README.org +41 -0
- data/concourse-objects.gemspec +21 -0
- data/lib/concourse-objects/resources/bosh-io-release.rb +34 -0
- data/lib/concourse-objects/resources/bosh-io-stemcell.rb +37 -0
- data/lib/concourse-objects/resources/cf.rb +56 -0
- data/lib/concourse-objects/resources/docker-image.rb +93 -0
- data/lib/concourse-objects/resources/git.rb +111 -0
- data/lib/concourse-objects/resources/github-release.rb +79 -0
- data/lib/concourse-objects/resources/hg.rb +54 -0
- data/lib/concourse-objects/resources/pool.rb +59 -0
- data/lib/concourse-objects/resources/registry-image.rb +49 -0
- data/lib/concourse-objects/resources/s3.rb +83 -0
- data/lib/concourse-objects/resources/semver.rb +135 -0
- data/lib/concourse-objects/resources/time.rb +29 -0
- data/lib/concourse-objects/resources.rb +59 -0
- data/lib/concourse-objects.rb +449 -0
- data/tools/check-resources +39 -0
- data/tools/test +72 -0
- data/trust/certificates/colstrom.pem +25 -0
- data.tar.gz.sig +0 -0
- metadata +90 -0
- metadata.gz.sig +0 -0
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "set" # SPDX-License-Identifier: Ruby
|
|
4
|
+
require "yaml" # SPDX-License-Identifier: Ruby
|
|
5
|
+
|
|
6
|
+
module ConcourseObjects
|
|
7
|
+
class Object
|
|
8
|
+
def self.call(object)
|
|
9
|
+
case object
|
|
10
|
+
when self then object
|
|
11
|
+
when Hash then new(object)
|
|
12
|
+
when Array then object.map(&self)
|
|
13
|
+
when nil then nil
|
|
14
|
+
else raise TypeError, "#{self.class.inspect} does not know how to parse #{object.class}(#{object.inspect})"
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.to_proc
|
|
19
|
+
proc { |*rest| self.call(*rest) }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
AsString = ->(source) { String(source) }
|
|
23
|
+
AsInteger = ->(source) { Integer(source) }
|
|
24
|
+
AsHash = ->(source) { Hash(source) }
|
|
25
|
+
AsHashOf = ->(keys, values, source) { AsHash.(source).transform_keys(&keys).transform_keys(&values) }.curry
|
|
26
|
+
AsBoolean = ->(source) { source ? true : false }
|
|
27
|
+
AsArray = lambda do |source|
|
|
28
|
+
case source
|
|
29
|
+
when Array then source
|
|
30
|
+
when Hash then [source]
|
|
31
|
+
else Array(source)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
AsArrayOf = ->(entries, source) { AsArray.(source).map(&entries) }.curry
|
|
35
|
+
|
|
36
|
+
Nothing = proc { nil }
|
|
37
|
+
EmptyArray = proc { [] }
|
|
38
|
+
EmptyHash = proc { [] }
|
|
39
|
+
|
|
40
|
+
def hash
|
|
41
|
+
self.to_h.hash
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def eql?(other)
|
|
45
|
+
self.hash == other.hash
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def initialize(options = {})
|
|
49
|
+
options.transform_keys(&:to_sym).yield_self do |options|
|
|
50
|
+
# if ENV["REPORT_UNKNOWN_KEYS"]
|
|
51
|
+
# (Set.new(options.keys) - self.class.attributes).each do |attr|
|
|
52
|
+
# STDERR.puts "#{self.class.inspect} has no attribute :#{attr}"
|
|
53
|
+
# end
|
|
54
|
+
# end
|
|
55
|
+
|
|
56
|
+
self.class.required_attributes.each do |required|
|
|
57
|
+
if options.key?(required)
|
|
58
|
+
self.public_send("#{required}=", options.fetch(required))
|
|
59
|
+
else
|
|
60
|
+
raise KeyError, "#{self.class.inspect} is missing required attribute: #{required}"
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
self.class.optional_attributes.each do |optional|
|
|
65
|
+
self.public_send("#{optional}=", options.fetch(optional)) if options.key?(optional)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
yield self, options if block_given?
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def self.keys
|
|
73
|
+
instance_methods(false).map(&:to_s)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def to_h
|
|
77
|
+
instance_variables.map(&:to_s).sort.map do |key|
|
|
78
|
+
instance_variable_get(key.delete_prefix("@").prepend("@")).yield_self do |value|
|
|
79
|
+
[
|
|
80
|
+
key.delete_prefix("@"),
|
|
81
|
+
(
|
|
82
|
+
if (Array === value)
|
|
83
|
+
value.map do |value|
|
|
84
|
+
((ConcourseObjects::Object === value) ? value.to_h : value)
|
|
85
|
+
end
|
|
86
|
+
else
|
|
87
|
+
((ConcourseObjects::Object === value) ? value.to_h : value)
|
|
88
|
+
end
|
|
89
|
+
)
|
|
90
|
+
] unless key.match? /@_/
|
|
91
|
+
end
|
|
92
|
+
end.to_h.compact
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def to_yaml
|
|
96
|
+
YAML.dump(self.to_h)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def __instance_variable_name(name)
|
|
100
|
+
String(name).delete_suffix("?").delete_suffix("=").prepend("@").to_sym
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def self.map(callable)
|
|
104
|
+
->(enumerable) { enumerable.map(&callable) }
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def self.singleton_class_Set(*attrs)
|
|
108
|
+
String(__callee__).prepend("@@").yield_self do |class_variable|
|
|
109
|
+
if singleton_class.class_variable_defined?(class_variable)
|
|
110
|
+
singleton_class.class_variable_get(class_variable)
|
|
111
|
+
else
|
|
112
|
+
singleton_class.class_variable_set(class_variable, Set.new)
|
|
113
|
+
end.tap do |set|
|
|
114
|
+
attrs.reduce(set, :<<)
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
singleton_class.alias_method :required_attributes, :singleton_class_Set
|
|
120
|
+
singleton_class.alias_method :readable_attributes, :singleton_class_Set
|
|
121
|
+
singleton_class.alias_method :writable_attributes, :singleton_class_Set
|
|
122
|
+
|
|
123
|
+
def self.attributes
|
|
124
|
+
readable_attributes + writable_attributes
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def self.optional_attributes
|
|
128
|
+
attributes - required_attributes
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def self.readable(attr, &default)
|
|
132
|
+
String(attr).yield_self do |attr|
|
|
133
|
+
define_method("#{attr}?") do
|
|
134
|
+
not instance_variable_get("@#{attr}").nil?
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
define_method(attr) do
|
|
138
|
+
if instance_variable_defined?("@#{attr}")
|
|
139
|
+
instance_variable_get("@#{attr}")
|
|
140
|
+
else
|
|
141
|
+
default.(self) if default
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
readable_attributes << attr.to_sym
|
|
146
|
+
|
|
147
|
+
return attr.to_sym
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def self.writable(attr, transforms = [], &guard)
|
|
152
|
+
Array(transforms).map do |transform|
|
|
153
|
+
if transform.respond_to?(:call)
|
|
154
|
+
transform
|
|
155
|
+
elsif transform.respond_to?(:to_proc)
|
|
156
|
+
transform.to_proc
|
|
157
|
+
elsif transform.is_a?(Class)
|
|
158
|
+
->(object) { object.send(transform.name, object) }
|
|
159
|
+
else
|
|
160
|
+
raise TypeError, "transformations must be callable"
|
|
161
|
+
end
|
|
162
|
+
end.yield_self do |transforms|
|
|
163
|
+
String(attr).yield_self do |attr|
|
|
164
|
+
define_method("#{attr}=") do |value|
|
|
165
|
+
return unless guard.(self, value) if guard
|
|
166
|
+
|
|
167
|
+
if value.nil?
|
|
168
|
+
remove_instance_variable("@#{attr}")
|
|
169
|
+
else
|
|
170
|
+
transforms.reduce(value) do |value, transform|
|
|
171
|
+
transform.(value)
|
|
172
|
+
end.yield_self do |value|
|
|
173
|
+
instance_variable_set("@#{attr}", value)
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
writable_attributes << attr.to_sym
|
|
179
|
+
|
|
180
|
+
return attr.to_sym
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def self.optional(attr, required: false, write: [], default: nil, guard: nil)
|
|
186
|
+
readable(attr, &default)
|
|
187
|
+
writable(attr, write, &guard)
|
|
188
|
+
|
|
189
|
+
return attr.to_sym
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
def self.required(attr, *rest)
|
|
193
|
+
required_attributes << optional(attr, *rest)
|
|
194
|
+
|
|
195
|
+
return attr.to_sym
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
def self.inherited(child)
|
|
199
|
+
self.required_attributes.reduce(child.required_attributes, :<<)
|
|
200
|
+
self.readable_attributes.reduce(child.readable_attributes, :<<)
|
|
201
|
+
self.writable_attributes.reduce(child.writable_attributes, :<<)
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
class Step < Object
|
|
206
|
+
class InParallel < Object
|
|
207
|
+
DEFAULT_FAIL_FAST = false
|
|
208
|
+
|
|
209
|
+
def self.call(object)
|
|
210
|
+
case object
|
|
211
|
+
when Array then new("steps" => object)
|
|
212
|
+
else super(object)
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
optional :steps, write: AsArrayOf.(Step), default: EmptyArray
|
|
217
|
+
optional :fail_fast, write: AsBoolean, default: proc { DEFAULT_FAIL_FAST }
|
|
218
|
+
optional :limit, write: AsInteger
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
DEFAULT_PRIVILEGED = false
|
|
222
|
+
DEFAULT_TRIGGER = false
|
|
223
|
+
DEFAULT_VERSION = "latest"
|
|
224
|
+
ACCEPTABLE_VERSIONS = ["latest", "every", Hash]
|
|
225
|
+
|
|
226
|
+
TYPES = %i[get put task in_parallel aggregate do try]
|
|
227
|
+
|
|
228
|
+
def initialize(options = {})
|
|
229
|
+
super(options) # first pass, as some keys are only acceptable if others are set first.
|
|
230
|
+
super(options) do |this, options|
|
|
231
|
+
raise KeyError, "#{self.class.inspect} is missing one of: (#{TYPES.join(' || ')})" unless TYPES.any? { |key| options.key?(key) }
|
|
232
|
+
raise KeyError, "#{self.class.inspect} is missing one of: (config || file)" if this.task? unless %i[config file].any? { |key| options.key?(key) }
|
|
233
|
+
yield this, options if block_given?
|
|
234
|
+
end
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
IsTask = proc { |step| step.task? }
|
|
238
|
+
IsPut = proc { |step| step.put? }
|
|
239
|
+
IsGet = proc { |step| step.get? }
|
|
240
|
+
UsesResource = proc { |step| step.get? or step.put? }
|
|
241
|
+
IsAction = proc { |step| step.get? or step.put? or step.task? }
|
|
242
|
+
|
|
243
|
+
optional :in_parallel, write: Step::InParallel
|
|
244
|
+
optional :aggregate, write: AsArrayOf.(Step), default: EmptyArray
|
|
245
|
+
optional :do, write: AsArrayOf.(Step), default: EmptyArray
|
|
246
|
+
optional :tags, write: AsArrayOf.(:to_s), default: EmptyArray
|
|
247
|
+
optional :params, write: AsHash, default: EmptyHash, guard: IsAction
|
|
248
|
+
optional :get_params, write: AsHash, default: EmptyHash, guard: IsPut
|
|
249
|
+
optional :inputs, write: AsArrayOf.(:to_s), default: EmptyArray, guard: IsPut
|
|
250
|
+
optional :passed, write: AsArrayOf.(:to_s), default: EmptyArray, guard: IsGet
|
|
251
|
+
optional :trigger, write: AsBoolean, default: proc { DEFAULT_TRIGGER }, guard: IsGet
|
|
252
|
+
optional :resource, write: AsString, default: proc { |step| step.name }, guard: UsesResource
|
|
253
|
+
optional :privileged, write: AsBoolean, default: proc { DEFAULT_PRIVILEGED }, guard: IsTask
|
|
254
|
+
optional :vars, write: AsHash, default: EmptyHash, guard: IsTask
|
|
255
|
+
optional :input_mapping, write: AsHash, default: EmptyHash, guard: IsTask
|
|
256
|
+
optional :output_mapping, write: AsHash, default: EmptyHash, guard: IsTask
|
|
257
|
+
optional :config, write: AsHash, default: EmptyHash, guard: IsTask
|
|
258
|
+
optional :file, write: AsString, guard: IsTask
|
|
259
|
+
optional :image, write: AsString, guard: IsTask
|
|
260
|
+
optional :get, write: AsString
|
|
261
|
+
optional :put, write: AsString
|
|
262
|
+
optional :task, write: AsString
|
|
263
|
+
optional :timeout, write: AsString
|
|
264
|
+
optional :attempts, write: AsInteger
|
|
265
|
+
optional :on_abort, write: Step
|
|
266
|
+
optional :on_failure, write: Step
|
|
267
|
+
optional :on_success, write: Step
|
|
268
|
+
optional :try, write: Step
|
|
269
|
+
|
|
270
|
+
readable(:version) { DEFAULT_VERSION }
|
|
271
|
+
|
|
272
|
+
def version=(version)
|
|
273
|
+
case version
|
|
274
|
+
when Hash then @version = version
|
|
275
|
+
when nil then remove_instance_variable(:@version)
|
|
276
|
+
else
|
|
277
|
+
String(version).yield_self do |version|
|
|
278
|
+
unless ACCEPTABLE_VERSIONS.any? { |av| av === version }
|
|
279
|
+
raise TypeError, %{#{self.class.inspect} expects :version to be one of: #{ACCEPTABLE_VERSIONS}, instead got: "#{version}"}
|
|
280
|
+
end
|
|
281
|
+
@version = version
|
|
282
|
+
end
|
|
283
|
+
end
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
writable_attributes << :version
|
|
287
|
+
|
|
288
|
+
def name
|
|
289
|
+
case type
|
|
290
|
+
when :get then @get
|
|
291
|
+
when :put then @put
|
|
292
|
+
when :task then @task
|
|
293
|
+
else nil
|
|
294
|
+
end
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
def type
|
|
298
|
+
return :get if @get
|
|
299
|
+
return :put if @put
|
|
300
|
+
return :task if @task
|
|
301
|
+
return :in_parallel if @in_parallel
|
|
302
|
+
return :do if @do
|
|
303
|
+
return :try if @try
|
|
304
|
+
return :aggregate if @aggregate
|
|
305
|
+
nil
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
def self.to_proc
|
|
309
|
+
Proc.new do |*rest|
|
|
310
|
+
self.call(*rest)
|
|
311
|
+
end
|
|
312
|
+
end
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
class RetentionConfig < Object
|
|
316
|
+
optional :builds, write: AsInteger
|
|
317
|
+
optional :days, write: AsInteger
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
class Job < Object
|
|
321
|
+
DEFAULT_DISABLE_MANUAL_TRIGGER = false
|
|
322
|
+
DEFAULT_INTERRUPTIBLE = false
|
|
323
|
+
DEFAULT_PUBLIC = false
|
|
324
|
+
DEFAULT_SERIAL = false
|
|
325
|
+
|
|
326
|
+
required :name, write: AsString
|
|
327
|
+
required :plan, write: AsArrayOf.(Step), default: EmptyArray
|
|
328
|
+
|
|
329
|
+
optional :serial_groups, write: AsArrayOf.(:to_s), default: EmptyArray
|
|
330
|
+
optional :max_in_flight, write: AsInteger, default: proc { |job| 1 if job.serial or job.serial_groups.any? }
|
|
331
|
+
optional :build_log_retention, write: RetentionConfig, default: proc { RetentionConfig.new }
|
|
332
|
+
optional :disable_manual_trigger, write: AsBoolean, default: proc { DEFAULT_DISABLE_MANUAL_TRIGGER }
|
|
333
|
+
optional :interruptible, write: AsBoolean, default: proc { DEFAULT_INTERRUPTIBLE }
|
|
334
|
+
optional :public, write: AsBoolean, default: proc { DEFAULT_PUBLIC }
|
|
335
|
+
optional :serial, write: AsBoolean, default: proc { DEFAULT_SERIAL }
|
|
336
|
+
optional :old_name, write: AsString
|
|
337
|
+
optional :ensure, write: Step
|
|
338
|
+
optional :on_abort, write: Step
|
|
339
|
+
optional :on_failure, write: Step
|
|
340
|
+
optional :on_success, write: Step
|
|
341
|
+
|
|
342
|
+
def initialize(options = {})
|
|
343
|
+
super(options) do |this, options|
|
|
344
|
+
this.build_log_retention = { builds: options.fetch(:build_logs_to_retain) } if options.key?(:build_logs_to_retain) unless this.build_log_retention?
|
|
345
|
+
|
|
346
|
+
yield this, options if block_given?
|
|
347
|
+
end
|
|
348
|
+
end
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
class Resource < Object
|
|
352
|
+
DEFAULT_CHECK_EVERY = "1m".freeze
|
|
353
|
+
DEFAULT_PUBLIC = false
|
|
354
|
+
|
|
355
|
+
required :name, write: AsString
|
|
356
|
+
required :type, write: AsString
|
|
357
|
+
|
|
358
|
+
optional :check_every, write: AsString, default: proc { DEFAULT_CHECK_EVERY }
|
|
359
|
+
optional :public, write: AsBoolean, default: proc { DEFAULT_PUBLIC }
|
|
360
|
+
optional :tags, write: AsArrayOf.(to_s), default: EmptyArray
|
|
361
|
+
optional :source, write: AsHash, default: EmptyHash
|
|
362
|
+
optional :icon, write: AsString
|
|
363
|
+
optional :version, write: AsString
|
|
364
|
+
optional :webhook_token, write: AsString
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
class ResourceType < Object
|
|
368
|
+
DEFAULT_PRIVILEGED = false
|
|
369
|
+
DEFAULT_CHECK_EVERY = "1m".freeze
|
|
370
|
+
DEFAULT_UNIQUE_VERSION_HISTORY = false
|
|
371
|
+
|
|
372
|
+
required :name, write: AsString
|
|
373
|
+
required :type, write: AsString
|
|
374
|
+
|
|
375
|
+
optional :source, write: AsHash, default: EmptyHash
|
|
376
|
+
optional :params, write: AsHash, default: EmptyHash
|
|
377
|
+
optional :privileged, write: AsBoolean, default: proc { DEFAULT_PRIVILEGED }
|
|
378
|
+
optional :unique_version_history, write: AsBoolean, default: proc { DEFAULT_UNIQUE_VERSION_HISTORY }
|
|
379
|
+
optional :check_every, write: AsString, default: proc { DEFAULT_CHECK_EVERY }
|
|
380
|
+
optional :tags, write: AsArrayOf.(:to_s), default: EmptyArray
|
|
381
|
+
end
|
|
382
|
+
|
|
383
|
+
class Group < Object
|
|
384
|
+
required :name, write: AsString
|
|
385
|
+
|
|
386
|
+
optional :jobs, write: AsArrayOf.(:to_s), default: EmptyArray
|
|
387
|
+
optional :resources, write: AsArrayOf.(:to_s), default: EmptyArray
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
class Pipeline < Object
|
|
391
|
+
optional :jobs, write: AsArrayOf.(Job), default: EmptyArray
|
|
392
|
+
optional :resources, write: AsArrayOf.(Resource), default: EmptyArray
|
|
393
|
+
optional :resource_types, write: AsArrayOf.(ResourceType), default: EmptyArray
|
|
394
|
+
optional :groups, write: AsArrayOf.(Group), default: EmptyArray
|
|
395
|
+
end
|
|
396
|
+
|
|
397
|
+
class RunConfig < Object
|
|
398
|
+
required :path, write: AsString
|
|
399
|
+
|
|
400
|
+
optional :args, write: AsArray.(:to_s), default: EmptyArray
|
|
401
|
+
optional :dir, write: AsString
|
|
402
|
+
optional :user, write: AsString
|
|
403
|
+
end
|
|
404
|
+
|
|
405
|
+
class ImageResource < Object
|
|
406
|
+
required :type, write: AsString
|
|
407
|
+
required :source, write: AsHash
|
|
408
|
+
|
|
409
|
+
optional :params, write: AsHash
|
|
410
|
+
optional :version, write: AsHashOf.(:to_s, :to_s)
|
|
411
|
+
end
|
|
412
|
+
|
|
413
|
+
class ContainerLimits < Object
|
|
414
|
+
optional :cpu, write: AsInteger
|
|
415
|
+
optional :memory, write: AsInteger
|
|
416
|
+
end
|
|
417
|
+
|
|
418
|
+
class Input < Object
|
|
419
|
+
DEFAULT_OPTIONAL = false
|
|
420
|
+
|
|
421
|
+
required :name, write: AsString
|
|
422
|
+
|
|
423
|
+
optional :path, write: AsString
|
|
424
|
+
optional :optional, write: AsBoolean, default: proc { DEFAULT_OPTIONAL }
|
|
425
|
+
end
|
|
426
|
+
|
|
427
|
+
class Output < Object
|
|
428
|
+
required :name, write: AsString
|
|
429
|
+
|
|
430
|
+
optional :path, write: AsString
|
|
431
|
+
end
|
|
432
|
+
|
|
433
|
+
class Cache < Object
|
|
434
|
+
required :path, write: AsString
|
|
435
|
+
end
|
|
436
|
+
|
|
437
|
+
class Task < Object
|
|
438
|
+
required :platform, write: AsString
|
|
439
|
+
required :run, write: RunConfig
|
|
440
|
+
|
|
441
|
+
optional :rootfs_uri, write: AsString
|
|
442
|
+
optional :image_resource, write: ImageResource
|
|
443
|
+
optional :container_limits, write: ContainerLimits, default: proc { ContainerLimits.new }
|
|
444
|
+
optional :inputs, write: AsArrayOf.(Input), default: EmptyArray
|
|
445
|
+
optional :outputs, write: AsArrayOf.(Output), default: EmptyArray
|
|
446
|
+
optional :caches, write: AsArrayOf.(Cache), default: EmptyArray
|
|
447
|
+
optional :params, write: AsHashOf.(:to_s, :to_s), default: EmptyHash
|
|
448
|
+
end
|
|
449
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#! /usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
# -*- ruby -*-
|
|
4
|
+
|
|
5
|
+
require "concurrent" # SPDX-License-Identifier: MIT
|
|
6
|
+
require "octokit" # SPDX-License-Identifier: MIT
|
|
7
|
+
require "tty-spinner" # SPDX-License-Identifier: MIT
|
|
8
|
+
require "tty-table" # SPDX-License-Identifier: MIT
|
|
9
|
+
require_relative "../lib/concourse-objects"
|
|
10
|
+
require_relative "../lib/concourse-objects/resources"
|
|
11
|
+
|
|
12
|
+
SPINNER_FORMAT = ENV.fetch("SPINNER_FORMAT") { :arrow_pulse }.to_sym
|
|
13
|
+
|
|
14
|
+
WhileSpinning = lambda do |message, report: nil, padding: 0, &block|
|
|
15
|
+
Concurrent::IVar.new.tap do |ivar|
|
|
16
|
+
TTY::Spinner.new("[:spinner] #{message}", format: SPINNER_FORMAT).tap do |spinner|
|
|
17
|
+
spinner.auto_spin
|
|
18
|
+
ivar.set block.call
|
|
19
|
+
padding = (' ' * [(padding - message.length), 0].max)
|
|
20
|
+
ivar.value ? (report ? spinner.success(padding + ivar.value.public_send(report).to_s) : spinner.success) : spinner.error
|
|
21
|
+
end
|
|
22
|
+
end.value
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
TTY::Table.new(header: ["name", "repository", "expected", "actual"]).yield_self do |results|
|
|
26
|
+
Octokit::Client.new(access_token: ENV["GITHUB_ACCESS_TOKEN"], auto_paginate: true).yield_self do |github|
|
|
27
|
+
ConcourseObjects::Resources.resources.sort_by { |resource| resource::GITHUB_REPOSITORY }.each do |resource|
|
|
28
|
+
WhileSpinning.("#{resource::RESOURCE_NAME} (#{resource::GITHUB_REPOSITORY})") do
|
|
29
|
+
github.latest_release(resource::GITHUB_REPOSITORY).name.yield_self do |version|
|
|
30
|
+
results << [resource::RESOURCE_NAME, resource::GITHUB_REPOSITORY, resource::GITHUB_VERSION, version]
|
|
31
|
+
|
|
32
|
+
resource::GITHUB_VERSION == version
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
STDOUT.puts results.render(:unicode, padding: [0, 1])
|
|
39
|
+
end
|
data/tools/test
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#! /usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
# -*- ruby -*-
|
|
4
|
+
|
|
5
|
+
require "pry" # SPDX-License-Identifier: MIT
|
|
6
|
+
require_relative "../lib/concourse-objects"
|
|
7
|
+
require_relative "../lib/concourse-objects/resources"
|
|
8
|
+
|
|
9
|
+
Files = lambda do |path|
|
|
10
|
+
Pathname(path).children.flat_map do |child|
|
|
11
|
+
child.directory? ? Files.(child) : child
|
|
12
|
+
end.select(&:file?).uniq
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
SortHash = lambda do |hash|
|
|
16
|
+
hash.sort.to_h.transform_values do |value|
|
|
17
|
+
case value
|
|
18
|
+
when Hash then SortHash.(value)
|
|
19
|
+
when Array then value.all? { |v| v.is_a?(Hash) } ? value.map(&SortHash) : value
|
|
20
|
+
else value
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
sampledir = Pathname("concourse-pipeline-samples").expand_path
|
|
26
|
+
|
|
27
|
+
samples = if sampledir.exist?
|
|
28
|
+
(Files
|
|
29
|
+
.(sampledir)
|
|
30
|
+
.select { |file| file.extname == ".yml" }
|
|
31
|
+
.reject { |file| file.to_s.match? /deprecated/ }
|
|
32
|
+
.reject { |file| file.basename.to_s.match? /params/ }
|
|
33
|
+
.map { |file| [file.relative_path_from(sampledir.dirname), YAML.load(file.read)] }
|
|
34
|
+
.to_h)
|
|
35
|
+
else
|
|
36
|
+
{}
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
reference_pipelines = samples.select do |_, content|
|
|
40
|
+
["jobs", "resources", "resource_types", "groups"].any? do |key|
|
|
41
|
+
content.keys.include?(key)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
reference_tasks = samples.select do |_, content|
|
|
46
|
+
["platform", "run"].any? do |key|
|
|
47
|
+
content.keys.include?(key)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
misc = [samples, reference_pipelines, reference_tasks].map(&:to_a).reduce(:-)
|
|
52
|
+
|
|
53
|
+
# reference_pipelines.map { |k, v| k.write(YAML.dump(SortHash.(v))) }
|
|
54
|
+
# reference_tasks.map { |k, v| k.write(YAML.dump(SortHash.(v))) }
|
|
55
|
+
|
|
56
|
+
reference_pipelines.each { |k, v| k.write(ConcourseObjects::Pipeline.(v).to_yaml) }
|
|
57
|
+
# reference_tasks.each { |k, v| k.write(ConcourseObjects::Task.(v).to_yaml) }
|
|
58
|
+
|
|
59
|
+
parsed_pipelines = reference_pipelines.map { |k, v| puts "Parsing #{k} ..."; [k, ConcourseObjects::Pipeline.(v)] }.to_h
|
|
60
|
+
parsed_tasks = reference_tasks.map { |k, v| puts "Parsing #{k} ..."; [k, ConcourseObjects::Task.(v)]}.to_h
|
|
61
|
+
|
|
62
|
+
bad_serialization = parsed_pipelines.select { |k, v| ConcourseObjects::Pipeline.(YAML.load(v.to_yaml)).to_h != v.to_h }
|
|
63
|
+
|
|
64
|
+
pipelines = parsed_pipelines.values.uniq
|
|
65
|
+
resource_types = pipelines.flat_map(&:resource_types).uniq
|
|
66
|
+
resources = pipelines.flat_map(&:resources).uniq
|
|
67
|
+
groups = pipelines.flat_map(&:groups).uniq
|
|
68
|
+
jobs = pipelines.flat_map(&:jobs).uniq
|
|
69
|
+
steps = jobs.flat_map(&:plan).uniq
|
|
70
|
+
tasks = parsed_tasks.values.uniq
|
|
71
|
+
|
|
72
|
+
binding.pry
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
|
2
|
+
MIIENDCCApygAwIBAgIBATANBgkqhkiG9w0BAQsFADAiMSAwHgYDVQQDDBdjaHJp
|
|
3
|
+
cy9EQz1vbHN0cm9tL0RDPWNvbTAeFw0xOTA2MTMyMTA1NDlaFw0yMDA2MTIyMTA1
|
|
4
|
+
NDlaMCIxIDAeBgNVBAMMF2NocmlzL0RDPW9sc3Ryb20vREM9Y29tMIIBojANBgkq
|
|
5
|
+
hkiG9w0BAQEFAAOCAY8AMIIBigKCAYEA9JtEKdevqT5+3QbLCIrEe2kY1s+GjPgq
|
|
6
|
+
pMQt+VR7BLjQx/keobztPGPkGM8AzPxvJ5s+8HIrCQW3npzmadj3TNn5MJS1Mfez
|
|
7
|
+
dW+HXih+J3App3CuhHWrEkPjjWnOJMdltzeHUTXGc5D49xG0/ijL6McOP8/1ktl5
|
|
8
|
+
FhUFeogfO/2/0aiy1qcVh+JI5onnP+VNoCf/yeLg+aKSpvQCawV1Nqzzt4oEzCKU
|
|
9
|
+
J4K6ffX4S3RzOkKUoyN2H9LsEywh8RE86GXz9yYvuQ7tewfrWWFmZcYJ76BamY85
|
|
10
|
+
AwflXiYsGFB1nSgQadSTokB6eQON5U//55eitKRsAgJVlcA/yPGfexRaK6J7qYWw
|
|
11
|
+
BGuwzuufZ52TZLtBNZ7rK41EyepYKFcY/1F/WMi0p6pPkWaPXbWH91NXB3aWBP1+
|
|
12
|
+
AiqmGZaD6oMEA0i4HxFEFEK1uE6O2jrYBQj8NpdbNSQJ1yHbOXSCuBxE53gWvnse
|
|
13
|
+
CynpUlFFBhN2yJ2JF7WYLe66UXRZUIzBAgMBAAGjdTBzMAkGA1UdEwQCMAAwCwYD
|
|
14
|
+
VR0PBAQDAgSwMB0GA1UdDgQWBBTPJTDqe4COk8NsE49DVF1aQn8snTAcBgNVHREE
|
|
15
|
+
FTATgRFjaHJpc0BvbHN0cm9tLmNvbTAcBgNVHRIEFTATgRFjaHJpc0BvbHN0cm9t
|
|
16
|
+
LmNvbTANBgkqhkiG9w0BAQsFAAOCAYEAZ4w6hakYWcVaAp17eFVqnsvriIBkoE61
|
|
17
|
+
iT98pu9MVxtB34SR95KbDaXpEg24Zih5nTQIwfA1hTpyKWnWa9xYgd+iv1d/szls
|
|
18
|
+
VMtQNKP+5BxQ0sampRf0lTzN6GN3XjJ4I1WtVpfOEG/yMuElJ4F1LgHgK+dMZE98
|
|
19
|
+
wHVYP7bFphDvYGYcQz/eRdVvNZ+kl+nexwV4nCTcDw0tiuZ+bQILbvCWeaDY6/Ld
|
|
20
|
+
67CMZBse7qmPgPaM9HDcQRABkWpo+BsVmUQ2PUSH1Ez6U8/enG532QGo1wMZWAWK
|
|
21
|
+
RfToz4kuoi5VNZk1mZsGNuAh7RVVFUFGkK4lY34FkD+gHqKBMY6wOjy2wIc5lnze
|
|
22
|
+
9BSM2/BfchYUZZFWWahMGFWJhIpKR7qGM4N0XtzDnUXKmhoV6EiM5QN76E7bCwbX
|
|
23
|
+
APmVyMIj8BOONTIc1ZAHLsGH0+fQFhCPG9W2o8uyakRimIHxDPHpr7HT3s5+vlIR
|
|
24
|
+
++pdkR83HVNOuHEO3yPK2bf7NGJpNbcM
|
|
25
|
+
-----END CERTIFICATE-----
|
data.tar.gz.sig
ADDED
|
Binary file
|
metadata
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: concourse-objects
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.15.2
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Chris Olstrom
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain:
|
|
11
|
+
- |
|
|
12
|
+
-----BEGIN CERTIFICATE-----
|
|
13
|
+
MIIENDCCApygAwIBAgIBATANBgkqhkiG9w0BAQsFADAiMSAwHgYDVQQDDBdjaHJp
|
|
14
|
+
cy9EQz1vbHN0cm9tL0RDPWNvbTAeFw0xOTA2MTMyMTA1NDlaFw0yMDA2MTIyMTA1
|
|
15
|
+
NDlaMCIxIDAeBgNVBAMMF2NocmlzL0RDPW9sc3Ryb20vREM9Y29tMIIBojANBgkq
|
|
16
|
+
hkiG9w0BAQEFAAOCAY8AMIIBigKCAYEA9JtEKdevqT5+3QbLCIrEe2kY1s+GjPgq
|
|
17
|
+
pMQt+VR7BLjQx/keobztPGPkGM8AzPxvJ5s+8HIrCQW3npzmadj3TNn5MJS1Mfez
|
|
18
|
+
dW+HXih+J3App3CuhHWrEkPjjWnOJMdltzeHUTXGc5D49xG0/ijL6McOP8/1ktl5
|
|
19
|
+
FhUFeogfO/2/0aiy1qcVh+JI5onnP+VNoCf/yeLg+aKSpvQCawV1Nqzzt4oEzCKU
|
|
20
|
+
J4K6ffX4S3RzOkKUoyN2H9LsEywh8RE86GXz9yYvuQ7tewfrWWFmZcYJ76BamY85
|
|
21
|
+
AwflXiYsGFB1nSgQadSTokB6eQON5U//55eitKRsAgJVlcA/yPGfexRaK6J7qYWw
|
|
22
|
+
BGuwzuufZ52TZLtBNZ7rK41EyepYKFcY/1F/WMi0p6pPkWaPXbWH91NXB3aWBP1+
|
|
23
|
+
AiqmGZaD6oMEA0i4HxFEFEK1uE6O2jrYBQj8NpdbNSQJ1yHbOXSCuBxE53gWvnse
|
|
24
|
+
CynpUlFFBhN2yJ2JF7WYLe66UXRZUIzBAgMBAAGjdTBzMAkGA1UdEwQCMAAwCwYD
|
|
25
|
+
VR0PBAQDAgSwMB0GA1UdDgQWBBTPJTDqe4COk8NsE49DVF1aQn8snTAcBgNVHREE
|
|
26
|
+
FTATgRFjaHJpc0BvbHN0cm9tLmNvbTAcBgNVHRIEFTATgRFjaHJpc0BvbHN0cm9t
|
|
27
|
+
LmNvbTANBgkqhkiG9w0BAQsFAAOCAYEAZ4w6hakYWcVaAp17eFVqnsvriIBkoE61
|
|
28
|
+
iT98pu9MVxtB34SR95KbDaXpEg24Zih5nTQIwfA1hTpyKWnWa9xYgd+iv1d/szls
|
|
29
|
+
VMtQNKP+5BxQ0sampRf0lTzN6GN3XjJ4I1WtVpfOEG/yMuElJ4F1LgHgK+dMZE98
|
|
30
|
+
wHVYP7bFphDvYGYcQz/eRdVvNZ+kl+nexwV4nCTcDw0tiuZ+bQILbvCWeaDY6/Ld
|
|
31
|
+
67CMZBse7qmPgPaM9HDcQRABkWpo+BsVmUQ2PUSH1Ez6U8/enG532QGo1wMZWAWK
|
|
32
|
+
RfToz4kuoi5VNZk1mZsGNuAh7RVVFUFGkK4lY34FkD+gHqKBMY6wOjy2wIc5lnze
|
|
33
|
+
9BSM2/BfchYUZZFWWahMGFWJhIpKR7qGM4N0XtzDnUXKmhoV6EiM5QN76E7bCwbX
|
|
34
|
+
APmVyMIj8BOONTIc1ZAHLsGH0+fQFhCPG9W2o8uyakRimIHxDPHpr7HT3s5+vlIR
|
|
35
|
+
++pdkR83HVNOuHEO3yPK2bf7NGJpNbcM
|
|
36
|
+
-----END CERTIFICATE-----
|
|
37
|
+
date: 2019-08-19 00:00:00.000000000 Z
|
|
38
|
+
dependencies: []
|
|
39
|
+
description:
|
|
40
|
+
email: chris@olstrom.com
|
|
41
|
+
executables: []
|
|
42
|
+
extensions: []
|
|
43
|
+
extra_rdoc_files: []
|
|
44
|
+
files:
|
|
45
|
+
- ".gitignore"
|
|
46
|
+
- Gemfile
|
|
47
|
+
- LICENSE.txt
|
|
48
|
+
- README.org
|
|
49
|
+
- concourse-objects.gemspec
|
|
50
|
+
- lib/concourse-objects.rb
|
|
51
|
+
- lib/concourse-objects/resources.rb
|
|
52
|
+
- lib/concourse-objects/resources/bosh-io-release.rb
|
|
53
|
+
- lib/concourse-objects/resources/bosh-io-stemcell.rb
|
|
54
|
+
- lib/concourse-objects/resources/cf.rb
|
|
55
|
+
- lib/concourse-objects/resources/docker-image.rb
|
|
56
|
+
- lib/concourse-objects/resources/git.rb
|
|
57
|
+
- lib/concourse-objects/resources/github-release.rb
|
|
58
|
+
- lib/concourse-objects/resources/hg.rb
|
|
59
|
+
- lib/concourse-objects/resources/pool.rb
|
|
60
|
+
- lib/concourse-objects/resources/registry-image.rb
|
|
61
|
+
- lib/concourse-objects/resources/s3.rb
|
|
62
|
+
- lib/concourse-objects/resources/semver.rb
|
|
63
|
+
- lib/concourse-objects/resources/time.rb
|
|
64
|
+
- tools/check-resources
|
|
65
|
+
- tools/test
|
|
66
|
+
- trust/certificates/colstrom.pem
|
|
67
|
+
homepage: https://github.com/colstrom/concourse-objects
|
|
68
|
+
licenses:
|
|
69
|
+
- MIT
|
|
70
|
+
metadata: {}
|
|
71
|
+
post_install_message:
|
|
72
|
+
rdoc_options: []
|
|
73
|
+
require_paths:
|
|
74
|
+
- lib
|
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
76
|
+
requirements:
|
|
77
|
+
- - ">="
|
|
78
|
+
- !ruby/object:Gem::Version
|
|
79
|
+
version: '0'
|
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
|
+
requirements:
|
|
82
|
+
- - ">="
|
|
83
|
+
- !ruby/object:Gem::Version
|
|
84
|
+
version: '0'
|
|
85
|
+
requirements: []
|
|
86
|
+
rubygems_version: 3.0.4
|
|
87
|
+
signing_key:
|
|
88
|
+
specification_version: 4
|
|
89
|
+
summary: Objects for Concourse
|
|
90
|
+
test_files: []
|
metadata.gz.sig
ADDED
|
Binary file
|