-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(integration-git): init git integration storage layer and git cli…
…ent (#3070) * init dao layer for git integration * add jgit dependency and sdk implement * add github and gitlab api client * add git repo mapper * format code * fix UT failed * move modules from integration.git to git * format code * response to CR comments * add `salt` column into table `integration_git_repository` * response to CR comments * rm unused class
- Loading branch information
1 parent
4a36746
commit 90be76e
Showing
20 changed files
with
1,194 additions
and
0 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
35 changes: 35 additions & 0 deletions
35
server/odc-migrate/src/main/resources/migrate/common/V_4_3_2_1__add_integration_git.sql
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,35 @@ | ||
CREATE TABLE IF NOT EXISTS `integration_git_repository` ( | ||
`id` bigint(20) NOT NULL AUTO_INCREMENT, | ||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
`creator_id` bigint(20) NOT NULL COMMENT 'creator user id, references iam_user.id', | ||
`organization_id` bigint(20) NOT NULL COMMENT 'organization id, references iam_organization.id', | ||
`project_id` bigint(20) DEFAULT NULL COMMENT 'project id, references collaboration_project.id', | ||
`description` varchar(512) DEFAULT NULL COMMENT 'description', | ||
`name` varchar(512) NOT NULL COMMENT 'repository name', | ||
`provider_type` varchar(32) NOT NULL COMMENT 'git provider type', | ||
`provider_url` varchar(128) NOT NULL COMMENT 'git provider url', | ||
`ssh_address` varchar(512) NOT NULL COMMENT 'ssh clone url, like [email protected]:xxx/xxx.git', | ||
`clone_address` varchar(512) NOT NULL COMMENT 'https clone url, like https://github.com/xxx/xxx.git', | ||
`email` varchar(128) NOT NULL COMMENT 'user email for commit', | ||
`personal_access_token` varchar(512) NOT NULL COMMENT 'personal access token', | ||
`salt` varchar(32) DEFAULT NULL COMMENT 'used to connect the random value used by the encryption and decryption algorithm of the secret field', | ||
PRIMARY KEY (`id`), | ||
KEY `integration_git_repository_organization_id_project_id` (`organization_id`, `project_id`) | ||
) COMMENT = 'integration git repository'; | ||
|
||
CREATE TABLE IF NOT EXISTS `integration_git_repository_stage` ( | ||
`id` bigint(20) NOT NULL AUTO_INCREMENT, | ||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
`description` varchar(512) DEFAULT NULL COMMENT 'description', | ||
`organization_id` bigint(20) NOT NULL COMMENT 'organization id, references iam_organization.id', | ||
`repo_id` bigint(20) NOT NULL COMMENT 'git repository id, references integration_git_repository.id', | ||
`state` varchar(32) NOT NULL COMMENT 'local repository state', | ||
`branch` varchar(512) NOT NULL COMMENT 'last edit branch', | ||
`last_commit_id` varchar(64) DEFAULT NULL COMMENT 'git commit revision number', | ||
`diff_patch_storage` varchar(512) DEFAULT NULL COMMENT 'storage information of patch file', | ||
`user_id` bigint(20) NOT NULL COMMENT 'user id, references iam_user.id', | ||
PRIMARY KEY (`id`), | ||
KEY `integration_git_edit_stage_organization_id_repo_id_user_id` (`organization_id`, `repo_id`, `user_id`) | ||
) COMMENT = 'integration git repository stage, to save the stage of workspace'; |
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
33 changes: 33 additions & 0 deletions
33
server/odc-service/src/main/java/com/oceanbase/odc/metadb/git/GitRepoRepository.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,33 @@ | ||
/* | ||
* Copyright (c) 2023 OceanBase. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.oceanbase.odc.metadb.git; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
|
||
import com.oceanbase.odc.config.jpa.OdcJpaRepository; | ||
|
||
/** | ||
* @author: liuyizhuo.lyz | ||
* @date: 2024/7/29 | ||
*/ | ||
public interface GitRepoRepository extends OdcJpaRepository<GitRepositoryEntity, Long>, | ||
JpaSpecificationExecutor<GitRepositoryEntity> { | ||
|
||
List<GitRepositoryEntity> findByOrganizationIdAndProjectId(Long organizationId, Long projectId); | ||
|
||
} |
90 changes: 90 additions & 0 deletions
90
server/odc-service/src/main/java/com/oceanbase/odc/metadb/git/GitRepositoryEntity.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,90 @@ | ||
/* | ||
* Copyright (c) 2023 OceanBase. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.oceanbase.odc.metadb.git; | ||
|
||
import java.util.Date; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.Entity; | ||
import javax.persistence.EnumType; | ||
import javax.persistence.Enumerated; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.Table; | ||
|
||
import com.oceanbase.odc.service.git.model.VcsProvider; | ||
|
||
import lombok.Data; | ||
|
||
/** | ||
* @author: liuyizhuo.lyz | ||
* @date: 2024/7/29 | ||
*/ | ||
@Data | ||
@Entity | ||
@Table(name = "integration_git_repository") | ||
public class GitRepositoryEntity { | ||
|
||
@Id | ||
@Column(name = "id", nullable = false) | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(name = "create_time", insertable = false, updatable = false) | ||
private Date createTime; | ||
|
||
@Column(name = "update_time", insertable = false, updatable = false) | ||
private Date updateTime; | ||
|
||
@Column(name = "creator_id", nullable = false) | ||
private Long creatorId; | ||
|
||
@Column(name = "organization_id", nullable = false) | ||
private Long organizationId; | ||
|
||
@Column(name = "project_id", nullable = false) | ||
private Long projectId; | ||
|
||
@Column(name = "name", nullable = false) | ||
private String name; | ||
|
||
@Column(name = "description") | ||
private String description; | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Column(name = "provider_type", nullable = false) | ||
private VcsProvider providerType; | ||
|
||
@Column(name = "provider_url", nullable = false) | ||
private String providerUrl; | ||
|
||
@Column(name = "ssh_address", nullable = false) | ||
private String sshAddress; | ||
|
||
@Column(name = "clone_address", nullable = false) | ||
private String cloneAddress; | ||
|
||
@Column(name = "email", nullable = false) | ||
private String email; | ||
|
||
@Column(name = "personal_access_token", nullable = false) | ||
private String personalAccessToken; | ||
|
||
@Column(name = "salt", nullable = false) | ||
private String salt; | ||
|
||
} |
Oops, something went wrong.