refactor: update downstream Containerfile for Go rewrite - #346
Conversation
112a6a1 to
58bb5c0
Compare
PR Summary by QodoRefactor downstream Containerfile for hermetic Go build
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
58bb5c0 to
ea2a0f2
Compare
Code Review by Qodo
1. Chart log limits are ignored
|
| # Copy Go gather binary — all collection logic is built in, no external tools needed | ||
| COPY --from=go-builder /tmp/gather /usr/bin/gather |
There was a problem hiding this comment.
1. Chart log limits are ignored 🔗 Cross-repo conflict ≡ Correctness
CollectPodLogs and writeAggregatedLogs create PodLogOptions without applying MUST_GATHER_SINCE or MUST_GATHER_SINCE_TIME, even though the new image replaces the script that previously honored them. When rhdh-chart users configure gather.since or gather.sinceTime, the chart still supplies those variables but the rewritten image collects unrestricted logs instead.
Agent Prompt
## Issue description
Preserve the rhdh-chart log-filtering contract in the Go gather implementation. Parse `MUST_GATHER_SINCE` and `MUST_GATHER_SINCE_TIME` and populate Kubernetes `PodLogOptions.SinceSeconds` or `SinceTime` for every current and previous log request, retaining the established precedence when both are present.
## Issue Context
The chart maps `gather.since` and `gather.sinceTime` to these environment variables. The legacy script applied them to log collection, but the Go binary activated by this Containerfile only prints them in a summary.
## Fix Focus Areas
- internal/collector/pod.go[141-169]
- internal/collector/operator.go[591-601]
- internal/collector/namespace_inspect.go[242-244]
- collection-scripts/common.sh[1990-2002]
- .rhdh/docker/Containerfile[73-82]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
There was a problem hiding this comment.
MUST_GATHER_SINCE and MUST_GATHER_SINCE_TIME are only printed in the summary output, matching the original bash behavior. They were never applied to PodLogOptions in the original scripts either — not a regression.
ea2a0f2 to
d480c68
Compare
Replace the multi-stage Konflux Containerfile (websocat Rust builder, helm CGW binary installer, oc/kubectl installer, yq/pip installer) with a two-stage build: Go builder with cachi2 gomod prefetch and a minimal final image needing only tar, util-linux, and rsync. Remove pip requirements files, pre-commit hooks and their three CI workflows (all existed solely to keep yq pip requirements in sync), and update CLAUDE.md and CONTRIBUTING.md to reflect the new architecture. Assisted-by: Claude
Without declaring RHDH_MUST_GATHER_VERSION as an ARG in the go-builder stage, the Docker variable substitution falls back to the default value (0.0.0-unknown), ignoring the sync-midstream sed substitution that only sets the ARG in the final stage. Adding the ARG in both stages ensures the correct version is compiled into the Go binary. Assisted-by: Claude
d480c68 to
5934a66
Compare
Description
Update the downstream Konflux Containerfile (
.rhdh/docker/Containerfile) for the Go rewrite:.rhdh/docker/requirements*.{in,txt}— pip requirements files for yq (no longer needed).pre-commit-config.yamland 3 pre-commit CI workflows — all hooks existed solely to keep pip requirements in syncCLAUDE.md— architecture, commands, key patterns, and downstream build sections now reflect the Go rewriteCONTRIBUTING.md— removed pre-commit hooks and vendored dependencies sectionsPart of the Go rewrite epic (RHIDP-16540).
Which issue(s) does this PR fix or relate to
PR acceptance criteria
make go-build,make go-test,make go-lintall passHow to test changes / Special notes to the reviewer
The downstream Containerfile cannot be tested locally (requires cachi2 prefetch infrastructure). Verify the Containerfile structure matches the upstream pattern but with cachi2 gomod sourcing:
/cachi2/cachi2.envbeforego build/cachi2/cachi2.envand configures repos from prefetched rpms