Skip to content

fix: allow to use an entreprise GIthub instance and an authentication token in the same time again #23129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

foyerunix
Copy link
Contributor

Hello,

This PR fix a regression introduced in #21292.
Before that, we were able to use both an URL and also an authentication token.

Best Regards.

@foyerunix foyerunix requested a review from a team as a code owner May 23, 2025 12:17
Copy link

bunnyshell bot commented May 23, 2025

🔴 Preview Environment stopped on Bunnyshell

See: Environment Details | Pipeline Logs

Available commands (reply to this comment):

  • 🔵 /bns:start to start the environment
  • 🚀 /bns:deploy to redeploy the environment
  • /bns:delete to remove the environment

@foyerunix foyerunix force-pushed the fix-githubservice-regression branch 2 times, most recently from e094938 to f8a68e4 Compare May 23, 2025 13:09
@crenshaw-dev
Copy link
Member

Should this be unit tested?

Copy link

codecov bot commented May 23, 2025

Codecov Report

Attention: Patch coverage is 75.00000% with 3 lines in your changes missing coverage. Please review.

Please upload report for BASE (master@0484f9f). Learn more about missing BASE report.
Report is 27 commits behind head on master.

Files with missing lines Patch % Lines
applicationset/services/pull_request/github.go 72.72% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master   #23129   +/-   ##
=========================================
  Coverage          ?   60.05%           
=========================================
  Files             ?      343           
  Lines             ?    57887           
  Branches          ?        0           
=========================================
  Hits              ?    34766           
  Misses            ?    20339           
  Partials          ?     2782           

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

@foyerunix foyerunix force-pushed the fix-githubservice-regression branch 2 times, most recently from 62e4509 to e2f4245 Compare May 26, 2025 07:36
This commit fix a regresssion introduced in:
argoproj#21292

Before that, we were able to use both an URL and
also an authentication token.

Signed-off-by: foyerunix <[email protected]>
@foyerunix foyerunix force-pushed the fix-githubservice-regression branch from e2f4245 to 85019ea Compare May 26, 2025 07:45
@foyerunix
Copy link
Contributor Author

Hello @crenshaw-dev,

I tried hard to implement an unit test without changing the definition of the NewGithubService function.

First I tried to check if the URL and the token were correctly set by inspecting the internals of the http.Client, but I couldn't correctly test for the token and it was brittle. Then I tried with a test HTTP server, but I couldn't make it work this way also.

Therefore I ended adding an optional http.Client argument to the NewGithubService function, this let me mock the Transport so I can inspect both the URL and the token.

Best Regards.

@olivergondza
Copy link
Contributor

I confirm this fixes the bug. The code looks good to me as well...

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