Skip to content

Switch to the new Teams API#1395

Merged
bitwiseman merged 2 commits intohub4j:mainfrom
gsmet:teams-sunset
Mar 5, 2022
Merged

Switch to the new Teams API#1395
bitwiseman merged 2 commits intohub4j:mainfrom
gsmet:teams-sunset

Conversation

@gsmet
Copy link
Copy Markdown
Contributor

@gsmet gsmet commented Mar 4, 2022

Copy link
Copy Markdown
Contributor Author

@gsmet gsmet left a comment

Choose a reason for hiding this comment

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

@bitwiseman this PR is time sensitive as GitHub will do another brownout on March 8th (see https://github.blog/changelog/2022-02-22-sunset-notice-deprecated-teams-api-endpoints/).

It's probably a good idea to get something released before that.

Comment on lines -888 to -891
@Deprecated
public GHTeam getTeam(int id) throws IOException {
return createRequest().withUrlPath("/teams/" + id).fetch(GHTeam.class).wrapUp(this);
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I decided to remove this method as even if it could work for old GH Entreprise instances, you would end up with a dead end and an object that can't do anything useful.

I can adjust if you prefer I keep it and throw an exception or if you prefer keeping it altogether.

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.

We must preserve API compatibility. Feel free to have it throw if needed.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 4, 2022

Codecov Report

Merging #1395 (5ff0e46) into main (358f4ee) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #1395      +/-   ##
============================================
+ Coverage     78.10%   78.11%   +0.01%     
- Complexity     2046     2047       +1     
============================================
  Files           200      200              
  Lines          6271     6274       +3     
  Branches        355      355              
============================================
+ Hits           4898     4901       +3     
  Misses         1165     1165              
  Partials        208      208              
Impacted Files Coverage Δ
src/main/java/org/kohsuke/github/GHTeam.java 62.96% <100.00%> (+1.42%) ⬆️
src/main/java/org/kohsuke/github/GitHub.java 82.35% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 358f4ee...5ff0e46. Read the comment docs.

@bitwiseman
Copy link
Copy Markdown
Member

@gsmet
We need to know if there are "supported" (by GitHub) versions of GHE that still use the old endpoints. If so, then we need to add fallback behavior that tries the new endpoints and then falls back to the old endpoints if they get an exception.

First step is to determine what is the oldest version of GHE that supports the new endpoints.

@gsmet
Copy link
Copy Markdown
Contributor Author

gsmet commented Mar 4, 2022

My assumption was that they would continue to use older versions of the GitHub API.
I doubt we will be able to get this information, except if you have contacts at GitHub but my guess is it will take time and time is not our friend in this case.

I can try to maintain the old behavior but I won't be able to test it though.

@bitwiseman
Copy link
Copy Markdown
Member

Wow. It looks like they have gotten aggressive about deprecation. 3.1 is the oldest currently supported version.

https://docs.github.com/en/enterprise-server@3.4/admin/all-releases

@gsmet
Copy link
Copy Markdown
Contributor Author

gsmet commented Mar 4, 2022

AFAICS, they already removed the old teams endpoint in 3.1.

@bitwiseman
Copy link
Copy Markdown
Member

So, in short, all we need is to revert the method removal and we're good.

@gsmet
Copy link
Copy Markdown
Contributor Author

gsmet commented Mar 4, 2022

Yeah I'm doing that as we speak.

@gsmet
Copy link
Copy Markdown
Contributor Author

gsmet commented Mar 4, 2022

@bitwiseman done!

@bitwiseman bitwiseman merged commit 3c89285 into hub4j:main Mar 5, 2022
@gsmet
Copy link
Copy Markdown
Contributor Author

gsmet commented Mar 5, 2022

@bitwiseman do you plan a new release before the next brownout of March 8th?

Personally I don't use this API but some users asked for it.

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.

Update GHTeam APIs to not use deprecated urls - 15th March effective

2 participants