Skip to content

fix: add log-level option to install-rhdh-catalog-source.sh - #3653

Merged
rm3l merged 6 commits into
redhat-developer:mainfrom
NiallTwomey2:RHDHBUGS-2638-catalog-source-log-level
Oct 28, 2026
Merged

rm3l merged 6 commits into
redhat-developer:mainfrom
NiallTwomey2:RHDHBUGS-2638-catalog-source-log-level

Conversation

@NiallTwomey2

@NiallTwomey2 NiallTwomey2 commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Description

install-rhdh-catalog-source.sh always printed DEBUG, which made successful and failed runs too noisy.

This adds --log-level error|warn|info|debug (default info) and --debug as a shorthand for --log-level debug. DEBUG is hidden unless debug is requested. --help is handled before cluster checks. On command failure, captured log lines are dumped when the ERR trap fires.

Docs in .rhdh/docs/installing-ci-builds.adoc mention the quieter default and how to turn debug back on.

Which issue(s) does this PR fix or relate to

PR acceptance criteria

  • Tests
  • Documentation

.rhdh/scripts/install-rhdh-catalog-source.sh --help
Expect --log-level and --debug in Options, exit 0, no cluster/OLM errors.

.rhdh/scripts/install-rhdh-catalog-source.sh --log-level noisy --latest
Expect [ERROR] Unknown log level: noisy and usage.

.rhdh/scripts/install-rhdh-catalog-source.sh --latest
Expect [ERROR] only (for example OLM not installed). No [DEBUG].

.rhdh/scripts/install-rhdh-catalog-source.sh --debug --latest
Expect the same error plus [DEBUG] lines (working dir, cluster detection).

--log-level debug --latest should match --debug --latest.

Do not use -v for verbose; -v is still the RHDH version flag.

Container Images

Container images are built and pushed to Quay automatically when relevant files change.
Image links will be posted in a PR comment once the push completes.

@NiallTwomey2
NiallTwomey2 requested a review from a team as a code owner September 29, 2026 13:36
@NiallTwomey2

Copy link
Copy Markdown
Member Author

/agentic_review

1 similar comment
@rm3l

rm3l commented Oct 4, 2026

Copy link
Copy Markdown
Member

/agentic_review

@rhdh-qodo-merge

rhdh-qodo-merge Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Code Review by Qodo


Resolved findings
1. Explicit failures skip the log dump ⊘ Outdated
Description
dump_logs_on_error is registered only for ERR, which Bash does not invoke for an explicit `exit
1`. When a cluster check or OLM validation logs an error and exits, the cleanup trap removes
install.log without running the new dump handler.
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The `ERR` trap misses the script's explicit nonzero exits, and cleanup deletes their captured log.

## Fix Focus Areas
- .rhdh/scripts/install-rhdh-catalog-source.sh[171-177]
- .rhdh/scripts/install-rhdh-catalog-source.sh[848-857]

## Recommended Fix
Run the dump handler from an `EXIT` handler on nonzero status before removing the temporary directory, and avoid dumping twice when an `ERR` trap has already run.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Lower log levels still print routine messages ✓ Resolved
Description
--log-level sets LOG_LEVEL, but only debugf checks it; infof and warnf still call logf
unconditionally. With --log-level error, normal OLM detection and image-selection messages still
print, and --log-level warn likewise leaves informational messages visible.
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`--log-level error` and `--log-level warn` do not suppress lower-priority messages because only `debugf` checks `LOG_LEVEL`.

## Fix Focus Areas
- .rhdh/scripts/install-rhdh-catalog-source.sh[31-64]
- .rhdh/scripts/install-rhdh-catalog-source.sh[952-971]

## Recommended Fix
Apply a consistent severity threshold to info, warning, and debug messages while always emitting errors. Keep the requested behavior of dumping captured messages on qualifying failures.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



@rm3l rm3l left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The Qodo findings are also valid and worth fixing

Comment thread .rhdh/docs/installing-ci-builds.adoc Resolved
@NiallTwomey2
NiallTwomey2 requested a review from rm3l October 5, 2026 14:20
@NiallTwomey2

Copy link
Copy Markdown
Member Author

/agentic_review

@rhdh-qodo-merge

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 4ab6108

@NiallTwomey2
NiallTwomey2 requested a review from rm3l October 15, 2026 09:09
@NiallTwomey2
NiallTwomey2 force-pushed the RHDHBUGS-2638-catalog-source-log-level branch from f6d23e5 to ff04aeb Compare October 20, 2026 11:22
Co-authored-by: Armel Soro <armel@rm3l.org>
@sonarqubecloud

Copy link
Copy Markdown

@openshift-ci openshift-ci Bot added the lgtm label Oct 28, 2026
@rm3l
rm3l merged commit a774c01 into redhat-developer:main Oct 28, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants