dagger_ruby 0.9.0 → 0.10.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 +15 -1
- data/README.md +10 -2
- data/dagger_ruby.gemspec +1 -1
- data/lib/dagger_ruby/config.rb +38 -1
- data/lib/dagger_ruby/container.rb +41 -0
- data/lib/dagger_ruby/errors.rb +1 -0
- data/lib/dagger_ruby/version.rb +1 -1
- data/lib/dagger_ruby.rb +31 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4a4bcab9db019b25e782aab84ab1e3b154bda15f64cb7d1ffdd522d14cbfb729
|
|
4
|
+
data.tar.gz: 41e902336fe58545784c21e85a17cc55961a9aab6ad2c6370547ffb4d4779eb5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 897cdcb244f34e704a70f2bb47fdeadeb946c2c29e0fff763cf0b487122657a11d2bee3d664593c0b268baf45eba0cbf9b8da1e889eb601e1f4ad6ed7056e1b2
|
|
7
|
+
data.tar.gz: c52a3cfff5a10a1ef6c8bc1e522c56bf423642dbfbc57bcc76c03e84a61e31e8f346a8157bffb53e112d2a77cdfd044b6d4c562784f9afa785f0460d02f98864
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,19 @@ All notable changes are recorded here. The format follows
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.10.0] - 2026-08-25
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Explicit Apple Container and Docker runner selection.
|
|
14
|
+
- Compatible Dagger CLI and engine verification before standalone sessions.
|
|
15
|
+
- Container default-argument, Docker healthcheck, and host image-store export APIs.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Support Ruby 3.2 and newer so Ruby applications do not need Ruby 4 solely to
|
|
20
|
+
use the Dagger client.
|
|
21
|
+
|
|
9
22
|
## [0.9.0] - 2026-08-20
|
|
10
23
|
|
|
11
24
|
### Added
|
|
@@ -64,7 +77,8 @@ All notable changes are recorded here. The format follows
|
|
|
64
77
|
|
|
65
78
|
- Initial container, directory, file, cache, secret, Git, and GraphQL client.
|
|
66
79
|
|
|
67
|
-
[Unreleased]: https://github.com/boringcache/dagger_ruby/compare/v0.
|
|
80
|
+
[Unreleased]: https://github.com/boringcache/dagger_ruby/compare/v0.10.0...HEAD
|
|
81
|
+
[0.10.0]: https://github.com/boringcache/dagger_ruby/compare/v0.9.0...v0.10.0
|
|
68
82
|
[0.9.0]: https://github.com/boringcache/dagger_ruby/compare/v0.8.0...v0.9.0
|
|
69
83
|
[0.8.0]: https://github.com/boringcache/dagger_ruby/releases/tag/v0.8.0
|
|
70
84
|
[0.6.0]: https://github.com/boringcache/dagger_ruby/releases/tag/v0.6.0
|
data/README.md
CHANGED
|
@@ -12,7 +12,7 @@ covers a practical subset of the API instead of Dagger module code generation.
|
|
|
12
12
|
|
|
13
13
|
## Requirements
|
|
14
14
|
|
|
15
|
-
- Ruby
|
|
15
|
+
- Ruby 3.2 or newer
|
|
16
16
|
- Dagger 0.21.8
|
|
17
17
|
- Docker, Colima, or another container runtime supported by Dagger
|
|
18
18
|
|
|
@@ -133,6 +133,7 @@ config = DaggerRuby::Config.new(
|
|
|
133
133
|
timeout: 300,
|
|
134
134
|
progress: "plain",
|
|
135
135
|
log_output: $stderr,
|
|
136
|
+
runtime: :apple,
|
|
136
137
|
)
|
|
137
138
|
|
|
138
139
|
DaggerRuby.connection(config) do |client|
|
|
@@ -143,6 +144,13 @@ end
|
|
|
143
144
|
`DAGGER_QUIET`, `DAGGER_SILENT`, and `DAGGER_PROGRESS` can provide the same CLI
|
|
144
145
|
preferences through the environment.
|
|
145
146
|
|
|
147
|
+
The client verifies the installed Dagger CLI before it starts a runner and then
|
|
148
|
+
verifies the connected engine version. This matters for runtime drivers because
|
|
149
|
+
the compatible CLI provisions the runner; merely pointing an older CLI at a
|
|
150
|
+
newer engine image is not sufficient. Use `runtime: :apple` or `runtime: :docker`
|
|
151
|
+
when more than one runtime is installed and automatic detection would be
|
|
152
|
+
ambiguous. A custom runner can be selected with `runner_host:`.
|
|
153
|
+
|
|
146
154
|
## Errors
|
|
147
155
|
|
|
148
156
|
Connection, transport, GraphQL, and invalid-query failures use dedicated error
|
|
@@ -158,7 +166,7 @@ end
|
|
|
158
166
|
|
|
159
167
|
## Compatibility
|
|
160
168
|
|
|
161
|
-
The current branch is tested against Ruby
|
|
169
|
+
The current branch is tested against maintained Ruby releases and Dagger 0.21.8. Dagger's
|
|
162
170
|
GraphQL schema can change between releases, so each supported engine update is
|
|
163
171
|
validated by the live integration suite before release. Earlier Ruby and Dagger
|
|
164
172
|
versions are not covered by the current compatibility contract.
|
data/dagger_ruby.gemspec
CHANGED
|
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
|
|
|
13
13
|
"services, caches, secrets, and filesystem operations with the Dagger engine."
|
|
14
14
|
spec.homepage = "https://github.com/boringcache/dagger_ruby"
|
|
15
15
|
spec.license = "MIT"
|
|
16
|
-
spec.required_ruby_version = ">=
|
|
16
|
+
spec.required_ruby_version = ">= 3.2.0"
|
|
17
17
|
|
|
18
18
|
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
19
19
|
|
data/lib/dagger_ruby/config.rb
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
require "logger"
|
|
2
|
+
require_relative "version"
|
|
2
3
|
|
|
3
4
|
module DaggerRuby
|
|
4
5
|
class Config
|
|
5
|
-
|
|
6
|
+
ENGINE_IMAGE = "registry.dagger.io/engine".freeze
|
|
7
|
+
RUNTIMES = %i[auto apple docker].freeze
|
|
8
|
+
|
|
9
|
+
attr_reader :log_output, :workdir, :timeout, :quiet, :silent, :progress,
|
|
10
|
+
:runtime, :runner_host, :dagger_version, :verify_version
|
|
6
11
|
|
|
7
12
|
def initialize(options = {})
|
|
8
13
|
@log_output = options[:log_output]
|
|
@@ -11,6 +16,38 @@ module DaggerRuby
|
|
|
11
16
|
@quiet = options[:quiet] || ENV["DAGGER_QUIET"]&.to_i
|
|
12
17
|
@silent = options[:silent] || ENV["DAGGER_SILENT"] == "true"
|
|
13
18
|
@progress = options[:progress] || ENV.fetch("DAGGER_PROGRESS", nil)
|
|
19
|
+
@runtime = normalize_runtime(options.fetch(:runtime, ENV.fetch("DAGGER_RUBY_RUNTIME", "auto")))
|
|
20
|
+
@runner_host = options[:runner_host]
|
|
21
|
+
@dagger_version = options.fetch(:dagger_version, DAGGER_VERSION).to_s.delete_prefix("v")
|
|
22
|
+
@verify_version = options.fetch(:verify_version, true)
|
|
23
|
+
|
|
24
|
+
raise ArgumentError, "runner_host and runtime cannot both be configured" if @runner_host && @runtime != :auto
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def environment
|
|
28
|
+
environment = {}
|
|
29
|
+
environment["_EXPERIMENTAL_DAGGER_RUNNER_HOST"] = resolved_runner_host if resolved_runner_host
|
|
30
|
+
environment
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def expected_engine_version
|
|
34
|
+
"v#{dagger_version}"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
private
|
|
38
|
+
|
|
39
|
+
def normalize_runtime(value)
|
|
40
|
+
runtime = value.to_s.downcase.to_sym
|
|
41
|
+
return runtime if RUNTIMES.include?(runtime)
|
|
42
|
+
|
|
43
|
+
raise ArgumentError, "Unknown Dagger runtime '#{value}'. Use auto, apple, or docker."
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def resolved_runner_host
|
|
47
|
+
return runner_host if runner_host
|
|
48
|
+
return if runtime == :auto
|
|
49
|
+
|
|
50
|
+
"image+#{runtime}://#{ENGINE_IMAGE}:#{expected_engine_version}"
|
|
14
51
|
end
|
|
15
52
|
end
|
|
16
53
|
end
|
|
@@ -98,6 +98,26 @@ module DaggerRuby
|
|
|
98
98
|
chain_operation("withEntrypoint", entrypoint_args)
|
|
99
99
|
end
|
|
100
100
|
|
|
101
|
+
def with_default_args(args)
|
|
102
|
+
chain_operation("withDefaultArgs", { "args" => args })
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def with_docker_healthcheck(args, opts = {})
|
|
106
|
+
healthcheck_args = { "args" => args }
|
|
107
|
+
healthcheck_args["shell"] = opts[:shell] if opts.key?(:shell)
|
|
108
|
+
healthcheck_args["interval"] = opts[:interval] if opts[:interval]
|
|
109
|
+
healthcheck_args["timeout"] = opts[:timeout] if opts[:timeout]
|
|
110
|
+
healthcheck_args["startPeriod"] = opts[:start_period] if opts[:start_period]
|
|
111
|
+
healthcheck_args["startInterval"] = opts[:start_interval] if opts[:start_interval]
|
|
112
|
+
healthcheck_args["retries"] = opts[:retries] if opts[:retries]
|
|
113
|
+
|
|
114
|
+
chain_operation("withDockerHealthcheck", healthcheck_args)
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def without_docker_healthcheck
|
|
118
|
+
chain_operation("withoutDockerHealthcheck")
|
|
119
|
+
end
|
|
120
|
+
|
|
101
121
|
def with_user(name)
|
|
102
122
|
chain_operation("withUser", { "name" => name })
|
|
103
123
|
end
|
|
@@ -259,6 +279,17 @@ module DaggerRuby
|
|
|
259
279
|
get_scalar("entrypoint")
|
|
260
280
|
end
|
|
261
281
|
|
|
282
|
+
def default_args
|
|
283
|
+
get_scalar("defaultArgs")
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
def docker_healthcheck
|
|
287
|
+
get_selection(
|
|
288
|
+
"dockerHealthcheck",
|
|
289
|
+
"args shell interval timeout startPeriod startInterval retries",
|
|
290
|
+
)
|
|
291
|
+
end
|
|
292
|
+
|
|
262
293
|
def env_variables
|
|
263
294
|
get_selection("envVariables", "name value")
|
|
264
295
|
end
|
|
@@ -305,6 +336,16 @@ module DaggerRuby
|
|
|
305
336
|
export(path, opts)
|
|
306
337
|
end
|
|
307
338
|
|
|
339
|
+
def export_image(name, opts = {})
|
|
340
|
+
args = { "name" => name }
|
|
341
|
+
args["platformVariants"] = graphql_ids(opts[:platform_variants]) if opts[:platform_variants]
|
|
342
|
+
args["forcedCompression"] = QueryBuilder.enum_value(opts[:forced_compression]) if opts[:forced_compression]
|
|
343
|
+
args["mediaTypes"] = QueryBuilder.enum_value(opts[:media_types]) if opts[:media_types]
|
|
344
|
+
|
|
345
|
+
get_scalar("exportImage", args)
|
|
346
|
+
name
|
|
347
|
+
end
|
|
348
|
+
|
|
308
349
|
def publish(address, opts = {})
|
|
309
350
|
args = { "address" => address }
|
|
310
351
|
args["platformVariants"] = graphql_ids(opts[:platform_variants]) if opts[:platform_variants]
|
data/lib/dagger_ruby/errors.rb
CHANGED
data/lib/dagger_ruby/version.rb
CHANGED
data/lib/dagger_ruby.rb
CHANGED
|
@@ -4,13 +4,16 @@ require_relative "dagger_ruby/version"
|
|
|
4
4
|
require_relative "dagger_ruby/client"
|
|
5
5
|
require_relative "dagger_ruby/config"
|
|
6
6
|
require_relative "dagger_ruby/errors"
|
|
7
|
+
require "open3"
|
|
7
8
|
|
|
8
9
|
module DaggerRuby
|
|
9
10
|
class << self
|
|
10
11
|
def connection(config = nil, &)
|
|
12
|
+
config ||= Config.new
|
|
11
13
|
return connection_in_current_session(config, &) if dagger_session?
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
verify_cli_version!(config) if config.verify_version
|
|
16
|
+
exec(config.environment, *dagger_run_command(config))
|
|
14
17
|
end
|
|
15
18
|
|
|
16
19
|
private
|
|
@@ -21,6 +24,12 @@ module DaggerRuby
|
|
|
21
24
|
|
|
22
25
|
def connection_in_current_session(config)
|
|
23
26
|
client = Client.new(config: config)
|
|
27
|
+
begin
|
|
28
|
+
verify_engine_version!(client, config) if config.verify_version
|
|
29
|
+
rescue StandardError
|
|
30
|
+
client.close
|
|
31
|
+
raise
|
|
32
|
+
end
|
|
24
33
|
return client unless block_given?
|
|
25
34
|
|
|
26
35
|
begin
|
|
@@ -30,6 +39,14 @@ module DaggerRuby
|
|
|
30
39
|
end
|
|
31
40
|
end
|
|
32
41
|
|
|
42
|
+
def verify_engine_version!(client, config)
|
|
43
|
+
actual = client.execute_query("query { version }").fetch("version")
|
|
44
|
+
return if actual == config.expected_engine_version
|
|
45
|
+
|
|
46
|
+
raise VersionMismatchError,
|
|
47
|
+
"Dagger engine #{actual} is incompatible with this client; expected #{config.expected_engine_version}"
|
|
48
|
+
end
|
|
49
|
+
|
|
33
50
|
def dagger_run_command(config)
|
|
34
51
|
[
|
|
35
52
|
"dagger",
|
|
@@ -44,6 +61,19 @@ module DaggerRuby
|
|
|
44
61
|
]
|
|
45
62
|
end
|
|
46
63
|
|
|
64
|
+
def verify_cli_version!(config)
|
|
65
|
+
stdout, stderr, status = Open3.capture3("dagger", "version")
|
|
66
|
+
output = [stdout, stderr].join(" ").strip
|
|
67
|
+
actual = output[/\bv\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?\b/]
|
|
68
|
+
return if status.success? && actual == config.expected_engine_version
|
|
69
|
+
|
|
70
|
+
found = actual || (output.empty? ? "an unreadable version" : output)
|
|
71
|
+
raise VersionMismatchError,
|
|
72
|
+
"Dagger CLI #{found} is incompatible with this client; install #{config.expected_engine_version}"
|
|
73
|
+
rescue Errno::ENOENT
|
|
74
|
+
raise VersionMismatchError, "Dagger CLI is not installed; install #{config.expected_engine_version}"
|
|
75
|
+
end
|
|
76
|
+
|
|
47
77
|
def quiet_flags(config)
|
|
48
78
|
quiet = config&.quiet || ENV["DAGGER_QUIET"]&.to_i
|
|
49
79
|
quiet&.positive? ? ["-q"] * quiet : []
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dagger_ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.10.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- BoringCache
|
|
@@ -85,7 +85,7 @@ licenses:
|
|
|
85
85
|
metadata:
|
|
86
86
|
allowed_push_host: https://rubygems.org
|
|
87
87
|
homepage_uri: https://github.com/boringcache/dagger_ruby
|
|
88
|
-
source_code_uri: https://github.com/boringcache/dagger_ruby/tree/v0.
|
|
88
|
+
source_code_uri: https://github.com/boringcache/dagger_ruby/tree/v0.10.0
|
|
89
89
|
changelog_uri: https://github.com/boringcache/dagger_ruby/blob/main/CHANGELOG.md
|
|
90
90
|
bug_tracker_uri: https://github.com/boringcache/dagger_ruby/issues
|
|
91
91
|
documentation_uri: https://github.com/boringcache/dagger_ruby#readme
|
|
@@ -98,7 +98,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
98
98
|
requirements:
|
|
99
99
|
- - ">="
|
|
100
100
|
- !ruby/object:Gem::Version
|
|
101
|
-
version:
|
|
101
|
+
version: 3.2.0
|
|
102
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
103
|
requirements:
|
|
104
104
|
- - ">="
|