commit-status-publisher icon indicating copy to clipboard operation
commit-status-publisher copied to clipboard

Add support for Gitea

Open Turbocube644 opened this issue 3 years ago • 16 comments

Support for Gitea. Code is based on the one for Gitlab to keep the Code Style and Approach. Also the support for Gitlab had about the same scope as for Gitea.

Turbocube644 avatar Feb 24 '22 11:02 Turbocube644

Can I ask how you managed to compile this repository? I have tried the README instructions, but the libraries seem to be missing

LecrisUT avatar Apr 09 '22 14:04 LecrisUT

@LecrisUT I downloaded the corresponding libraries from ~~https://download.jetbrains.com/teamcity-repository/org/jetbrains/teamcity/server-api/~~ https://download-cdn.jetbrains.com/teamcity/TeamCity-{202X.Y}.tar.gz

Turbocube644 avatar Apr 19 '22 10:04 Turbocube644

Thank you. So instead of pointing it to the libraries in the runtime TeamCity, I can point them to those? Not sure what the appropriate gradle.properties would be to set it up like that. Fortunately the repository was pushed with the release branches for each version, so now I can prototype on my 2021.2 release.

LecrisUT avatar Apr 19 '22 10:04 LecrisUT

So instead of pointing it to the libraries in the runtime TeamCity, I can point them to those?

Yes

Not sure what the appropriate gradle.properties would be to set it up like that.

Is used the following:

TeamCityLibs=../../TeamCity/webapps/ROOT/WEB-INF/lib/
TeamCityTestLibs=../../TeamCity/devPackage/tests
PluginVersion=99712
TeamCityVersion=2021.2.3

Using the gradle.properties you do not need to use the long gradle build command. Apparently the TeamCityVersion needs to match. PluginVersion needs to be higher than the version you intend to overwrite. For TeamCityVersion=2021.2.3 all Plugins have the version 99711 (indicated by the file BUILD_99711 in the downloaded API or by taking a look at the plugin page of your running TeamCity Server instance). Therefore I just chose version 99712.

Turbocube644 avatar Apr 20 '22 13:04 Turbocube644

Hi, nice work! When will this be merged?

markusstephanides avatar Jul 25 '22 10:07 markusstephanides

Can't wait to be merged. Thanks for this job.

ughyg avatar Oct 17 '22 16:10 ughyg

This PR would be extremely helpful. Any chance that it will be merged?

TimberBro avatar Feb 19 '23 12:02 TimberBro

@Turbocube644 Thanks for this, really wish JetBrains would bring this in though.

CanisHelix avatar May 30 '23 09:05 CanisHelix

Tried to build this plugin to test it internally. My steps:

  1. Pulled latest version of your fork repo
  2. Downloaded latest distribution of Teamcity, using URL from previous comments
  3. Set my gradle.properties as
TeamCityLibs=../../TeamCity/webapps/ROOT/WEB-INF/lib/
TeamCityTestLibs=../../TeamCity/devPackage/tests
PluginVersion=99712
TeamCityVersion=2021.2.3
  1. Run gradle clean build
  2. Get around 100 errors, that says, that some packages are missing.

For example, the error says, that I don't have package to import import jetbrains.buildServer.vcshostings.http.credentials.HttpCredentials; I couldn't find it in distribution ether. Even OpenAPI doc doesn't have information about this package. Could anybody hint, what am I missing?

TimberBro avatar Jul 08 '23 15:07 TimberBro

@TimberBro The most recent commit is based on the commit which was used for TeamCity 2023.05

Therefore, the grade.properties need to look something like this:

TeamCityLibs=../../TeamCity/webapps/ROOT/WEB-INF/lib/
TeamCityTestLibs=../../TeamCity/devPackage/tests
PluginVersion=1234567
TeamCityVersion=2023.05

The PluginVersion needs to be higher thant the corresponding TeamCity Build Version (129203 for TeamCity 2023.05). You can choose any number, so 999999 would work for quite a while for example.

Turbocube644 avatar Jul 10 '23 17:07 Turbocube644

@Turbocube644 Thanks for your reply! For some strange reason, not all libs from TeamCityLibs were found by gradle and that was the root cause of my problem. After your answer I returned to my VM again, then build plugin for 2023.05 first try.

TimberBro avatar Jul 10 '23 20:07 TimberBro

Are there any chances for PR to be merged?

gpby avatar Oct 19 '23 00:10 gpby

I found https://www.youtube.com/watch?v=R-BPNomdkBE which configured Commit Status Publisher with the GitHub integration but using the Gitea API endpoint, so I guess GitHub and Gitea have the same/similar APIs? Haven't tried it myself yet, but if it works without major issues then it would be a good workaround until this is merged.

chylex avatar Jan 17 '24 23:01 chylex

I found https://www.youtube.com/watch?v=R-BPNomdkBE which configured Commit Status Publisher with the GitHub integration but using the Gitea API endpoint, so I guess GitHub and Gitea have the same/similar APIs? Haven't tried it myself yet, but if it works without major issues then it would be a good workaround until this is merged.

Gitea becomes more and more compatible with Github in General. With Gitea 1.21 the statuses seems to be same (before gitea had warning and from 1.19 to 1.120 running)

Turbocube644 avatar Jan 25 '24 12:01 Turbocube644

@Turbocube644 What version of Gradle/Java are you building with?

I could build for 2023.05 with Gradle 6.9.1 and Java 17.0.9 without issue, but now for 2023.11 I had to upgrade Gradle to 7.6.4 due to

root in commit-status-publisher-gitea on  master via 🅶 v6.9.1 via ☕ v17.0.9
❯ gradle clean build -PTeamCityTestLibs=/root/JetBrains/TeamCity.2023.11/devPackage/tests -PTeamCityLibs=/root/JetBrains/TeamCity.2023.11/webapps/ROOT/WEB-INF/lib -PTeamCityVersion=2023.11 -PPluginVersion=129205

FAILURE: Build failed with an exception.

* Where:
Settings file '/root/JetBrains/commit-status-publisher-gitea/settings.gradle'

* What went wrong:
Could not compile settings file '/root/JetBrains/commit-status-publisher-gitea/settings.gradle'.
> startup failed:
  General error during semantic analysis: Unsupported class file major version 61

  java.lang.IllegalArgumentException: Unsupported class file major version 61
        at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:196)
        at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:177)
        at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:163)
        at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:284)

Now with Gradle 7.6.4 I get this error:

root in commit-status-publisher-gitea on  master via 🅶 v6.9.1 via ☕ v17.0.9
❯ gradle clean build -PTeamCityTestLibs=/root/JetBrains/TeamCity.2023.11/devPackage/tests -PTeamCityLibs=/root/JetBrains/TeamCity.2023.11/webapps/ROOT/WEB-INF/lib -PTeamCityVersion=2023.11 -PPluginVersion=129205 --stacktrace

FAILURE: Build failed with an exception.

* Where:
Build file '/root/JetBrains/commit-status-publisher-gitea/build.gradle' line: 44

* What went wrong:
A problem occurred evaluating root project 'commit-status-publisher'.
> Configuration with name 'runtime' not found.

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'commit-status-publisher'.
        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93)
        at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.lambda$apply$0(DefaultScriptPluginFactory.java:133)
        at org.gradle.configuration.ProjectScriptTarget.addConfiguration(ProjectScriptTarget.java:79)

CanisHelix avatar Mar 15 '24 08:03 CanisHelix

I have updated the support for 2024.07.1 I had to revert commit da579c3eb0c9a002cd6af8f511c9365f236f5b47 from 6th February this year as the changes do not work (the maven repo from jetbrains seems no to be available). Additionally, the README.md is not updated for that change either.

As there is no API Version for 2024.07.1, I used 2024.07 (can be checked at https://download.jetbrains.com/teamcity-repository/org/jetbrains/teamcity/server-api/). Therefore TeamCity itself still needs to be downloaded from https://download-cdn.jetbrains.com/teamcity/TeamCity-{202X.Y}.tar.gz and put alongside the checkout.

Additionally, I disabled the test as they would refuse to compile.

For gradle, I just used an up to date IntelliJ (6.9.1).

Turbocube644 avatar Aug 16 '24 15:08 Turbocube644