Class: DaggerRuby::Container
Instance Attribute Summary
Attributes inherited from DaggerObject
#client, #query_builder
Class Method Summary
collapse
Instance Method Summary
collapse
-
#as_service(opts = {}) ⇒ Object
-
#as_tarball(opts = {}) ⇒ Object
-
#build(context, opts = {}) ⇒ Object
-
#directory(path, opts = {}) ⇒ Object
-
#entrypoint ⇒ Object
-
#env_variable(name) ⇒ Object
-
#env_variables ⇒ Object
-
#exit_code ⇒ Object
-
#export(path, opts = {}) ⇒ Object
-
#export_to_file(path, opts = {}) ⇒ Object
-
#exposed_ports ⇒ Object
-
#file(path, opts = {}) ⇒ Object
-
#from(address) ⇒ Object
-
#image_ref ⇒ Object
-
#import(source, opts = {}) ⇒ Object
-
#label(name) ⇒ Object
-
#labels ⇒ Object
-
#mounts ⇒ Object
-
#platform ⇒ Object
-
#publish(address, opts = {}) ⇒ Object
-
#stderr ⇒ Object
-
#stdout ⇒ Object
-
#sync ⇒ Object
-
#terminal(opts = {}) ⇒ Object
-
#user ⇒ Object
-
#with_directory(path, directory, opts = {}) ⇒ Object
-
#with_entrypoint(args, opts = {}) ⇒ Object
-
#with_env_variable(name, value, opts = {}) ⇒ Object
-
#with_exec(args, opts = {}) ⇒ Object
-
#with_exposed_port(port, opts = {}) ⇒ Object
-
#with_file(path, source, opts = {}) ⇒ Object
-
#with_label(name, value) ⇒ Object
-
#with_mounted_cache(path, cache, opts = {}) ⇒ Object
-
#with_mounted_directory(path, source, opts = {}) ⇒ Object
-
#with_mounted_file(path, source, opts = {}) ⇒ Object
-
#with_mounted_secret(path, source, opts = {}) ⇒ Object
-
#with_new_file(path, contents, opts = {}) ⇒ Object
-
#with_registry_auth(_address, _username, _secret) ⇒ Object
-
#with_secret_env(name, secret) ⇒ Object
-
#with_secret_variable(name, secret) ⇒ Object
-
#with_service_binding(alias_name, service) ⇒ Object
-
#with_user(name) ⇒ Object
-
#with_workdir(path) ⇒ Object
-
#without_directory(path) ⇒ Object
-
#without_env_variable(name) ⇒ Object
-
#without_exposed_port(port, opts = {}) ⇒ Object
-
#without_file(path) ⇒ Object
-
#without_registry_auth(address) ⇒ Object
-
#workdir ⇒ Object
#chain_operation, #id, #initialize
Class Method Details
.from_id(id, client) ⇒ Object
7
8
9
10
11
|
# File 'lib/dagger_ruby/container.rb', line 7
def self.from_id(id, client)
query = QueryBuilder.new("container")
query.load_from_id(id)
new(query, client)
end
|
.root_field_name ⇒ Object
13
14
15
|
# File 'lib/dagger_ruby/container.rb', line 13
def self.root_field_name
"container"
end
|
Instance Method Details
#as_service(opts = {}) ⇒ Object
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
# File 'lib/dagger_ruby/container.rb', line 126
def as_service(opts = {})
args = {}
args["args"] = opts[:args] if opts[:args]
args["useEntrypoint"] = opts[:use_entrypoint] if opts.key?(:use_entrypoint)
if opts.key?(:experimental_privileged_nesting)
args["experimentalPrivilegedNesting"] =
opts[:experimental_privileged_nesting]
end
args["insecureRootCapabilities"] = opts[:insecure_root_capabilities] if opts.key?(:insecure_root_capabilities)
args["expand"] = opts[:expand] if opts.key?(:expand)
args["noInit"] = opts[:no_init] if opts.key?(:no_init)
require_relative "service" unless defined?(Service)
get_object("asService", Service, args)
end
|
#as_tarball(opts = {}) ⇒ Object
347
348
349
350
351
352
353
354
355
356
|
# File 'lib/dagger_ruby/container.rb', line 347
def as_tarball(opts = {})
args = {}
args["platformVariants"] = opts[:platform_variants] if opts[:platform_variants]
args["forcedCompression"] = opts[:forced_compression] if opts[:forced_compression]
args["mediaTypes"] = opts[:media_types] if opts[:media_types]
query = @query_builder.build_query_with_selection("asTarball(#{format_arguments(args)})")
result = @client.execute(query)
(result, "asTarball")
end
|
#build(context, opts = {}) ⇒ Object
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
# File 'lib/dagger_ruby/container.rb', line 142
def build(context, opts = {})
args = { "context" => context.is_a?(DaggerObject) ? context.id : context }
args["dockerfile"] = opts[:dockerfile] if opts[:dockerfile]
args["target"] = opts[:target] if opts[:target]
args["buildArgs"] = opts[:build_args] if opts[:build_args]
if opts[:secrets]
raise NotImplementedError, "Build secrets are not yet supported. Use with_mounted_secret instead."
end
args["noInit"] = opts[:no_init] if opts.key?(:no_init)
chain_operation("build", args)
end
|
#directory(path, opts = {}) ⇒ Object
240
241
242
243
244
|
# File 'lib/dagger_ruby/container.rb', line 240
def directory(path, opts = {})
args = { "path" => path }
args["expand"] = opts[:expand] if opts.key?(:expand)
get_object("directory", Directory, args)
end
|
#entrypoint ⇒ Object
272
273
274
|
# File 'lib/dagger_ruby/container.rb', line 272
def entrypoint
get_scalar("entrypoint")
end
|
#env_variable(name) ⇒ Object
280
281
282
283
284
|
# File 'lib/dagger_ruby/container.rb', line 280
def env_variable(name)
query = @query_builder.build_query_with_selection("envVariable(name: \"#{name}\")")
result = @client.execute(query)
(result, "envVariable")
end
|
#env_variables ⇒ Object
276
277
278
|
# File 'lib/dagger_ruby/container.rb', line 276
def env_variables
get_scalar("envVariables")
end
|
#exit_code ⇒ Object
260
261
262
|
# File 'lib/dagger_ruby/container.rb', line 260
def exit_code
get_scalar("exitCode")
end
|
#export(path, opts = {}) ⇒ Object
312
313
314
315
316
317
318
319
320
321
322
|
# File 'lib/dagger_ruby/container.rb', line 312
def export(path, opts = {})
args = { "path" => path }
args["platformVariants"] = opts[:platform_variants] if opts[:platform_variants]
args["forcedCompression"] = opts[:forced_compression] if opts[:forced_compression]
args["mediaTypes"] = opts[:media_types] if opts[:media_types]
args["expand"] = opts[:expand] if opts.key?(:expand)
query = @query_builder.build_query_with_selection("export(#{format_arguments(args)})")
result = @client.execute(query)
(result, "export")
end
|
#export_to_file(path, opts = {}) ⇒ Object
324
325
326
327
328
329
330
331
332
333
334
|
# File 'lib/dagger_ruby/container.rb', line 324
def export_to_file(path, opts = {})
args = { "path" => path }
args["platformVariants"] = opts[:platform_variants] if opts[:platform_variants]
args["forcedCompression"] = opts[:forced_compression] if opts[:forced_compression]
args["mediaTypes"] = opts[:media_types] if opts[:media_types]
args["expand"] = opts[:expand] if opts.key?(:expand)
query = @query_builder.build_query_with_selection("exportToFile(#{format_arguments(args)})")
result = @client.execute(query)
(result, "exportToFile")
end
|
#exposed_ports ⇒ Object
300
301
302
|
# File 'lib/dagger_ruby/container.rb', line 300
def exposed_ports
get_scalar("exposedPorts")
end
|
#file(path, opts = {}) ⇒ Object
246
247
248
249
250
|
# File 'lib/dagger_ruby/container.rb', line 246
def file(path, opts = {})
args = { "path" => path }
args["expand"] = opts[:expand] if opts.key?(:expand)
get_object("file", File, args)
end
|
#from(address) ⇒ Object
17
18
19
|
# File 'lib/dagger_ruby/container.rb', line 17
def from(address)
chain_operation("from", { "address" => address })
end
|
#image_ref ⇒ Object
308
309
310
|
# File 'lib/dagger_ruby/container.rb', line 308
def image_ref
get_scalar("imageRef")
end
|
#import(source, opts = {}) ⇒ Object
157
158
159
160
161
162
|
# File 'lib/dagger_ruby/container.rb', line 157
def import(source, opts = {})
args = { "source" => source.is_a?(DaggerObject) ? source.id : source }
args["tag"] = opts[:tag] if opts[:tag]
chain_operation("import", args)
end
|
#label(name) ⇒ Object
290
291
292
293
294
|
# File 'lib/dagger_ruby/container.rb', line 290
def label(name)
query = @query_builder.build_query_with_selection("label(name: \"#{name}\")")
result = @client.execute(query)
(result, "label")
end
|
#labels ⇒ Object
286
287
288
|
# File 'lib/dagger_ruby/container.rb', line 286
def labels
get_scalar("labels")
end
|
#mounts ⇒ Object
296
297
298
|
# File 'lib/dagger_ruby/container.rb', line 296
def mounts
get_scalar("mounts")
end
|
304
305
306
|
# File 'lib/dagger_ruby/container.rb', line 304
def platform
get_scalar("platform")
end
|
#publish(address, opts = {}) ⇒ Object
336
337
338
339
340
341
342
343
344
345
|
# File 'lib/dagger_ruby/container.rb', line 336
def publish(address, opts = {})
args = { "address" => address }
args["platformVariants"] = opts[:platform_variants] if opts[:platform_variants]
args["forcedCompression"] = opts[:forced_compression] if opts[:forced_compression]
args["mediaTypes"] = opts[:media_types] if opts[:media_types]
query = @query_builder.build_query_with_selection("publish(#{format_arguments(args)})")
result = @client.execute(query)
(result, "publish")
end
|
#stderr ⇒ Object
256
257
258
|
# File 'lib/dagger_ruby/container.rb', line 256
def stderr
get_scalar("stderr")
end
|
#stdout ⇒ Object
252
253
254
|
# File 'lib/dagger_ruby/container.rb', line 252
def stdout
get_scalar("stdout")
end
|
#sync ⇒ Object
358
359
360
361
|
# File 'lib/dagger_ruby/container.rb', line 358
def sync
get_scalar("id") self
end
|
#terminal(opts = {}) ⇒ Object
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
# File 'lib/dagger_ruby/container.rb', line 164
def terminal(opts = {})
args = {}
args["cmd"] = opts[:cmd] if opts[:cmd]
if opts.key?(:experimental_privileged_nesting)
args["experimentalPrivilegedNesting"] =
opts[:experimental_privileged_nesting]
end
args["insecureRootCapabilities"] = opts[:insecure_root_capabilities] if opts.key?(:insecure_root_capabilities)
if args.empty?
chain_operation("terminal")
else
chain_operation("terminal", args)
end
end
|
#user ⇒ Object
268
269
270
|
# File 'lib/dagger_ruby/container.rb', line 268
def user
get_scalar("user")
end
|
#with_directory(path, directory, opts = {}) ⇒ Object
21
22
23
24
25
26
27
28
29
|
# File 'lib/dagger_ruby/container.rb', line 21
def with_directory(path, directory, opts = {})
args = { "path" => path, "source" => directory.is_a?(DaggerObject) ? directory.id : directory }
args["exclude"] = opts[:exclude] if opts[:exclude]
args["include"] = opts[:include] if opts[:include]
args["owner"] = opts[:owner] if opts[:owner]
args["expand"] = opts[:expand] if opts.key?(:expand)
chain_operation("withDirectory", args)
end
|
#with_entrypoint(args, opts = {}) ⇒ Object
99
100
101
102
103
|
# File 'lib/dagger_ruby/container.rb', line 99
def with_entrypoint(args, opts = {})
entrypoint_args = { "args" => args }
entrypoint_args["keepDefaultArgs"] = opts[:keep_default_args] if opts.key?(:keep_default_args)
chain_operation("withEntrypoint", entrypoint_args)
end
|
#with_env_variable(name, value, opts = {}) ⇒ Object
64
65
66
67
68
69
|
# File 'lib/dagger_ruby/container.rb', line 64
def with_env_variable(name, value, opts = {})
args = { "name" => name, "value" => value }
args["expand"] = opts[:expand] if opts.key?(:expand)
chain_operation("withEnvVariable", args)
end
|
#with_exec(args, opts = {}) ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/dagger_ruby/container.rb', line 35
def with_exec(args, opts = {})
exec_args = { "args" => args }
exec_args["useEntrypoint"] = opts[:use_entrypoint] if opts.key?(:use_entrypoint)
exec_args["stdin"] = opts[:stdin] if opts[:stdin]
exec_args["redirectStdout"] = opts[:redirect_stdout] if opts[:redirect_stdout]
exec_args["redirectStderr"] = opts[:redirect_stderr] if opts[:redirect_stderr]
exec_args["expect"] = opts[:expect] if opts[:expect]
if opts.key?(:experimental_privileged_nesting)
exec_args["experimentalPrivilegedNesting"] = opts[:experimental_privileged_nesting]
end
if opts.key?(:insecure_root_capabilities)
exec_args["insecureRootCapabilities"] = opts[:insecure_root_capabilities]
end
exec_args["expand"] = opts[:expand] if opts.key?(:expand)
exec_args["noInit"] = opts[:no_init] if opts.key?(:no_init)
chain_operation("withExec", exec_args)
end
|
#with_exposed_port(port, opts = {}) ⇒ Object
180
181
182
183
184
185
186
187
188
189
|
# File 'lib/dagger_ruby/container.rb', line 180
def with_exposed_port(port, opts = {})
args = { "port" => port }
args["protocol"] = opts[:protocol] if opts[:protocol]
args["description"] = opts[:description] if opts[:description]
if opts.key?(:experimental_skip_healthcheck)
args["experimentalSkipHealthcheck"] = opts[:experimental_skip_healthcheck]
end
chain_operation("withExposedPort", args)
end
|
#with_file(path, source, opts = {}) ⇒ Object
71
72
73
74
75
76
77
78
|
# File 'lib/dagger_ruby/container.rb', line 71
def with_file(path, source, opts = {})
args = { "path" => path, "source" => source.is_a?(DaggerObject) ? source.id : source }
args["permissions"] = opts[:permissions] if opts[:permissions]
args["owner"] = opts[:owner] if opts[:owner]
args["expand"] = opts[:expand] if opts.key?(:expand)
chain_operation("withFile", args)
end
|
#with_label(name, value) ⇒ Object
191
192
193
194
|
# File 'lib/dagger_ruby/container.rb', line 191
def with_label(name, value)
args = { "name" => name, "value" => value }
chain_operation("withLabel", args)
end
|
#with_mounted_cache(path, cache, opts = {}) ⇒ Object
54
55
56
57
58
59
60
61
62
|
# File 'lib/dagger_ruby/container.rb', line 54
def with_mounted_cache(path, cache, opts = {})
args = { "path" => path, "cache" => cache.is_a?(DaggerObject) ? cache.id : cache }
args["source"] = opts[:source] if opts[:source]
args["sharing"] = opts[:sharing] if opts[:sharing]
args["owner"] = opts[:owner] if opts[:owner]
args["expand"] = opts[:expand] if opts.key?(:expand)
chain_operation("withMountedCache", args)
end
|
#with_mounted_directory(path, source, opts = {}) ⇒ Object
196
197
198
199
200
201
202
|
# File 'lib/dagger_ruby/container.rb', line 196
def with_mounted_directory(path, source, opts = {})
args = { "path" => path, "source" => source.is_a?(DaggerObject) ? source.id : source }
args["owner"] = opts[:owner] if opts[:owner]
args["expand"] = opts[:expand] if opts.key?(:expand)
chain_operation("withMountedDirectory", args)
end
|
#with_mounted_file(path, source, opts = {}) ⇒ Object
204
205
206
207
208
209
210
|
# File 'lib/dagger_ruby/container.rb', line 204
def with_mounted_file(path, source, opts = {})
args = { "path" => path, "source" => source.is_a?(DaggerObject) ? source.id : source }
args["owner"] = opts[:owner] if opts[:owner]
args["expand"] = opts[:expand] if opts.key?(:expand)
chain_operation("withMountedFile", args)
end
|
#with_mounted_secret(path, source, opts = {}) ⇒ Object
212
213
214
215
216
217
218
219
|
# File 'lib/dagger_ruby/container.rb', line 212
def with_mounted_secret(path, source, opts = {})
args = { "path" => path, "source" => source.is_a?(DaggerObject) ? source.id : source }
args["owner"] = opts[:owner] if opts[:owner]
args["mode"] = opts[:mode] if opts[:mode]
args["expand"] = opts[:expand] if opts.key?(:expand)
chain_operation("withMountedSecret", args)
end
|
#with_new_file(path, contents, opts = {}) ⇒ Object
80
81
82
83
84
85
86
87
|
# File 'lib/dagger_ruby/container.rb', line 80
def with_new_file(path, contents, opts = {})
args = { "path" => path, "contents" => contents }
args["permissions"] = opts[:permissions] if opts[:permissions]
args["owner"] = opts[:owner] if opts[:owner]
args["expand"] = opts[:expand] if opts.key?(:expand)
chain_operation("withNewFile", args)
end
|
#with_registry_auth(_address, _username, _secret) ⇒ Object
109
110
111
112
|
# File 'lib/dagger_ruby/container.rb', line 109
def with_registry_auth(_address, _username, _secret)
puts "⚠️ Registry auth temporarily disabled due to GraphQL formatting issues"
self
end
|
#with_secret_env(name, secret) ⇒ Object
94
95
96
97
|
# File 'lib/dagger_ruby/container.rb', line 94
def with_secret_env(name, secret)
args = { "name" => name, "secret" => secret.is_a?(DaggerObject) ? secret.id : secret }
chain_operation("withSecretEnv", args)
end
|
#with_secret_variable(name, secret) ⇒ Object
89
90
91
92
|
# File 'lib/dagger_ruby/container.rb', line 89
def with_secret_variable(name, secret)
args = { "name" => name, "secret" => secret.is_a?(DaggerObject) ? secret.id : secret }
chain_operation("withSecretVariable", args)
end
|
#with_service_binding(alias_name, service) ⇒ Object
118
119
120
121
122
123
124
|
# File 'lib/dagger_ruby/container.rb', line 118
def with_service_binding(alias_name, service)
args = {
"alias" => alias_name,
"service" => service.is_a?(DaggerObject) ? service.id : service,
}
chain_operation("withServiceBinding", args)
end
|
#with_user(name) ⇒ Object
105
106
107
|
# File 'lib/dagger_ruby/container.rb', line 105
def with_user(name)
chain_operation("withUser", { "name" => name })
end
|
#with_workdir(path) ⇒ Object
31
32
33
|
# File 'lib/dagger_ruby/container.rb', line 31
def with_workdir(path)
chain_operation("withWorkdir", { "path" => path })
end
|
#without_directory(path) ⇒ Object
221
222
223
|
# File 'lib/dagger_ruby/container.rb', line 221
def without_directory(path)
chain_operation("withoutDirectory", { "path" => path })
end
|
#without_env_variable(name) ⇒ Object
229
230
231
|
# File 'lib/dagger_ruby/container.rb', line 229
def without_env_variable(name)
chain_operation("withoutEnvVariable", { "name" => name })
end
|
#without_exposed_port(port, opts = {}) ⇒ Object
233
234
235
236
237
238
|
# File 'lib/dagger_ruby/container.rb', line 233
def without_exposed_port(port, opts = {})
args = { "port" => port }
args["protocol"] = opts[:protocol] if opts[:protocol]
chain_operation("withoutExposedPort", args)
end
|
#without_file(path) ⇒ Object
225
226
227
|
# File 'lib/dagger_ruby/container.rb', line 225
def without_file(path)
chain_operation("withoutFile", { "path" => path })
end
|
#without_registry_auth(address) ⇒ Object
114
115
116
|
# File 'lib/dagger_ruby/container.rb', line 114
def without_registry_auth(address)
chain_operation("withoutRegistryAuth", { "address" => address })
end
|
#workdir ⇒ Object
264
265
266
|
# File 'lib/dagger_ruby/container.rb', line 264
def workdir
get_scalar("workdir")
end
|