Skip to content
Snippets Groups Projects
Verified Commit bd28ad9f authored by Jan-Niclas Strüwer's avatar Jan-Niclas Strüwer
Browse files

gitlab client setup and git wrapper

parent 869a1de0
No related branches found
No related tags found
No related merge requests found
......@@ -28,7 +28,8 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.gitlab4j:gitlab4j-api:5.2.0")
implementation("org.gitlab4j:gitlab4j-api:6.0.0-rc.1")
implementation("org.eclipse.jgit:org.eclipse.jgit:6.5.0.202303070854-r")
developmentOnly("org.springframework.boot:spring-boot-devtools")
runtimeOnly("com.h2database:h2")
testImplementation("org.springframework.boot:spring-boot-starter-test")
......
......@@ -6,7 +6,7 @@ import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
data class RepositoryChangedDto(val repoId: Int)
data class RepositoryChangedDto(val repoId: Long)
@RestController
@RequestMapping("/gitlab")
class GitlabController(private val gitlabService: GitlabService) {
......@@ -15,6 +15,7 @@ class GitlabController(private val gitlabService: GitlabService) {
@PostMapping("/repoChanged")
fun repoChanged(@RequestBody repositoryChangedDto: RepositoryChangedDto) {
logger.info("Repo changed POST request for ID ${repositoryChangedDto.repoId} received.")
gitlabService.queryRepo(repositoryChangedDto.repoId)
}
}
\ No newline at end of file
package de.fraunhofer.iem.dataprovider.gitlab
import de.fraunhofer.iem.dataprovider.logger.getLogger
import org.eclipse.jgit.api.Git
import org.gitlab4j.api.GitLabApi
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Service
@Service
class GitlabService {
class GitlabService(val gitlabConfiguration: GitlabConfiguration) {
@Autowired
private lateinit var gitlabConfiguration: GitlabConfiguration
// private val gitlabApi = GitLabApi(gitlabConfiguration.host, gitlabConfiguration.accessToken)
fun queryRepo(repoId: Int) {
println(gitlabConfiguration.host)
println(gitlabConfiguration.accessToken)
private val logger = getLogger(javaClass)
private var gitlabApi = GitLabApi(gitlabConfiguration.host, gitlabConfiguration.accessToken)
fun queryRepo(repoId: Long) {
val project = gitlabApi.projectApi.getProject(repoId)
val projectUri = project.sshUrlToRepo
// val git: Git = Git.cloneRepository()
// .setURI("https://github.com/eclipse/jgit.git")
// .setDirectory("/path/to/repo")
// .call()
}
}
\ No newline at end of file
spring.config.import=optional:classpath:.env[.properties]
OPENCODE_GITLAB_URL="https://gitlab.opencode.de/"
OPENCODE_GITLAB_URL=https://gitlab.opencode.de/
OPENCODE_GITLAB_TOKEN=${OPENCODE_TOKEN}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.