dagger_ruby 0.7.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 +52 -91
- data/LICENSE.txt +1 -1
- data/README.md +115 -240
- data/SECURITY.md +18 -0
- data/dagger_ruby.gemspec +17 -20
- data/lib/dagger_ruby/cache_volume.rb +0 -10
- data/lib/dagger_ruby/client.rb +25 -24
- data/lib/dagger_ruby/config.rb +38 -1
- data/lib/dagger_ruby/container.rb +88 -96
- data/lib/dagger_ruby/dagger_object.rb +18 -28
- data/lib/dagger_ruby/directory.rb +23 -60
- data/lib/dagger_ruby/errors.rb +1 -0
- data/lib/dagger_ruby/file.rb +17 -49
- data/lib/dagger_ruby/git_repository.rb +16 -29
- data/lib/dagger_ruby/host.rb +6 -18
- data/lib/dagger_ruby/query_builder.rb +14 -9
- data/lib/dagger_ruby/secret.rb +0 -14
- data/lib/dagger_ruby/service.rb +10 -59
- data/lib/dagger_ruby/version.rb +2 -1
- data/lib/dagger_ruby.rb +57 -38
- metadata +20 -18
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
|
@@ -1,126 +1,87 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
All notable changes
|
|
3
|
+
All notable changes are recorded here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and versions follow
|
|
5
|
+
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
## [Unreleased]
|
|
7
8
|
|
|
8
|
-
## [0.
|
|
9
|
+
## [0.10.0] - 2026-08-25
|
|
9
10
|
|
|
10
|
-
###
|
|
11
|
+
### Added
|
|
11
12
|
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
- **Environment Variables**: Improved environment variable handling using `ENV.fetch` for more consistent nil handling
|
|
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
16
|
|
|
17
17
|
### Changed
|
|
18
18
|
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
- New: `Config.new(log_output: $stdout, workdir: "/tmp", timeout: 300)` (same syntax, but internally uses hash)
|
|
19
|
+
- Support Ruby 3.2 and newer so Ruby applications do not need Ruby 4 solely to
|
|
20
|
+
use the Dagger client.
|
|
22
21
|
|
|
23
|
-
|
|
22
|
+
## [0.9.0] - 2026-08-20
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
- Maintained backward compatibility - all existing code continues to work without changes
|
|
27
|
-
- All tests pass with improved code structure and maintainability
|
|
24
|
+
### Added
|
|
28
25
|
|
|
29
|
-
|
|
26
|
+
- Engine-backed compatibility tests for Dagger 0.21.8.
|
|
27
|
+
- Trusted publishing through RubyGems and GitHub Actions.
|
|
28
|
+
- Security, contribution, and community documentation.
|
|
30
29
|
|
|
31
|
-
|
|
30
|
+
### Changed
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
end
|
|
32
|
+
- Require Ruby 4.0 or newer.
|
|
33
|
+
- Align container, directory, file, Git, host, secret, cache, and service queries
|
|
34
|
+
with the Dagger 0.21.8 GraphQL schema.
|
|
35
|
+
- Update runtime and development dependencies.
|
|
36
|
+
- Present the project as a community-maintained client with an explicit
|
|
37
|
+
compatibility policy.
|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
### Fixed
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
- auto - Auto-detect based on terminal
|
|
41
|
+
- Preserve the value returned by `DaggerRuby.connection` blocks.
|
|
42
|
+
- Forward script names and arguments to `dagger run` without shell interpolation.
|
|
43
|
+
- Escape GraphQL strings and select nested fields consistently.
|
|
47
44
|
|
|
48
|
-
|
|
45
|
+
## [0.8.0] - 2025-01-27
|
|
49
46
|
|
|
50
|
-
|
|
51
|
-
- Timing information like 0.7s, 3.6s CACHED
|
|
52
|
-
- Complex tree-style progress display
|
|
47
|
+
### Changed
|
|
53
48
|
|
|
54
|
-
|
|
49
|
+
- Simplified internal configuration initialization while keeping its public call
|
|
50
|
+
shape compatible.
|
|
55
51
|
|
|
56
|
-
|
|
52
|
+
### Fixed
|
|
57
53
|
|
|
58
|
-
|
|
59
|
-
# or
|
|
60
|
-
DAGGER_LOG_LEVEL=warn your_ruby_script.rb # Only warnings and errors
|
|
54
|
+
- Corrected `withDirectory` query arguments.
|
|
61
55
|
|
|
62
|
-
|
|
56
|
+
## [0.6.0] - 2025-01-17
|
|
63
57
|
|
|
64
|
-
|
|
65
|
-
DaggerRuby.connection(config) do |client|
|
|
66
|
-
# Your dagger operations with minimal logging
|
|
67
|
-
end
|
|
58
|
+
### Added
|
|
68
59
|
|
|
69
|
-
|
|
60
|
+
- Progress and engine-log configuration.
|
|
70
61
|
|
|
71
|
-
|
|
72
|
-
- debug - Default Dagger behavior
|
|
73
|
-
- info - Informational messages
|
|
74
|
-
- warn - Warnings and errors (new default)
|
|
75
|
-
- error - Only errors (cleanest output)
|
|
62
|
+
## [0.4.0] - 2024-12-19
|
|
76
63
|
|
|
77
|
-
|
|
64
|
+
### Added
|
|
78
65
|
|
|
79
|
-
-
|
|
80
|
-
- Modified dagger run command to pass --log-level flag (lib/dagger_ruby.rb:35-38)
|
|
81
|
-
- Environment variable DAGGER_LOG_LEVEL support
|
|
82
|
-
- Tests updated and passing
|
|
66
|
+
- Dagger log-level configuration.
|
|
83
67
|
|
|
84
68
|
## [0.3.0] - 2024-12-19
|
|
85
69
|
|
|
86
|
-
### Fixed
|
|
70
|
+
### Fixed
|
|
87
71
|
|
|
88
|
-
-
|
|
89
|
-
- Rubocop
|
|
72
|
+
- Dependency and lint configuration.
|
|
90
73
|
|
|
91
74
|
## [0.1.0] - 2024-12-19
|
|
92
75
|
|
|
93
76
|
### Added
|
|
94
|
-
|
|
95
|
-
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
### Features
|
|
107
|
-
- **Client**: GraphQL client with automatic session detection
|
|
108
|
-
- **Container**: Full container lifecycle management and operations
|
|
109
|
-
- **Directory**: File system operations and directory manipulation
|
|
110
|
-
- **File**: File reading, writing, and export operations
|
|
111
|
-
- **Cache Volume**: Build caching for faster rebuilds
|
|
112
|
-
- **Secret**: Secure secret injection and mounting
|
|
113
|
-
- **Query Builder**: Optimized GraphQL query generation
|
|
114
|
-
- **Error Handling**: Comprehensive error types and messages
|
|
115
|
-
|
|
116
|
-
### Examples
|
|
117
|
-
- Simple Ruby application build with caching
|
|
118
|
-
- Rails CI/CD pipeline with multi-environment support
|
|
119
|
-
- BoringBuildRuby integration for optimized Rails builds
|
|
120
|
-
- Cowsay demonstration of basic operations
|
|
121
|
-
|
|
122
|
-
### Performance
|
|
123
|
-
- Lazy evaluation prevents unnecessary API calls
|
|
124
|
-
- Cache volumes provide 50-80% faster rebuilds
|
|
125
|
-
- Optimized GraphQL query generation
|
|
126
|
-
- HTTP connection reuse and pooling
|
|
77
|
+
|
|
78
|
+
- Initial container, directory, file, cache, secret, Git, and GraphQL client.
|
|
79
|
+
|
|
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
|
|
82
|
+
[0.9.0]: https://github.com/boringcache/dagger_ruby/compare/v0.8.0...v0.9.0
|
|
83
|
+
[0.8.0]: https://github.com/boringcache/dagger_ruby/releases/tag/v0.8.0
|
|
84
|
+
[0.6.0]: https://github.com/boringcache/dagger_ruby/releases/tag/v0.6.0
|
|
85
|
+
[0.4.0]: https://github.com/boringcache/dagger_ruby/releases/tag/v0.4.0
|
|
86
|
+
[0.3.0]: https://github.com/boringcache/dagger_ruby/releases/tag/v0.3.0
|
|
87
|
+
[0.1.0]: https://github.com/boringcache/dagger_ruby/releases/tag/v0.1.0
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -1,319 +1,194 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Dagger Ruby
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/boringcache/dagger_ruby/actions/workflows/main.yml)
|
|
4
|
+
[](https://rubygems.org/gems/dagger_ruby)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
A small, chainable Ruby client for [Dagger](https://dagger.io). Use Ruby to run
|
|
7
|
+
container builds, mount source directories and caches, pass secrets, and connect
|
|
8
|
+
services through Dagger's GraphQL API.
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Add this line to your application's Gemfile:
|
|
10
|
+
This is a community-maintained client, not an official Dagger SDK. It deliberately
|
|
11
|
+
covers a practical subset of the API instead of Dagger module code generation.
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
gem 'dagger_ruby'
|
|
13
|
-
```
|
|
13
|
+
## Requirements
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
- Ruby 3.2 or newer
|
|
16
|
+
- Dagger 0.21.8
|
|
17
|
+
- Docker, Colima, or another container runtime supported by Dagger
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
bundle install
|
|
19
|
-
```
|
|
19
|
+
## Installation
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Add the gem to your bundle:
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
|
|
24
|
+
bundle add dagger_ruby
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
Install the [Dagger CLI](https://docs.dagger.io/getting-started/installation/) if
|
|
28
|
+
it is not already available.
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
- [Dagger CLI](https://docs.dagger.io/install) installed
|
|
31
|
-
- Docker or compatible container runtime (Docker Desktop, Podman, etc.)
|
|
30
|
+
## Quick start
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
Create `pipeline.rb`:
|
|
34
33
|
|
|
35
34
|
```ruby
|
|
36
|
-
require
|
|
35
|
+
require "dagger_ruby"
|
|
37
36
|
|
|
38
37
|
DaggerRuby.connection do |client|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
puts
|
|
38
|
+
output = client.container
|
|
39
|
+
.from("alpine:3.22")
|
|
40
|
+
.with_exec(["echo", "hello from Dagger"])
|
|
41
|
+
.stdout
|
|
42
|
+
|
|
43
|
+
puts output
|
|
45
44
|
end
|
|
46
45
|
```
|
|
47
46
|
|
|
48
|
-
|
|
47
|
+
Then run it normally:
|
|
49
48
|
|
|
50
49
|
```bash
|
|
51
|
-
|
|
50
|
+
bundle exec ruby pipeline.rb
|
|
52
51
|
```
|
|
53
52
|
|
|
54
|
-
|
|
53
|
+
Outside an existing Dagger session, `DaggerRuby.connection` restarts the script
|
|
54
|
+
under `dagger run`. Inside a session, it connects directly. You can also make the
|
|
55
|
+
session explicit:
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
- **Secrets Management**: Secure handling of sensitive data
|
|
60
|
-
- **Git Integration**: Clone and build from repositories
|
|
61
|
-
- **Registry Auth**: Push to private registries
|
|
62
|
-
- **Multi-platform**: Build for multiple architectures
|
|
57
|
+
```bash
|
|
58
|
+
dagger run -- bundle exec ruby pipeline.rb
|
|
59
|
+
```
|
|
63
60
|
|
|
64
|
-
##
|
|
61
|
+
## Common operations
|
|
65
62
|
|
|
66
|
-
|
|
67
|
-
```ruby
|
|
68
|
-
DaggerRuby.connection do |client|
|
|
69
|
-
client.container
|
|
70
|
-
.from("python:alpine")
|
|
71
|
-
.with_exec(["pip", "install", "cowsay"])
|
|
72
|
-
.with_exec(["cowsay", "Hello from Dagger!"])
|
|
73
|
-
.stdout
|
|
74
|
-
end
|
|
75
|
-
```
|
|
63
|
+
Mount the current project and a persistent Bundler cache:
|
|
76
64
|
|
|
77
|
-
### With Caching
|
|
78
65
|
```ruby
|
|
79
66
|
DaggerRuby.connection do |client|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
67
|
+
source = client.host.directory(Dir.pwd, exclude: [".git", "vendor"])
|
|
68
|
+
gems = client.cache_volume("bundle-cache")
|
|
69
|
+
|
|
70
|
+
tests = client.container
|
|
71
|
+
.from("ruby:4.0.6")
|
|
72
|
+
.with_directory("/src", source)
|
|
73
|
+
.with_mounted_cache("/usr/local/bundle", gems)
|
|
74
|
+
.with_workdir("/src")
|
|
75
|
+
.with_exec(["bundle", "install"])
|
|
76
|
+
.with_exec(["bundle", "exec", "rake", "test"])
|
|
77
|
+
|
|
78
|
+
puts tests.stdout
|
|
87
79
|
end
|
|
88
80
|
```
|
|
89
81
|
|
|
90
|
-
|
|
91
|
-
```ruby
|
|
92
|
-
DaggerRuby.connection do |client|
|
|
93
|
-
source = client.git("https://github.com/user/repo.git")
|
|
94
|
-
.branch("main")
|
|
95
|
-
.tree
|
|
96
|
-
|
|
97
|
-
client.container
|
|
98
|
-
.from("node:18")
|
|
99
|
-
.with_directory("/src", source)
|
|
100
|
-
.with_exec(["npm", "install"])
|
|
101
|
-
.with_exec(["npm", "run", "build"])
|
|
102
|
-
end
|
|
103
|
-
```
|
|
82
|
+
Pass a secret without placing its plaintext in the container definition:
|
|
104
83
|
|
|
105
|
-
### Secret Management
|
|
106
84
|
```ruby
|
|
107
85
|
DaggerRuby.connection do |client|
|
|
108
|
-
|
|
109
|
-
db_password = client.set_secret("db_password", "super_secret")
|
|
110
|
-
|
|
111
|
-
client.container
|
|
112
|
-
.from("postgres:15")
|
|
113
|
-
.with_secret_variable("POSTGRES_PASSWORD", db_password)
|
|
114
|
-
.with_exec(["postgres"])
|
|
115
|
-
end
|
|
116
|
-
```
|
|
86
|
+
token = client.set_secret("registry-token", ENV.fetch("REGISTRY_TOKEN"))
|
|
117
87
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
.from("golang:1.21")
|
|
124
|
-
.with_directory("/src", client.host.directory("."))
|
|
125
|
-
.with_workdir("/src")
|
|
126
|
-
.with_exec(["go", "build", "-o", "app"])
|
|
127
|
-
|
|
128
|
-
# Runtime stage
|
|
129
|
-
client.container
|
|
130
|
-
.from("alpine:latest")
|
|
131
|
-
.with_file("/bin/app", builder.file("/src/app"))
|
|
132
|
-
.with_entrypoint(["/bin/app"])
|
|
133
|
-
end
|
|
134
|
-
```
|
|
88
|
+
result = client.container
|
|
89
|
+
.from("alpine:3.22")
|
|
90
|
+
.with_secret_variable("REGISTRY_TOKEN", token)
|
|
91
|
+
.with_exec(["sh", "-c", "test -n \"$REGISTRY_TOKEN\""])
|
|
92
|
+
.exit_code
|
|
135
93
|
|
|
136
|
-
|
|
137
|
-
```ruby
|
|
138
|
-
DaggerRuby.connection do |client|
|
|
139
|
-
ref = client.container
|
|
140
|
-
.from("node:18")
|
|
141
|
-
.with_directory("/app", client.host.directory("."))
|
|
142
|
-
.with_workdir("/app")
|
|
143
|
-
.with_exec(["npm", "ci"])
|
|
144
|
-
.with_exec(["npm", "run", "build"])
|
|
145
|
-
.publish("registry.example.com/my-app:latest")
|
|
146
|
-
|
|
147
|
-
puts "Published image: #{ref}"
|
|
94
|
+
abort "secret was unavailable" unless result.zero?
|
|
148
95
|
end
|
|
149
96
|
```
|
|
150
97
|
|
|
151
|
-
|
|
98
|
+
Bind a service to another container:
|
|
152
99
|
|
|
153
|
-
### Working with Services
|
|
154
100
|
```ruby
|
|
155
101
|
DaggerRuby.connection do |client|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
.with_exec(["bundle", "exec", "rspec"])
|
|
102
|
+
redis = client.container
|
|
103
|
+
.from("redis:8-alpine")
|
|
104
|
+
.with_exposed_port(6379)
|
|
105
|
+
.as_service
|
|
106
|
+
|
|
107
|
+
pong = client.container
|
|
108
|
+
.from("redis:8-alpine")
|
|
109
|
+
.with_service_binding("redis", redis)
|
|
110
|
+
.with_exec(["redis-cli", "-h", "redis", "ping"])
|
|
111
|
+
.stdout
|
|
112
|
+
|
|
113
|
+
puts pong
|
|
169
114
|
end
|
|
170
115
|
```
|
|
171
116
|
|
|
172
|
-
|
|
117
|
+
Clone a repository:
|
|
118
|
+
|
|
173
119
|
```ruby
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
platforms.each do |platform|
|
|
178
|
-
ref = client.container(platform: platform)
|
|
179
|
-
.from("golang:1.21")
|
|
180
|
-
.with_directory("/src", client.host.directory("."))
|
|
181
|
-
.with_workdir("/src")
|
|
182
|
-
.with_exec(["go", "build", "-o", "app"])
|
|
183
|
-
.publish("my-registry.com/app:latest-#{platform.gsub('/', '-')}")
|
|
184
|
-
|
|
185
|
-
puts "Built for #{platform}: #{ref}"
|
|
186
|
-
end
|
|
187
|
-
end
|
|
120
|
+
source = client.git("https://github.com/example/project.git")
|
|
121
|
+
.branch("main")
|
|
122
|
+
.tree
|
|
188
123
|
```
|
|
189
124
|
|
|
190
|
-
|
|
125
|
+
Authenticated Git and registry operations accept Dagger `Secret` objects; see
|
|
126
|
+
the public methods in `DaggerRuby::Client` and `DaggerRuby::Container` for the
|
|
127
|
+
available options.
|
|
191
128
|
|
|
192
|
-
|
|
129
|
+
## Configuration
|
|
193
130
|
|
|
194
131
|
```ruby
|
|
195
|
-
config = DaggerRuby::Config.new
|
|
196
|
-
|
|
197
|
-
|
|
132
|
+
config = DaggerRuby::Config.new(
|
|
133
|
+
timeout: 300,
|
|
134
|
+
progress: "plain",
|
|
135
|
+
log_output: $stderr,
|
|
136
|
+
runtime: :apple,
|
|
137
|
+
)
|
|
198
138
|
|
|
199
139
|
DaggerRuby.connection(config) do |client|
|
|
200
|
-
#
|
|
201
|
-
end
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
## Error Handling
|
|
205
|
-
|
|
206
|
-
DaggerRuby provides specific error classes for different failure scenarios:
|
|
207
|
-
|
|
208
|
-
```ruby
|
|
209
|
-
begin
|
|
210
|
-
DaggerRuby.connection do |client|
|
|
211
|
-
client.container
|
|
212
|
-
.from("nonexistent:image")
|
|
213
|
-
.stdout
|
|
214
|
-
end
|
|
215
|
-
rescue DaggerRuby::ConnectionError => e
|
|
216
|
-
puts "Failed to connect to Dagger: #{e.message}"
|
|
217
|
-
rescue DaggerRuby::GraphQLError => e
|
|
218
|
-
puts "GraphQL error: #{e.message}"
|
|
219
|
-
rescue DaggerRuby::InvalidQueryError => e
|
|
220
|
-
puts "Invalid query: #{e.message}"
|
|
140
|
+
# Build pipeline
|
|
221
141
|
end
|
|
222
142
|
```
|
|
223
143
|
|
|
224
|
-
|
|
144
|
+
`DAGGER_QUIET`, `DAGGER_SILENT`, and `DAGGER_PROGRESS` can provide the same CLI
|
|
145
|
+
preferences through the environment.
|
|
225
146
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
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:`.
|
|
231
153
|
|
|
232
|
-
|
|
233
|
-
container.with_exec(["npm", "install"])
|
|
234
|
-
```
|
|
154
|
+
## Errors
|
|
235
155
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
# Separate build and runtime environments for smaller images
|
|
239
|
-
builder = client.container.from("node:18").with_exec(["npm", "run", "build"])
|
|
240
|
-
runtime = client.container.from("nginx:alpine").with_directory("/usr/share/nginx/html", builder.directory("/app/dist"))
|
|
241
|
-
```
|
|
156
|
+
Connection, transport, GraphQL, and invalid-query failures use dedicated error
|
|
157
|
+
classes:
|
|
242
158
|
|
|
243
|
-
### 3. Use Secrets for Sensitive Data
|
|
244
159
|
```ruby
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
container.with_env_variable("API_KEY", ENV["API_KEY"]) # This gets cached!
|
|
160
|
+
begin
|
|
161
|
+
DaggerRuby.connection { |client| puts client.container.from("missing").stdout }
|
|
162
|
+
rescue DaggerRuby::ConnectionError, DaggerRuby::GraphQLError => error
|
|
163
|
+
warn error.message
|
|
164
|
+
end
|
|
251
165
|
```
|
|
252
166
|
|
|
253
|
-
##
|
|
254
|
-
|
|
255
|
-
See the `examples/` directory for complete working examples:
|
|
167
|
+
## Compatibility
|
|
256
168
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
### Running Examples
|
|
263
|
-
|
|
264
|
-
```bash
|
|
265
|
-
# Simple container example
|
|
266
|
-
dagger run ruby examples/cowsay.rb "Hello Dagger!"
|
|
267
|
-
|
|
268
|
-
# Build and validate a Ruby web application
|
|
269
|
-
dagger run ruby examples/ruby_app_build.rb
|
|
270
|
-
|
|
271
|
-
# Test and validate app without services
|
|
272
|
-
dagger run ruby examples/service_test.rb
|
|
273
|
-
|
|
274
|
-
# Quick service binding example
|
|
275
|
-
dagger run ruby examples/simple_service.rb
|
|
276
|
-
```
|
|
169
|
+
The current branch is tested against maintained Ruby releases and Dagger 0.21.8. Dagger's
|
|
170
|
+
GraphQL schema can change between releases, so each supported engine update is
|
|
171
|
+
validated by the live integration suite before release. Earlier Ruby and Dagger
|
|
172
|
+
versions are not covered by the current compatibility contract.
|
|
277
173
|
|
|
278
174
|
## Development
|
|
279
175
|
|
|
280
|
-
After checking out the repo, run:
|
|
281
|
-
|
|
282
176
|
```bash
|
|
283
|
-
bin/setup
|
|
284
|
-
bin/
|
|
177
|
+
bin/setup
|
|
178
|
+
bin/ci
|
|
285
179
|
```
|
|
286
180
|
|
|
287
|
-
|
|
181
|
+
The fast suite stubs the GraphQL endpoint. Run the engine-backed contract tests
|
|
182
|
+
with the supported Dagger version:
|
|
288
183
|
|
|
289
184
|
```bash
|
|
290
|
-
bundle exec
|
|
185
|
+
DAGGER_LIVE_TESTS=1 dagger run -- bundle exec ruby test/integration/test_dagger_engine.rb
|
|
291
186
|
```
|
|
292
187
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
297
|
-
3. Commit your changes (`git commit -am 'Add amazing feature'`)
|
|
298
|
-
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
299
|
-
5. Open a Pull Request
|
|
300
|
-
|
|
301
|
-
## Requirements
|
|
302
|
-
|
|
303
|
-
- Ruby 3.1+
|
|
304
|
-
- Dagger CLI
|
|
305
|
-
- Docker or compatible container runtime
|
|
306
|
-
|
|
307
|
-
## Support
|
|
308
|
-
|
|
309
|
-
- [GitHub Issues](https://github.com/boring-build/dagger-ruby/issues) - Bug reports and feature requests
|
|
310
|
-
- [Dagger Documentation](https://docs.dagger.io) - Official Dagger documentation
|
|
311
|
-
- [Ruby Documentation](https://docs.ruby-lang.org) - Ruby language documentation
|
|
312
|
-
|
|
313
|
-
## Acknowledgments
|
|
314
|
-
|
|
315
|
-
Built with ❤️ using **Claude Sonnet 3.5/4** + **GPT-4** AI assistance.
|
|
188
|
+
Working examples live in [`examples/`](examples). Contribution and security
|
|
189
|
+
guidance are in [`CONTRIBUTING.md`](CONTRIBUTING.md) and
|
|
190
|
+
[`SECURITY.md`](SECURITY.md).
|
|
316
191
|
|
|
317
192
|
## License
|
|
318
193
|
|
|
319
|
-
MIT
|
|
194
|
+
Dagger Ruby is available under the [MIT License](LICENSE.txt).
|
data/SECURITY.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Security policy
|
|
2
|
+
|
|
3
|
+
## Supported versions
|
|
4
|
+
|
|
5
|
+
Security fixes are made on the latest released version. Please upgrade before
|
|
6
|
+
reporting a problem that only affects an older release.
|
|
7
|
+
|
|
8
|
+
## Reporting a vulnerability
|
|
9
|
+
|
|
10
|
+
Use [GitHub's private vulnerability reporting](https://github.com/boringcache/dagger_ruby/security/advisories/new).
|
|
11
|
+
Do not open a public issue for a suspected vulnerability.
|
|
12
|
+
|
|
13
|
+
Include the affected version, a minimal reproduction, the likely impact, and any
|
|
14
|
+
suggested remediation. Maintainers will acknowledge a complete report within
|
|
15
|
+
seven days and coordinate disclosure after a fix is available.
|
|
16
|
+
|
|
17
|
+
Never include real credentials, tokens, customer data, or other secrets in a
|
|
18
|
+
report or reproduction.
|