Skip to content

feat(gitea): add API retry support for Gitea/Forgejo provider - #2933

Open
infernus01 wants to merge 1 commit into
tektoncd:mainfrom
infernus01:gitea-api-retry
Open

feat(gitea): add API retry support for Gitea/Forgejo provider#2933
infernus01 wants to merge 1 commit into
tektoncd:mainfrom
infernus01:gitea-api-retry

Conversation

@infernus01

Copy link
Copy Markdown
Member

📝 Description of the Change

  • Adds a retryhttp package providing a provider-agnostic HTTP retry
    transport that handles 429, rate-limited 403s, and 5xx on idempotent
    methods with jittered exponential backoff
  • Adds three configmap settings (enable-api-retry,
    api-retry-max-attempts, api-retry-max-wait-seconds) to control
    retry behavior
  • Wires the Gitea/Forgejo provider to use the retry transport when
    enable-api-retry is enabled, covering all 21 API call sites

🔗 Linked GitHub Issue

Extends PR #2854 to cover Gitea/Forgejo. PR #2854 adds retry support
for GitHub and GitLab but does not cover Gitea/Forgejo.
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.
  • 🧪 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 Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.78%. Comparing base (aeed7ee) to head (59a9f4d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2933      +/-   ##
==========================================
+ Coverage   80.66%   80.78%   +0.11%     
==========================================
  Files         164      164              
  Lines       13910    13918       +8     
==========================================
+ Hits        11221    11244      +23     
+ Misses       1967     1948      -19     
- Partials      722      726       +4     
Flag Coverage Δ
unit-tests 80.78% <100.00%> (+0.11%) ⬆️

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.

@zakisk

zakisk commented Aug 25, 2026

Copy link
Copy Markdown
Member

can you please check Chmouel's PR about this and add unit tests wherever needed

@theakshaypant theakshaypant 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.

+1 on Zaki's comment, adding a retry_test similar to github and gitlab would be nice.

Comment thread pkg/provider/gitea/gitea.go
@infernus01

Copy link
Copy Markdown
Member Author

/retest

@theakshaypant theakshaypant 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.

Thanks for addressing the earlier comments.
docs/content/docs/api/configmap.md under heading API Retry should also be updated. It currently only lists GitHub and GitLab as platform supporting this feature.

  When enable-api-retry is enabled in the PaC configmap, the Gitea/Forgejo
  provider wraps its HTTP client with a retry transport that handles rate
  limits (429), rate-limited 403s, and transient 5xx errors on idempotent
  requests. This brings Gitea/Forgejo to parity with the GitHub and GitLab
  retry support added in PR tektoncd#2854.

Signed-off-by: Shubham Bhardwaj <shubbhar@redhat.com>
@infernus01

Copy link
Copy Markdown
Member Author

Thanks for addressing the earlier comments. docs/content/docs/api/configmap.md under heading API Retry should also be updated. It currently only lists GitHub and GitLab as platform supporting this feature.

Yeah thanks, added

@infernus01

Copy link
Copy Markdown
Member Author

/retest

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.

3 participants