Skip to content

feat(github): add blob caching with RWMutex#2601

Draft
theakshaypant wants to merge 2 commits intotektoncd:mainfrom
theakshaypant:feat-2376
Draft

feat(github): add blob caching with RWMutex#2601
theakshaypant wants to merge 2 commits intotektoncd:mainfrom
theakshaypant:feat-2376

Conversation

@theakshaypant
Copy link
Member

📝 Description of the Change

Implement in-memory blob caching for GitHub provider to reduce duplicate API calls. Cache is thread-safe using RWMutex to allow concurrent reads while ensuring exclusive writes.

Fix tests to use New() factory pattern for proper cache init
Fix ambiguous mutex selector in canIUseCheckrunID()

🔗 Linked GitHub Issue

Fixes #2376

🧪 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.
  • 🧪 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

Implement in-memory blob caching for GitHub provider to reduce
duplicate API calls. Cache is thread-safe using RWMutex to allow
concurrent reads while ensuring exclusive writes.

Fix tests to use New() factory pattern for proper cache init
Fix ambiguous mutex selector in canIUseCheckrunID()

Fixes tektoncd#2376

Signed-off-by: Akshay Pant <akpant@redhat.com>
E2E instrumentation was broken because it searched for the
controller in the test namespace (e.g., pac-e2e-ns-*), but
controllers actually run in installation namespaces
(pipelines-as-code or openshift-pipelines).

The fix iterates through info.InstallNamespaces to find the
controller, restoring the original behavior that searched across
all namespaces. Also fixed linter warning (interface{} to any).

Signed-off-by: Akshay Pant <akpant@redhat.com>
Assisted-by: Claude <noreply@anthropic.com>
@chmouel
Copy link
Member

chmouel commented Mar 23, 2026

I think this is going to increase memory more than decrease?

@theakshaypant
Copy link
Member Author

theakshaypant commented Mar 23, 2026

I think this is going to increase memory more than decrease?

This is unrelated to the memory issue but focused on the API optimizations.

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.

Add blob caching to GitHub provider to reduce duplicate API calls

2 participants