Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ RUN cargo build --release

FROM alpine:3.23

# Install CA certificates for HTTPS
RUN apk add --no-cache ca-certificates
# Install runtime tools:
# - ca-certificates for HTTPS
# - jq/yq-go for Kubernetes-oriented config processing workflows
RUN apk add --no-cache ca-certificates jq yq-go

COPY --from=builder /app/target/release/rc /usr/bin/rc
COPY --from=builder /app/LICENSE-* /licenses/
Expand Down
9 changes: 9 additions & 0 deletions crates/cli/tests/dockerfile_contract.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#[test]
fn runtime_image_contains_jq_and_yq() {
Comment on lines +3 to +4

Copilot AI Mar 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
let dockerfile = include_str!("../../../Dockerfile");

assert!(
dockerfile.contains("apk add --no-cache ca-certificates jq yq-go"),

Copilot AI Mar 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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,

Copilot uses AI. Check for mistakes.
"runtime image must install jq and yq-go"
);
}