Skip to content
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

Fix #16: Added support for GitHub Enterprise instances #51

Merged
merged 11 commits into from
Nov 18, 2023

Conversation

anenviousguest
Copy link
Contributor

@anenviousguest anenviousguest commented Nov 13, 2023

This RP adds support for customizing the GitHub API endpoint. This is needed if we want to publish releases to GitHub Enterprise instances hosted inside organizations.

The endpoint is inferred based on the <scm> connection string and falls back to a regular public one (https://api.github.com).

It should resolve #16.

@@ -201,7 +201,7 @@
<dependency>
<groupId>org.kohsuke</groupId>
<artifactId>github-api</artifactId>
<version>1.95</version>
<version>1.317</version>
Copy link
Contributor Author

@anenviousguest anenviousguest Nov 13, 2023

Choose a reason for hiding this comment

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

1.95 was using the hard-coded string URL for uploading the artifacts (upload.github.com), despite of the endpoint customization via GitHub builder. So I simply upgraded to the most recent version where URL customization has been fixed.

@@ -222,6 +222,11 @@
<version>3.5.4</version>
<scope>provided</scope>
</dependency>
<dependency>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

From Maven 3.9.0 and onwards, plexus-utils is no longer placed to plugin classpath by default (see release notes), so I had to add this one to ensure the code can run also when using recent Maven versions, which is the case in our environment.

3.2.1 is the one which works with maven-plugins-api of version 3.6.2 used by this plugin. See dependency page.

@anenviousguest anenviousguest changed the title Added support for private GitHub instances Fix #16: Added support for private GitHub instances Nov 13, 2023
@@ -48,7 +48,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.7</java.version>
<java.version>1.8</java.version>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

1.7 is officially EOL by Oracle since 2022 and EOL by OpenJDK since 2020.

Also maven-plugin-api from 3.1.0 onward requires JDK 8

Besides that, it hinders the usage of JUnit 5 which makes writing parameterized tests so much easier.

@@ -270,7 +278,7 @@ private GHRelease findRelease(GHRepository repository, String releaseNameToFind)
*/
private static final Pattern REPOSITORY_PATTERN = Pattern.compile(
"^(scm:git[:|])?" + //Maven prefix for git SCM
"(https?://github\\.com/|git@github\\.com:)" + //GitHub prefix for HTTP/HTTPS/SSH/Subversion scheme
"(https?://[\\w\\d.-]+/|git@[\\w\\d.-]+:)" + //GitHub prefix for HTTP/HTTPS/SSH/Subversion scheme
Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed to allow other hostnames. Alphanumeric, dots, dashes. Not perfect but better than nothing.

@anenviousguest
Copy link
Contributor Author

@jutzig I tested the public part with my fork of this repo, and the enterprise part within our organization, both work well.

Thus far I published this version to our internal maven central mirror so that people in our org can start using it, but would appreciate a review and an official release as well.

Thank you.

@anenviousguest anenviousguest changed the title Fix #16: Added support for private GitHub instances Fix #16: Added support for GitHub Enterprise instances Nov 14, 2023
@jutzig
Copy link
Owner

jutzig commented Nov 14, 2023

@anenviousguest thank you very much for the pull request, looks great 👍
I'm a little swamped right now, so I can't thoroughly review the changes today, but I think I'll find some time on the weekend to merge and create a new release.
Thanks again!

@jutzig jutzig merged commit ec6da48 into jutzig:master Nov 18, 2023
@jutzig
Copy link
Owner

jutzig commented Nov 18, 2023

Thanks again for the change. I've merged it and uploaded release 1.5.1

@anenviousguest
Copy link
Contributor Author

anenviousguest commented Nov 19, 2023

Thanks a lot @jutzig for a quick turnaround! Did you by any chance upload the plugin to Maven Central?

@jutzig
Copy link
Owner

jutzig commented Nov 19, 2023 via email

@anenviousguest
Copy link
Contributor Author

Ah, thanks. I see it was uploaded to oss.sonatype.org, not to mvnrepository.com
Cool 👍🏻

@jutzig
Copy link
Owner

jutzig commented Nov 19, 2023 via email

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.

adapt to use Github Enterprise?
2 participants