Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 46 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,58 @@
name: CI
on:
push:
branches-ignore:
- 'generated'
- 'codegen/**'
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
branches:
- '**'
- '!integrated/**'
- '!stl-preview-head/**'
- '!stl-preview-base/**'
- '!generated'
- '!codegen/**'
- 'codegen/stl/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
- 'stl-preview-base/**'

jobs:
build:
timeout-minutes: 10
name: build
permissions:
contents: read
id-token: write
runs-on: ${{ github.repository == 'stainless-sdks/docker-ruby' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: |-
github.repository == 'stainless-sdks/docker-ruby' &&
(github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- uses: actions/checkout@v6
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: false
- run: |-
bundle install

- name: Get GitHub OIDC Token
if: |-
github.repository == 'stainless-sdks/docker-ruby' &&
!startsWith(github.ref, 'refs/heads/stl/')
id: github-oidc
uses: actions/github-script@v8
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Build and upload gem artifacts
if: |-
github.repository == 'stainless-sdks/docker-ruby' &&
!startsWith(github.ref, 'refs/heads/stl/')
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
SHA: ${{ github.sha }}
PACKAGE_NAME: docker_engine_ruby
run: ./scripts/utils/upload-artifact.sh
lint:
timeout-minutes: 10
name: lint
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.idea/
.ignore
.prism.log
.stdy.log
.ruby-lsp/
.yardoc/
bin/tapioca
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.7.3"
".": "0.7.4"
}
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Changelog

## 0.7.4 (2026-04-01)

Full Changelog: [v0.7.3...v0.7.4](https://github.com/Hexlet/docker-ruby/compare/v0.7.3...v0.7.4)

### Bug Fixes

* align path encoding with RFC 3986 section 3.3 ([590bc94](https://github.com/Hexlet/docker-ruby/commit/590bc94c26ce9d630f0f6b4c9458d837876a9a98))
* **internal:** correct multipart form field name encoding ([d2df78a](https://github.com/Hexlet/docker-ruby/commit/d2df78ae65e43660b24958459e1f1f165ca9483f))
* properly mock time in ruby ci tests ([f291b96](https://github.com/Hexlet/docker-ruby/commit/f291b9605760add258fc3e596a664800663d9e7f))
* variable name typo ([b827fa8](https://github.com/Hexlet/docker-ruby/commit/b827fa8ca02b7b0ca4d27ee6cf45cb520069c959))


### Chores

* **ci:** add build step ([f5b8022](https://github.com/Hexlet/docker-ruby/commit/f5b8022932e298a82aa303e923a6e5bf69279cdc))
* **ci:** skip lint on metadata-only changes ([24f48e2](https://github.com/Hexlet/docker-ruby/commit/24f48e2052ca6fd27a2e19a49f9436891a522902))
* **ci:** skip uploading artifacts on stainless-internal branches ([1b1aa08](https://github.com/Hexlet/docker-ruby/commit/1b1aa0891ea556e0c8ffa46ea20ff0a4d5f3e700))
* **ci:** support opting out of skipping builds on metadata-only commits ([a9b2155](https://github.com/Hexlet/docker-ruby/commit/a9b2155d508034db5317b6e7122183b167f7ae92))
* **internal:** codegen related update ([c0b2afb](https://github.com/Hexlet/docker-ruby/commit/c0b2afb257b2a173db9721e248ecbbcb230c54c1))
* **internal:** codegen related update ([ab55081](https://github.com/Hexlet/docker-ruby/commit/ab550815719723e748965fb23c2547aee2b1de91))
* **internal:** tweak CI branches ([7889dd4](https://github.com/Hexlet/docker-ruby/commit/7889dd429e6f5facaad352660290bee0a81bd446))
* **internal:** update gitignore ([33e96c7](https://github.com/Hexlet/docker-ruby/commit/33e96c75c33be17c746f95320942a9e2d362cad1))
* update placeholder string ([a3b8bba](https://github.com/Hexlet/docker-ruby/commit/a3b8bbab2dfb07a0a882c843f4d7c28da690772c))

## 0.7.3 (2026-02-24)

Full Changelog: [v0.7.2...v0.7.3](https://github.com/Hexlet/docker-ruby/compare/v0.7.2...v0.7.3)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GIT
PATH
remote: .
specs:
docker-engine-ruby (0.7.3)
docker-engine-ruby (0.7.4)
cgi
connection_pool

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
<!-- x-release-please-start-version -->

```ruby
gem "docker-engine-ruby", "~> 0.7.3"
gem "docker-engine-ruby", "~> 0.7.4"
```

<!-- x-release-please-end -->
Expand Down
56 changes: 50 additions & 6 deletions lib/docker_engine_ruby/internal/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def coerce_hash!(input)
in Hash | nil => coerced
coerced
else
message = "Expected a #{Hash} or #{DockerEngineRuby::Internal::Type::BaseModel}, got #{data.inspect}"
message = "Expected a #{Hash} or #{DockerEngineRuby::Internal::Type::BaseModel}, got #{input.inspect}"
raise ArgumentError.new(message)
end
end
Expand Down Expand Up @@ -237,6 +237,11 @@ def dig(data, pick, &blk)
end
end

# @type [Regexp]
#
# https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3
RFC_3986_NOT_PCHARS = /[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/

class << self
# @api private
#
Expand All @@ -247,6 +252,15 @@ def uri_origin(uri)
"#{uri.scheme}://#{uri.host}#{":#{uri.port}" unless uri.port == uri.default_port}"
end

# @api private
#
# @param path [String, Integer]
#
# @return [String]
def encode_path(path)
path.to_s.gsub(DockerEngineRuby::Internal::Util::RFC_3986_NOT_PCHARS) { ERB::Util.url_encode(_1) }
end

# @api private
#
# @param path [String, Array<String>]
Expand All @@ -259,7 +273,7 @@ def interpolate_path(path)
in []
""
in [String => p, *interpolations]
encoded = interpolations.map { ERB::Util.url_encode(_1) }
encoded = interpolations.map { encode_path(_1) }
format(p, *encoded)
end
end
Expand Down Expand Up @@ -490,6 +504,37 @@ def writable_enum(&blk)
JSONL_CONTENT = %r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}

class << self
# @api private
#
# @param query [Hash{Symbol=>Object}]
#
# @return [Hash{Symbol=>Object}]
def encode_query_params(query)
out = {}
query.each { write_query_param_element!(out, _1, _2) }
out
end

# @api private
#
# @param collection [Hash{Symbol=>Object}]
# @param key [String]
# @param element [Object]
#
# @return [nil]
private def write_query_param_element!(collection, key, element)
case element
in Hash
element.each do |name, value|
write_query_param_element!(collection, "#{key}[#{name}]", value)
end
in Array
collection[key] = element.map(&:to_s).join(",")
else
collection[key] = element.to_s
end
end

# @api private
#
# @param y [Enumerator::Yielder]
Expand Down Expand Up @@ -540,16 +585,15 @@ class << self
y << "Content-Disposition: form-data"

unless key.nil?
name = ERB::Util.url_encode(key.to_s)
y << "; name=\"#{name}\""
y << "; name=\"#{key}\""
end

case val
in DockerEngineRuby::FilePart unless val.filename.nil?
filename = ERB::Util.url_encode(val.filename)
filename = encode_path(val.filename)
y << "; filename=\"#{filename}\""
in Pathname | IO
filename = ERB::Util.url_encode(::File.basename(val.to_path))
filename = encode_path(::File.basename(val.to_path))
y << "; filename=\"#{filename}\""
else
end
Expand Down
8 changes: 7 additions & 1 deletion lib/docker_engine_ruby/models/config_delete_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ class ConfigDeleteParams < DockerEngineRuby::Internal::Type::BaseModel
extend DockerEngineRuby::Internal::Type::RequestParameters::Converter
include DockerEngineRuby::Internal::Type::RequestParameters

# @!method initialize(request_options: {})
# @!attribute id
#
# @return [String]
required :id, String

# @!method initialize(id:, request_options: {})
# @param id [String]
# @param request_options [DockerEngineRuby::RequestOptions, Hash{Symbol=>Object}]
end
end
Expand Down
8 changes: 7 additions & 1 deletion lib/docker_engine_ruby/models/config_inspect_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ class ConfigInspectParams < DockerEngineRuby::Internal::Type::BaseModel
extend DockerEngineRuby::Internal::Type::RequestParameters::Converter
include DockerEngineRuby::Internal::Type::RequestParameters

# @!method initialize(request_options: {})
# @!attribute id
#
# @return [String]
required :id, String

# @!method initialize(id:, request_options: {})
# @param id [String]
# @param request_options [DockerEngineRuby::RequestOptions, Hash{Symbol=>Object}]
end
end
Expand Down
8 changes: 7 additions & 1 deletion lib/docker_engine_ruby/models/config_update_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ class ConfigUpdateParams < DockerEngineRuby::Internal::Type::BaseModel
extend DockerEngineRuby::Internal::Type::RequestParameters::Converter
include DockerEngineRuby::Internal::Type::RequestParameters

# @!attribute id
#
# @return [String]
required :id, String

# @!attribute version
#
# @return [Integer]
required :version, Integer

# @!method initialize(version:, request_options: {})
# @!method initialize(id:, version:, request_options: {})
# @param id [String]
# @param version [Integer]
# @param request_options [DockerEngineRuby::RequestOptions, Hash{Symbol=>Object}]
end
Expand Down
8 changes: 7 additions & 1 deletion lib/docker_engine_ruby/models/container_archive_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ class ContainerArchiveParams < DockerEngineRuby::Internal::Type::BaseModel
extend DockerEngineRuby::Internal::Type::RequestParameters::Converter
include DockerEngineRuby::Internal::Type::RequestParameters

# @!attribute id
#
# @return [String]
required :id, String

# @!attribute path
#
# @return [String]
required :path, String

# @!method initialize(path:, request_options: {})
# @!method initialize(id:, path:, request_options: {})
# @param id [String]
# @param path [String]
# @param request_options [DockerEngineRuby::RequestOptions, Hash{Symbol=>Object}]
end
Expand Down
8 changes: 7 additions & 1 deletion lib/docker_engine_ruby/models/container_attach_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ class ContainerAttachParams < DockerEngineRuby::Internal::Type::BaseModel
extend DockerEngineRuby::Internal::Type::RequestParameters::Converter
include DockerEngineRuby::Internal::Type::RequestParameters

# @!attribute id
#
# @return [String]
required :id, String

# @!attribute detach_keys
#
# @return [String, nil]
Expand Down Expand Up @@ -37,7 +42,8 @@ class ContainerAttachParams < DockerEngineRuby::Internal::Type::BaseModel
# @return [Boolean, nil]
optional :stream, DockerEngineRuby::Internal::Type::Boolean

# @!method initialize(detach_keys: nil, logs: nil, stderr: nil, stdin: nil, stdout: nil, stream: nil, request_options: {})
# @!method initialize(id:, detach_keys: nil, logs: nil, stderr: nil, stdin: nil, stdout: nil, stream: nil, request_options: {})
# @param id [String]
# @param detach_keys [String]
# @param logs [Boolean]
# @param stderr [Boolean]
Expand Down
8 changes: 7 additions & 1 deletion lib/docker_engine_ruby/models/container_changes_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ class ContainerChangesParams < DockerEngineRuby::Internal::Type::BaseModel
extend DockerEngineRuby::Internal::Type::RequestParameters::Converter
include DockerEngineRuby::Internal::Type::RequestParameters

# @!method initialize(request_options: {})
# @!attribute id
#
# @return [String]
required :id, String

# @!method initialize(id:, request_options: {})
# @param id [String]
# @param request_options [DockerEngineRuby::RequestOptions, Hash{Symbol=>Object}]
end
end
Expand Down
8 changes: 7 additions & 1 deletion lib/docker_engine_ruby/models/container_delete_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ class ContainerDeleteParams < DockerEngineRuby::Internal::Type::BaseModel
extend DockerEngineRuby::Internal::Type::RequestParameters::Converter
include DockerEngineRuby::Internal::Type::RequestParameters

# @!attribute id
#
# @return [String]
required :id, String

# @!attribute force
#
# @return [Boolean, nil]
Expand All @@ -22,7 +27,8 @@ class ContainerDeleteParams < DockerEngineRuby::Internal::Type::BaseModel
# @return [Boolean, nil]
optional :v, DockerEngineRuby::Internal::Type::Boolean

# @!method initialize(force: nil, link: nil, v: nil, request_options: {})
# @!method initialize(id:, force: nil, link: nil, v: nil, request_options: {})
# @param id [String]
# @param force [Boolean]
# @param link [Boolean]
# @param v [Boolean]
Expand Down
8 changes: 7 additions & 1 deletion lib/docker_engine_ruby/models/container_exec_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ class ContainerExecParams < DockerEngineRuby::Internal::Type::BaseModel
extend DockerEngineRuby::Internal::Type::RequestParameters::Converter
include DockerEngineRuby::Internal::Type::RequestParameters

# @!attribute id
#
# @return [String]
required :id, String

# @!attribute attach_stderr
#
# @return [Boolean, nil]
Expand Down Expand Up @@ -65,7 +70,8 @@ class ContainerExecParams < DockerEngineRuby::Internal::Type::BaseModel
# @return [String, nil]
optional :working_dir, String, api_name: :WorkingDir

# @!method initialize(attach_stderr: nil, attach_stdin: nil, attach_stdout: nil, cmd: nil, console_size: nil, detach_keys: nil, env: nil, privileged: nil, tty: nil, user: nil, working_dir: nil, request_options: {})
# @!method initialize(id:, attach_stderr: nil, attach_stdin: nil, attach_stdout: nil, cmd: nil, console_size: nil, detach_keys: nil, env: nil, privileged: nil, tty: nil, user: nil, working_dir: nil, request_options: {})
# @param id [String]
# @param attach_stderr [Boolean]
# @param attach_stdin [Boolean]
# @param attach_stdout [Boolean]
Expand Down
8 changes: 7 additions & 1 deletion lib/docker_engine_ruby/models/container_export_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ class ContainerExportParams < DockerEngineRuby::Internal::Type::BaseModel
extend DockerEngineRuby::Internal::Type::RequestParameters::Converter
include DockerEngineRuby::Internal::Type::RequestParameters

# @!method initialize(request_options: {})
# @!attribute id
#
# @return [String]
required :id, String

# @!method initialize(id:, request_options: {})
# @param id [String]
# @param request_options [DockerEngineRuby::RequestOptions, Hash{Symbol=>Object}]
end
end
Expand Down
Loading
Loading