Skip to content

fix(logging): log sinker errors , emit event on repository config error#2848

Open
aThorp96 wants to merge 1 commit into
tektoncd:mainfrom
aThorp96:repo-events-on-missing-secrets
Open

fix(logging): log sinker errors , emit event on repository config error#2848
aThorp96 wants to merge 1 commit into
tektoncd:mainfrom
aThorp96:repo-events-on-missing-secrets

Conversation

@aThorp96

Copy link
Copy Markdown
Member

📝 Description of the Change

Since sinker.logger is modified during sinker.processEvent(), if an error is returned from processEvent() it lacks these modifications (i.e. added context, like repository URL or commit sha)

This change also improves the logging when PaC fails to process an event due to a misconfigured Repository CR. Specifically, when the required GitProvider.Secret is either unspecified or missing PaC will now emit an Event on the Repository CR. Events are a clearer signal to users than logs since tenants may be given access to events in their namespace whereas PaC logs are considered more sensitive

🔗 Linked GitHub Issue

Fixes #

🧪 Testing Strategy

  • Unit tests
  • Integration tests
  • End-to-end tests
  • Manual testing
  • Not Applicable

🤖 AI Assistance

AI assistance can be used for various tasks, such as code generation,
documentation, or testing.

Please indicate whether you have used AI assistance
for this PR and provide details if applicable.

  • I have not used any AI assistance for this PR.
  • I have used AI assistance for this PR.

Important

Slop will be simply rejected, if you are using AI assistance you need to make sure you
understand the code generated and that it meets the project's standards. you
need at least know how to run the code and deploy it (if needed). See
startpaac to make it easy
to deploy and test your code changes.

If the majority of the code in this PR was generated by an AI, please add a Co-authored-by trailer to your commit message.
For example:

Co-authored-by: Claude noreply@anthropic.com

✅ Submitter Checklist

  • 📝 My commit messages are clear, informative, and follow the project's How to write a git commit message guide. The Gitlint linter ensures in CI it's properly validated
  • ✨ I have ensured my commit message prefix (e.g., fix:, feat:) matches the "Type of Change" I selected above.
  • ♽ I have run make test and make lint locally to check for and fix any
    issues. For an efficient workflow, I have considered installing
    pre-commit and running pre-commit install to
    automate these checks.
  • 📖 I have added or updated documentation for any user-facing changes.
  • [ x 🧪 I have added sufficient unit tests for my code changes.
  • 🎁 I have added end-to-end tests where feasible. See README for more details.
  • 🔎 I have addressed any CI test flakiness or provided a clear reason to bypass it.
  • If adding a provider feature, I have filled in the following and updated the provider documentation:
    • GitHub App
    • GitHub Webhook
    • Gitea/Forgejo
    • GitLab
    • Bitbucket Cloud
    • Bitbucket Data Center

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 58.82353% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.67%. Comparing base (85b606b) to head (73b9368).

Files with missing lines Patch % Lines
pkg/adapter/sinker.go 41.66% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2848      +/-   ##
==========================================
+ Coverage   61.62%   61.67%   +0.05%     
==========================================
  Files         213      213              
  Lines       17512    17523      +11     
==========================================
+ Hits        10792    10808      +16     
- Misses       5901     5902       +1     
+ Partials      819      813       -6     
Flag Coverage Δ
unit-tests 61.67% <58.82%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new sentinel error ErrSecretNotFound in the secrets package and wraps repository secret retrieval errors with it. In the event sinker, if client setup fails due to a missing repository secret, a Kubernetes event is now emitted to notify the user. Additionally, a wrapper method handleEvent was added to centralize event processing error logging, and comprehensive unit tests were added to verify the new error handling behavior. There are no review comments, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Since `sinker.logger` is modified during `sinker.processEvent()`, if an
error is returned from `processEvent()` it lacks these modifications
(i.e. added context, like repository URL or commit sha)

This change also improves the logging when PaC fails to process an event
due to a misconfigured Repository CR. Specifically, when the required
GitProvider.Secret is either unspecified or missing PaC will now emit an
Event on the Repository CR. Events are a clearer signal to users than
logs since tenants may be given access to events in their namespace
whereas PaC logs are considered more sensitive
@aThorp96 aThorp96 force-pushed the repo-events-on-missing-secrets branch from 9bda827 to 73b9368 Compare July 10, 2026 19:33
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.

1 participant