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

Decouple Azure Devops from git-plugin and prepare for other Git providers #30

Merged

Conversation

MartinKanters
Copy link
Contributor

@MartinKanters MartinKanters commented Jun 20, 2023

This PR decouples the git-plugin from Azure Devops and attempts to create a generic layer in order for being able to implement other Git providers like GitHub.

Summary:

  • All Azure related code is moved to package provider.azure.
  • A GitProvider interface is created (with AzureDevopsGitProvider being the one implementation at this moment). The methods are almost a copy of the AzureDevopsClient methods, with some small changes made to decouple it a bit from AzDo's API specifics
  • A rough copy of all domain classes of Azure have been made as a generic domain model
  • All commands talk to the GitProvider instead of the AzureDevopsClient
  • The PluginConfig class has been made Azure Devops specific and moved to its package

I've tested it successfully using both mvn quarkus:dev and injecting it as a plugin to ret. Only a snapshot build of the latest commit of ret worked, with the released 0.1.3 I get the following error (edit: this is not fixed with 0.1.4, but is probably due to me using an arm machine for building the plugin while RET is amd, when building ret myself, it works.):

Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /Users/martin/.ret/plugins/git-plugin.dylib
plugin  at org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk.NativeLibrarySupport.loadLibraryAbsolute(NativeLibrarySupport.java:92)
        at [email protected]/java.lang.ClassLoader.loadLibrary(ClassLoader.java:57)
        at [email protected]/java.lang.Runtime.load0(Runtime.java:785)
        at [email protected]/java.lang.System.load(System.java:2011)
        at io.rabobank.ret.command.PluginInitializeCommand.run(PluginInitializeCommand.kt:20)
        at picocli.CommandLine.executeUserObject(CommandLine.java:2026)
        at picocli.CommandLine.access$1500(CommandLine.java:148)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
        at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
        at io.rabobank.ret.config.CommandLineConfiguration.customCommandLine$lambda$0(CommandLineConfiguration.kt:18)
        at io.quarkus.picocli.runtime.PicocliRunner$EventExecutionStrategy.execute(PicocliRunner.java:26)
        at picocli.CommandLine.execute(CommandLine.java:2170)
        at io.quarkus.picocli.runtime.PicocliRunner.run(PicocliRunner.java:40)
        at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:132)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
        at io.quarkus.runner.GeneratedMain.main(Unknown Source)

Also, I had to replace all booleans with java.lang.Boolean in the .plugin file after initializing it. (edit: this one is fixed when using 0.1.4)

I'll try to work on a GitHub implementation next (in a separate PR).

What do you think?

@MartinKanters MartinKanters requested a review from a team June 20, 2023 14:07
martinvisser
martinvisser previously approved these changes Jul 24, 2023
martinvisser
martinvisser previously approved these changes Jul 24, 2023
@MartinKanters MartinKanters force-pushed the feature/make-git-plugin-extensible branch from 211d36d to 6602913 Compare July 25, 2023 09:20
@sonarcloud
Copy link

sonarcloud bot commented Jul 25, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@martinvisser martinvisser merged commit 346af2d into rabobank:main Jul 25, 2023
3 checks passed
@MartinKanters MartinKanters deleted the feature/make-git-plugin-extensible branch July 26, 2023 14:03
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.

4 participants