-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A non-nonsense (and quite working) implementation of gitlab scm provi…
…der (because yes, I finally got the hands on a non-trivial gitlab project, and it's dope)
- Loading branch information
Showing
10 changed files
with
179 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.github.Riduidel.aadarchi</groupId> | ||
<artifactId>system</artifactId> | ||
<version>0.1.13-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>git-scm-handler-helper</artifactId> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.eclipse.jgit</groupId> | ||
<artifactId>org.eclipse.jgit</artifactId> | ||
</dependency> | ||
|
||
</dependencies> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
github-scm-handler/src/main/java/org/ndx/aadarchi/github/GitOperatorProducer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.ndx.aadarchi.github; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Set; | ||
import java.util.logging.Logger; | ||
import java.util.stream.Collectors; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
import javax.enterprise.inject.Produces; | ||
import javax.inject.Inject; | ||
import javax.inject.Named; | ||
|
||
import org.apache.deltaspike.core.api.config.ConfigProperty; | ||
import org.eclipse.jgit.api.Git; | ||
import org.eclipse.jgit.api.ListBranchCommand.ListMode; | ||
import org.eclipse.jgit.api.errors.GitAPIException; | ||
import org.eclipse.jgit.lib.Ref; | ||
import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider; | ||
import org.ndx.aadarchi.gitlab.GitOperator; | ||
|
||
import com.structurizr.annotation.Component; | ||
|
||
/** | ||
* Component dedicated to low-level git operations | ||
* @author Nicolas | ||
*/ | ||
public class GitOperatorProducer { | ||
@Produces @Named("github") | ||
public GitOperator buildGitOperator( | ||
@ConfigProperty(name=Constants.CONFIG_GITHUB_LOGIN) String login, | ||
@ConfigProperty(name=Constants.CONFIG_GITHUB_TOKEN) String token, | ||
@ConfigProperty(name=Constants.CONFIG_GIT_BRANCHES_TO_CHECKOUT, defaultValue = "develop, main, main") String names) { | ||
GitOperator returned = new GitOperator(); | ||
returned.setLogin(login); | ||
returned.setToken(token); | ||
returned.setBranchesToCheckout(names); | ||
return returned; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
gitlab-scm-handler/src/main/java/org/ndx/aadarchi/gitlab/GitOperatorProducer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.ndx.aadarchi.gitlab; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Set; | ||
import java.util.logging.Logger; | ||
import java.util.stream.Collectors; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
import javax.enterprise.inject.Produces; | ||
import javax.inject.Inject; | ||
import javax.inject.Named; | ||
|
||
import org.apache.deltaspike.core.api.config.ConfigProperty; | ||
import org.eclipse.jgit.api.Git; | ||
import org.eclipse.jgit.api.ListBranchCommand.ListMode; | ||
import org.eclipse.jgit.api.errors.GitAPIException; | ||
import org.eclipse.jgit.lib.Ref; | ||
import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider; | ||
import org.ndx.aadarchi.gitlab.GitOperator; | ||
|
||
import com.structurizr.annotation.Component; | ||
|
||
/** | ||
* Component dedicated to low-level git operations | ||
* @author Nicolas | ||
*/ | ||
public class GitOperatorProducer { | ||
@Produces @Named("gitlab") | ||
public GitOperator buildGitOperator( | ||
@ConfigProperty(name=Constants.CONFIG_GITLAB_LOGIN) String login, | ||
@ConfigProperty(name=Constants.CONFIG_GITLAB_TOKEN) String token, | ||
@ConfigProperty(name=Constants.CONFIG_GIT_BRANCHES_TO_CHECKOUT, defaultValue = "develop, main, main") String names) { | ||
GitOperator returned = new GitOperator(); | ||
returned.setLogin(login); | ||
returned.setToken(token); | ||
returned.setBranchesToCheckout(names); | ||
return returned; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters