dagger_ruby 0.6.0 → 0.9.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 +46 -78
- data/LICENSE.txt +1 -1
- data/README.md +107 -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 +7 -7
- data/lib/dagger_ruby/container.rb +49 -98
- data/lib/dagger_ruby/dagger_object.rb +18 -28
- data/lib/dagger_ruby/directory.rb +24 -61
- 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 +48 -39
- 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: 3236161fdcbdb34e426318363c0db9b1625fef0bfff6d83d021908ccaab26e69
|
|
4
|
+
data.tar.gz: d0510f01bd92c27f6f06ba2c2693007771ffb8d6fb8da663ef2aea8798bd09d6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fb8c138bbf1c674ad47cffecb4d31c77348c83a4e83e6439f55240925587ba16035f53d21f49995d849807d6d1b9bd70edb0cabec3fe860c521efaade6307539
|
|
7
|
+
data.tar.gz: ad20b3fb027215a665fb58fbfde7ae125d791e7b596c449ac23f91e87e07e16de154d9775b19d070066855b26cb062e8d69ffe382f64d9c59feab438daa225d6
|
data/CHANGELOG.md
CHANGED
|
@@ -1,105 +1,73 @@
|
|
|
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.9.0] - 2026-08-20
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Engine-backed compatibility tests for Dagger 0.21.8.
|
|
14
|
+
- Trusted publishing through RubyGems and GitHub Actions.
|
|
15
|
+
- Security, contribution, and community documentation.
|
|
11
16
|
|
|
12
|
-
|
|
13
|
-
engine_log_level: "error", # Only errors
|
|
14
|
-
progress: "plain" # Clean progress format
|
|
15
|
-
)
|
|
16
|
-
DaggerRuby.connection(config) do |client|
|
|
17
|
-
# Your operations with clean output
|
|
18
|
-
end
|
|
17
|
+
### Changed
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
- Require Ruby 4.0 or newer.
|
|
20
|
+
- Align container, directory, file, Git, host, secret, cache, and service queries
|
|
21
|
+
with the Dagger 0.21.8 GraphQL schema.
|
|
22
|
+
- Update runtime and development dependencies.
|
|
23
|
+
- Present the project as a community-maintained client with an explicit
|
|
24
|
+
compatibility policy.
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
- dots - Just dots for progress
|
|
24
|
-
- tty - Full fancy output (default)
|
|
25
|
-
- auto - Auto-detect based on terminal
|
|
26
|
+
### Fixed
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
- Preserve the value returned by `DaggerRuby.connection` blocks.
|
|
29
|
+
- Forward script names and arguments to `dagger run` without shell interpolation.
|
|
30
|
+
- Escape GraphQL strings and select nested fields consistently.
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
- Timing information like 0.7s, 3.6s CACHED
|
|
31
|
-
- Complex tree-style progress display
|
|
32
|
+
## [0.8.0] - 2025-01-27
|
|
32
33
|
|
|
33
|
-
|
|
34
|
+
### Changed
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
- Simplified internal configuration initialization while keeping its public call
|
|
37
|
+
shape compatible.
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
# or
|
|
39
|
-
DAGGER_LOG_LEVEL=warn your_ruby_script.rb # Only warnings and errors
|
|
39
|
+
### Fixed
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
- Corrected `withDirectory` query arguments.
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
DaggerRuby.connection(config) do |client|
|
|
45
|
-
# Your dagger operations with minimal logging
|
|
46
|
-
end
|
|
43
|
+
## [0.6.0] - 2025-01-17
|
|
47
44
|
|
|
48
|
-
|
|
45
|
+
### Added
|
|
49
46
|
|
|
50
|
-
-
|
|
51
|
-
- debug - Default Dagger behavior
|
|
52
|
-
- info - Informational messages
|
|
53
|
-
- warn - Warnings and errors (new default)
|
|
54
|
-
- error - Only errors (cleanest output)
|
|
47
|
+
- Progress and engine-log configuration.
|
|
55
48
|
|
|
56
|
-
|
|
49
|
+
## [0.4.0] - 2024-12-19
|
|
57
50
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
-
|
|
61
|
-
- Tests updated and passing
|
|
51
|
+
### Added
|
|
52
|
+
|
|
53
|
+
- Dagger log-level configuration.
|
|
62
54
|
|
|
63
55
|
## [0.3.0] - 2024-12-19
|
|
64
56
|
|
|
65
|
-
### Fixed
|
|
57
|
+
### Fixed
|
|
66
58
|
|
|
67
|
-
-
|
|
68
|
-
- Rubocop
|
|
59
|
+
- Dependency and lint configuration.
|
|
69
60
|
|
|
70
61
|
## [0.1.0] - 2024-12-19
|
|
71
62
|
|
|
72
63
|
### Added
|
|
73
|
-
|
|
74
|
-
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
- Integration with BoringBuildRuby for Rails application builds
|
|
84
|
-
|
|
85
|
-
### Features
|
|
86
|
-
- **Client**: GraphQL client with automatic session detection
|
|
87
|
-
- **Container**: Full container lifecycle management and operations
|
|
88
|
-
- **Directory**: File system operations and directory manipulation
|
|
89
|
-
- **File**: File reading, writing, and export operations
|
|
90
|
-
- **Cache Volume**: Build caching for faster rebuilds
|
|
91
|
-
- **Secret**: Secure secret injection and mounting
|
|
92
|
-
- **Query Builder**: Optimized GraphQL query generation
|
|
93
|
-
- **Error Handling**: Comprehensive error types and messages
|
|
94
|
-
|
|
95
|
-
### Examples
|
|
96
|
-
- Simple Ruby application build with caching
|
|
97
|
-
- Rails CI/CD pipeline with multi-environment support
|
|
98
|
-
- BoringBuildRuby integration for optimized Rails builds
|
|
99
|
-
- Cowsay demonstration of basic operations
|
|
100
|
-
|
|
101
|
-
### Performance
|
|
102
|
-
- Lazy evaluation prevents unnecessary API calls
|
|
103
|
-
- Cache volumes provide 50-80% faster rebuilds
|
|
104
|
-
- Optimized GraphQL query generation
|
|
105
|
-
- HTTP connection reuse and pooling
|
|
64
|
+
|
|
65
|
+
- Initial container, directory, file, cache, secret, Git, and GraphQL client.
|
|
66
|
+
|
|
67
|
+
[Unreleased]: https://github.com/boringcache/dagger_ruby/compare/v0.9.0...HEAD
|
|
68
|
+
[0.9.0]: https://github.com/boringcache/dagger_ruby/compare/v0.8.0...v0.9.0
|
|
69
|
+
[0.8.0]: https://github.com/boringcache/dagger_ruby/releases/tag/v0.8.0
|
|
70
|
+
[0.6.0]: https://github.com/boringcache/dagger_ruby/releases/tag/v0.6.0
|
|
71
|
+
[0.4.0]: https://github.com/boringcache/dagger_ruby/releases/tag/v0.4.0
|
|
72
|
+
[0.3.0]: https://github.com/boringcache/dagger_ruby/releases/tag/v0.3.0
|
|
73
|
+
[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,186 @@
|
|
|
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 4.0 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
|
+
)
|
|
198
137
|
|
|
199
138
|
DaggerRuby.connection(config) do |client|
|
|
200
|
-
#
|
|
139
|
+
# Build pipeline
|
|
201
140
|
end
|
|
202
141
|
```
|
|
203
142
|
|
|
204
|
-
|
|
143
|
+
`DAGGER_QUIET`, `DAGGER_SILENT`, and `DAGGER_PROGRESS` can provide the same CLI
|
|
144
|
+
preferences through the environment.
|
|
205
145
|
|
|
206
|
-
|
|
146
|
+
## Errors
|
|
147
|
+
|
|
148
|
+
Connection, transport, GraphQL, and invalid-query failures use dedicated error
|
|
149
|
+
classes:
|
|
207
150
|
|
|
208
151
|
```ruby
|
|
209
152
|
begin
|
|
210
|
-
DaggerRuby.connection
|
|
211
|
-
|
|
212
|
-
|
|
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}"
|
|
153
|
+
DaggerRuby.connection { |client| puts client.container.from("missing").stdout }
|
|
154
|
+
rescue DaggerRuby::ConnectionError, DaggerRuby::GraphQLError => error
|
|
155
|
+
warn error.message
|
|
221
156
|
end
|
|
222
157
|
```
|
|
223
158
|
|
|
224
|
-
##
|
|
225
|
-
|
|
226
|
-
### 1. Use Cache Volumes for Dependencies
|
|
227
|
-
```ruby
|
|
228
|
-
# Good: Use cache volumes for package managers
|
|
229
|
-
cache = client.cache_volume("npm-cache")
|
|
230
|
-
container.with_mounted_cache("/root/.npm", cache)
|
|
231
|
-
|
|
232
|
-
# Bad: No caching, slower builds
|
|
233
|
-
container.with_exec(["npm", "install"])
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
### 2. Leverage Multi-stage Builds
|
|
237
|
-
```ruby
|
|
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
|
-
```
|
|
242
|
-
|
|
243
|
-
### 3. Use Secrets for Sensitive Data
|
|
244
|
-
```ruby
|
|
245
|
-
# Good: Use Dagger secrets
|
|
246
|
-
api_key = client.set_secret("api_key", ENV["API_KEY"])
|
|
247
|
-
container.with_secret_variable("API_KEY", api_key)
|
|
248
|
-
|
|
249
|
-
# Bad: Expose secrets in environment variables
|
|
250
|
-
container.with_env_variable("API_KEY", ENV["API_KEY"]) # This gets cached!
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
## Examples
|
|
254
|
-
|
|
255
|
-
See the `examples/` directory for complete working examples:
|
|
159
|
+
## Compatibility
|
|
256
160
|
|
|
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
|
-
```
|
|
161
|
+
The current branch is tested against Ruby 4.0 and Dagger 0.21.8. Dagger's
|
|
162
|
+
GraphQL schema can change between releases, so each supported engine update is
|
|
163
|
+
validated by the live integration suite before release. Earlier Ruby and Dagger
|
|
164
|
+
versions are not covered by the current compatibility contract.
|
|
277
165
|
|
|
278
166
|
## Development
|
|
279
167
|
|
|
280
|
-
After checking out the repo, run:
|
|
281
|
-
|
|
282
168
|
```bash
|
|
283
|
-
bin/setup
|
|
284
|
-
bin/
|
|
169
|
+
bin/setup
|
|
170
|
+
bin/ci
|
|
285
171
|
```
|
|
286
172
|
|
|
287
|
-
|
|
173
|
+
The fast suite stubs the GraphQL endpoint. Run the engine-backed contract tests
|
|
174
|
+
with the supported Dagger version:
|
|
288
175
|
|
|
289
176
|
```bash
|
|
290
|
-
bundle exec
|
|
177
|
+
DAGGER_LIVE_TESTS=1 dagger run -- bundle exec ruby test/integration/test_dagger_engine.rb
|
|
291
178
|
```
|
|
292
179
|
|
|
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.
|
|
180
|
+
Working examples live in [`examples/`](examples). Contribution and security
|
|
181
|
+
guidance are in [`CONTRIBUTING.md`](CONTRIBUTING.md) and
|
|
182
|
+
[`SECURITY.md`](SECURITY.md).
|
|
316
183
|
|
|
317
184
|
## License
|
|
318
185
|
|
|
319
|
-
MIT
|
|
186
|
+
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.
|