Conversation
There was a problem hiding this comment.
Pull request overview
Adds required CLI-side tooling to the published runtime container image so rc users can rely on jq/yq being present (per issue #43), and introduces a regression contract test to prevent accidental removal in future Dockerfile edits.
Changes:
- Install
jqandyq-goin the runtime stage of the rootDockerfile. - Add a CLI contract test that asserts the Dockerfile installs these tools.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Dockerfile | Extends the runtime stage apk add line to include jq and yq-go. |
| crates/cli/tests/dockerfile_contract.rs | Adds a contract test to detect regressions in runtime image tool installation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| assert!( | ||
| dockerfile.contains("apk add --no-cache ca-certificates jq yq-go"), |
There was a problem hiding this comment.
The contract test is very brittle because it requires an exact substring with a fixed package order and no additional packages (e.g., adding another runtime tool or reformatting the RUN line would fail the test even if jq/yq-go are still installed). Consider asserting that the runtime-stage apk add --no-cache line includes both jq and yq-go regardless of ordering/extra packages (e.g., tokenize the line or use a regex) so the test only fails when the tools are actually removed.
| assert!( | |
| dockerfile.contains("apk add --no-cache ca-certificates jq yq-go"), | |
| // Find the runtime-stage apk add line and ensure it includes both jq and yq-go, | |
| // regardless of order or additional packages. | |
| let runtime_apk_line = dockerfile | |
| .lines() | |
| .find(|line| line.contains("apk add --no-cache")) | |
| .expect("runtime image must install packages via `apk add --no-cache`"); | |
| let mut has_jq = false; | |
| let mut has_yq_go = false; | |
| for token in runtime_apk_line.split_whitespace() { | |
| if token == "jq" { | |
| has_jq = true; | |
| } else if token == "yq-go" { | |
| has_yq_go = true; | |
| } | |
| } | |
| assert!( | |
| has_jq && has_yq_go, |
| #[test] | ||
| fn runtime_image_contains_jq_and_yq() { |
There was a problem hiding this comment.
For consistency with the other crates/cli/tests/* contract/golden/integration test files, consider adding a brief module-level //! doc comment describing what this contract test is protecting (and why it exists).
|
Addressed the review feedback in commit 3d548cf:
Re-ran |
|
Oh wow. Fixed without even a discussion. Thank you ❤️ |
Summary
jqandyq-goto the runtime image inDockerfilerustfs/cliissue Could we add jq/yq to the image? #43Problem Validation
docker run --rm --entrypoint sh rustfs/rc:latest -lc 'jq --version; yq --version'not foundRoot Cause
The runtime stage installed only
ca-certificates, sojqandyqwere unavailable in the container.Fix
apk add --no-cache ca-certificates jq yq-goSimilar Cases Checked
Dockerfilebuilds the published CLI image.Verification
cargo fmt --all --checkcargo clippy --workspace --all-targets -- -D warningscargo test --workspacedocker run --rm --entrypoint sh rustfs/rc:latest -lc 'jq --version; yq --version'(repro before fix)Linked Issue
Fixes #43