Skip to content

Conversation

@dkarpele
Copy link
Collaborator

@dkarpele dkarpele commented Nov 5, 2025

  • Configure the global logger for argo-cd utilities in run.go. This will solve the problem with log formatting for "git" log messages. With the flag --logformat=json log will look like:
{"level":"info","msg":"Initializing https://e2e-repository:8081/testdata.git to /var/folders/2j/0pgmqhq95pv6l80wmfl7fdxc0000gn/T/git-image-updater-0071725550356","time":"2025-11-05T18:48:29+01:00"}
{"application":"image-updater-007","level":"trace","msg":"targetRevision for update is 'master'","time":"2025-11-05T18:48:29+01:00"}
{"dir":"/var/folders/2j/0pgmqhq95pv6l80wmfl7fdxc0000gn/T/git-image-updater-0071725550356","execID":"95870","level":"info","msg":"git fetch origin master --force --prune --depth 1","time":"2025-11-05T18:48:29+01:00"}
{"duration":19089291,"execID":"95870","level":"debug","msg":"","time":"2025-11-05T18:48:29+01:00"}
{"execID":"95870","level":"error","msg":"`git fetch origin master --force --prune --depth 1` failed exit status 128: fatal: unable to access 'https://e2e-repository:8081/testdata.git/': Could not resolve host: e2e-repository","time":"2025-11-05T18:48:29+01:00"}

Summary by CodeRabbit

  • Refactor
    • Improved logging initialization to apply consistent log levels and formatting throughout the application.

Signed-off-by: dkarpele <karpelevich@gmail.com>
@codecov-commenter
Copy link

codecov-commenter commented Nov 5, 2025

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.20%. Comparing base (5ed9f6d) to head (8d1316f).

Files with missing lines Patch % Lines
cmd/run.go 0.00% 5 Missing ⚠️
Additional details and impacted files
@@                     Coverage Diff                     @@
##           master-annotation-based    #1322      +/-   ##
===========================================================
- Coverage                    72.26%   72.20%   -0.07%     
===========================================================
  Files                           45       45              
  Lines                         4255     4259       +4     
===========================================================
  Hits                          3075     3075              
- Misses                        1011     1015       +4     
  Partials                       169      169              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dkarpele dkarpele linked an issue Nov 5, 2025 that may be closed by this pull request
@dkarpele
Copy link
Collaborator Author

dkarpele commented Nov 6, 2025

@coderabbitai help

@coderabbitai
Copy link

coderabbitai bot commented Nov 6, 2025

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

CodeRabbit commands

These commands are invoked using PR/Issue comments.

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai evaluate custom pre-merge check --instructions <custom-checks-instructions> --name <custom-checks-title> [--mode <error|warning>] to validate the custom pre-merge checks instructions. Defaults to error when --mode is omitted.
    • @coderabbitai ignore pre-merge checks to override pre-merge checks and get an approval on PR.
    • @coderabbitai run pre-merge checks to run pre-merge checks on the pull request.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit configuration file (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, support, documentation and community

  • Visit our status page to check the current availability of CodeRabbit.
  • Create a ticket on our support page for assistance with any issues or questions.
  • Visit our documentation site for detailed information on how to use CodeRabbit.
  • Join our Discord community to connect with other users and get help from the community.
  • Follow us on X/Twitter for updates and announcements.

@dkarpele
Copy link
Collaborator Author

dkarpele commented Nov 6, 2025

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Nov 6, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link

coderabbitai bot commented Nov 6, 2025

Walkthrough

The changes migrate the codebase's logging system from logrus to an internal logging package. Global logging configuration is added to command initialization, and logging calls throughout git utilities are updated to use the new logger's API with context-aware field chaining and format specifiers.

Changes

Cohort / File(s) Summary
Global logging initialization
cmd/run.go
Adds log level parsing and formatter setup at command start; removes locally scoped error variable before Kubernetes client initialization
Internal logging package migration
ext/git/client.go, ext/git/creds.go
Removes logrus imports and adds internal log package; updates log calls to use new API (e.g., log.Debug()log.Debugf(), WithFields()WithContext().AddField())

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Rationale: Homogeneous logging refactor pattern applied consistently across 3 files with no functional behavior changes or control flow modifications. Changes are straightforward import swaps and logging call reformatting following a predictable convention.

Poem

🐰 Hoppy logs now flow with grace,
No more logrus in this place!
Context fields and format cheer,
Internal logging, crystal clear! 🌟

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: configuring the global logger for Argo CD utilities, which aligns with the primary objective of fixing log formatting for git log messages across the codebase.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5ed9f6d and 8d1316f.

📒 Files selected for processing (3)
  • cmd/run.go (2 hunks)
  • ext/git/client.go (2 hunks)
  • ext/git/creds.go (3 hunks)
🔇 Additional comments (7)
ext/git/client.go (2)

37-38: LGTM! Logging migration aligns with PR objectives.

The import change from logrus to the internal log package is consistent with the PR's goal of configuring a global logger for Argo CD utilities.


493-493: LGTM! Correct usage of format specifier.

The change from log.Debug to log.Debugf with a format string is the correct approach for the new logging API.

ext/git/creds.go (3)

29-30: LGTM! Consistent logging migration.

The import change aligns with the logging migration across the codebase.


290-293: LGTM! Security context preserved in logging migration.

The migration to WithContext().AddField() chaining correctly preserves the security-related fields (SecurityField, SecurityCWEField) for monitoring file descriptor leaks. The format string usage with Errorf is appropriate.


308-308: ****

The log package used (registry-scanner/pkg/log) only exports formatted logging methods: Debugf, Infof, Warnf, and Errorf. There is no plain Warn() method available in the API. The code at line 308 correctly uses log.Warnf(), which is the required method for this package. Using Warnf() with a plain string (without format specifiers) is the correct and only way to invoke warning logs with this logger.

Likely an incorrect or invalid review comment.

cmd/run.go (2)

26-28: LGTM! Appropriate imports for global logger configuration.

The imports of Argo CD's log utility and logrus are necessary for configuring the global logger. The argocdlog alias appropriately avoids naming conflicts with the internal log package.


52-58: LGTM! Global logger configuration correctly implements PR objectives.

This configuration block properly sets up the global logrus logger for vendored Argo CD utilities, which will fix the log formatting for git-related messages as described in the PR. The implementation includes:

  • Proper error handling for log level parsing
  • Configuration of both log level and formatter
  • Correct placement before other logging setup

Comment @coderabbitai help to get the list of available commands and usage tips.

@dkarpele
Copy link
Collaborator Author

dkarpele commented Nov 6, 2025

@coderabbitai configuration

@coderabbitai
Copy link

coderabbitai bot commented Nov 6, 2025

CodeRabbit configuration
language: en-US
tone_instructions: ''
early_access: false
enable_free_tier: true
reviews:
  profile: chill
  request_changes_workflow: false
  high_level_summary: true
  high_level_summary_placeholder: '@coderabbitai summary'
  high_level_summary_in_walkthrough: false
  auto_title_placeholder: '@coderabbitai'
  auto_title_instructions: ''
  review_status: true
  commit_status: true
  fail_commit_status: false
  collapse_walkthrough: false
  changed_files_summary: true
  sequence_diagrams: true
  estimate_code_review_effort: true
  assess_linked_issues: true
  related_issues: true
  related_prs: true
  suggested_labels: true
  labeling_instructions: []
  auto_apply_labels: false
  suggested_reviewers: true
  auto_assign_reviewers: false
  in_progress_fortune: true
  poem: true
  path_filters: []
  path_instructions: []
  abort_on_close: true
  disable_cache: false
  auto_review:
    enabled: true
    auto_incremental_review: true
    ignore_title_keywords: []
    labels: []
    drafts: false
    base_branches: []
    ignore_usernames: []
  finishing_touches:
    docstrings:
      enabled: true
    unit_tests:
      enabled: true
  pre_merge_checks:
    docstrings:
      mode: warning
      threshold: 80
    title:
      mode: warning
      requirements: ''
    description:
      mode: warning
    issue_assessment:
      mode: warning
    custom_checks: []
  tools:
    ast-grep:
      rule_dirs: []
      util_dirs: []
      essential_rules: true
      packages: []
    shellcheck:
      enabled: true
    ruff:
      enabled: true
    markdownlint:
      enabled: true
    github-checks:
      enabled: true
      timeout_ms: 90000
    languagetool:
      enabled: true
      enabled_rules: []
      disabled_rules: []
      enabled_categories: []
      disabled_categories: []
      enabled_only: false
      level: default
    biome:
      enabled: true
    hadolint:
      enabled: true
    swiftlint:
      enabled: true
    phpstan:
      enabled: true
      level: default
    phpmd:
      enabled: true
    phpcs:
      enabled: true
    golangci-lint:
      enabled: true
    yamllint:
      enabled: true
    gitleaks:
      enabled: true
    checkov:
      enabled: true
    detekt:
      enabled: true
    eslint:
      enabled: true
    flake8:
      enabled: true
    rubocop:
      enabled: true
    buf:
      enabled: true
    regal:
      enabled: true
    actionlint:
      enabled: true
    pmd:
      enabled: true
    clang:
      enabled: true
    cppcheck:
      enabled: true
    semgrep:
      enabled: true
    circleci:
      enabled: true
    clippy:
      enabled: true
    sqlfluff:
      enabled: true
    prismaLint:
      enabled: true
    pylint:
      enabled: true
    oxc:
      enabled: true
    shopifyThemeCheck:
      enabled: true
    luacheck:
      enabled: true
    brakeman:
      enabled: true
    dotenvLint:
      enabled: true
    htmlhint:
      enabled: true
    checkmake:
      enabled: true
    osvScanner:
      enabled: true
chat:
  art: true
  auto_reply: true
  integrations:
    jira:
      usage: auto
    linear:
      usage: auto
knowledge_base:
  opt_out: false
  web_search:
    enabled: true
  code_guidelines:
    enabled: true
    filePatterns: []
  learnings:
    scope: auto
  issues:
    scope: auto
  jira:
    usage: auto
    project_keys: []
  linear:
    usage: auto
    team_keys: []
  pull_requests:
    scope: auto
  mcp:
    usage: auto
    disabled_servers: []
code_generation:
  docstrings:
    language: en-US
    path_instructions: []
  unit_tests:
    path_instructions: []

@chengfang chengfang merged commit 6069873 into argoproj-labs:master-annotation-based Nov 11, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--logfomat only works for some log

3 participants