You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by kl...@apache.org on 2024/03/28 09:08:29 UTC
(incubator-devlake) branch main updated: fix: plugins option add full name field (#7236)
This is an automated email from the ASF dual-hosted git repository.
klesh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new 18b96780d fix: plugins option add full name field (#7236)
18b96780d is described below
commit 18b96780d2b5fb16359302e6e83a55a5893751df
Author: abeizn <zi...@merico.dev>
AuthorDate: Thu Mar 28 17:08:22 2024 +0800
fix: plugins option add full name field (#7236)
* fix: plugins option add name field
* fix: e2e test
* fix: add option full name
* fix: gitlab e2e test
* fix: gitextractor add options fullName
* fix: gitlab e2e
---
backend/plugins/bitbucket/api/blueprint_v200.go | 9 +++++----
backend/plugins/github/api/blueprint_v200.go | 10 ++++++----
backend/plugins/github/tasks/task_data.go | 1 +
backend/plugins/gitlab/api/blueprint_V200_test.go | 17 ++++++++++-------
backend/plugins/gitlab/api/blueprint_v200.go | 10 ++++++----
backend/plugins/gitlab/tasks/task_data.go | 1 +
backend/python/pydevlake/pydevlake/pipeline_tasks.py | 1 +
backend/python/pydevlake/pydevlake/plugin.py | 3 ++-
8 files changed, 32 insertions(+), 20 deletions(-)
diff --git a/backend/plugins/bitbucket/api/blueprint_v200.go b/backend/plugins/bitbucket/api/blueprint_v200.go
index c419c20d3..5c0509bec 100644
--- a/backend/plugins/bitbucket/api/blueprint_v200.go
+++ b/backend/plugins/bitbucket/api/blueprint_v200.go
@@ -125,10 +125,11 @@ func makeDataSourcePipelinePlanV200(
stage = append(stage, &coreModels.PipelineTask{
Plugin: "gitextractor",
Options: map[string]interface{}{
- "url": cloneUrl.String(),
- "name": bitbucketRepo.BitbucketId,
- "repoId": didgen.NewDomainIdGenerator(&models.BitbucketRepo{}).Generate(connection.ID, bitbucketRepo.BitbucketId),
- "proxy": connection.Proxy,
+ "url": cloneUrl.String(),
+ "name": bitbucketRepo.BitbucketId,
+ "fullName": bitbucketRepo.BitbucketId,
+ "repoId": didgen.NewDomainIdGenerator(&models.BitbucketRepo{}).Generate(connection.ID, bitbucketRepo.BitbucketId),
+ "proxy": connection.Proxy,
},
})
diff --git a/backend/plugins/github/api/blueprint_v200.go b/backend/plugins/github/api/blueprint_v200.go
index 3f4480cc8..909323918 100644
--- a/backend/plugins/github/api/blueprint_v200.go
+++ b/backend/plugins/github/api/blueprint_v200.go
@@ -110,6 +110,7 @@ func makeDataSourcePipelinePlanV200(
ConnectionId: githubRepo.ConnectionId,
GithubId: githubRepo.GithubId,
Name: githubRepo.FullName,
+ FullName: githubRepo.FullName,
}
stage, err := addGithub(subtaskMetas, connection, scopeConfig.Entities, stage, op)
if err != nil {
@@ -127,10 +128,11 @@ func makeDataSourcePipelinePlanV200(
stage = append(stage, &coreModels.PipelineTask{
Plugin: "gitextractor",
Options: map[string]interface{}{
- "url": cloneUrl.String(),
- "name": githubRepo.FullName,
- "repoId": didgen.NewDomainIdGenerator(&models.GithubRepo{}).Generate(connection.ID, githubRepo.GithubId),
- "proxy": connection.Proxy,
+ "url": cloneUrl.String(),
+ "name": githubRepo.FullName,
+ "fullName": githubRepo.FullName,
+ "repoId": didgen.NewDomainIdGenerator(&models.GithubRepo{}).Generate(connection.ID, githubRepo.GithubId),
+ "proxy": connection.Proxy,
},
})
diff --git a/backend/plugins/github/tasks/task_data.go b/backend/plugins/github/tasks/task_data.go
index b20b63669..93132af16 100644
--- a/backend/plugins/github/tasks/task_data.go
+++ b/backend/plugins/github/tasks/task_data.go
@@ -33,6 +33,7 @@ type GithubOptions struct {
Owner string `json:"owner" mapstructure:"owner,omitempty"`
Repo string `json:"repo" mapstructure:"repo,omitempty"`
Name string `json:"name" mapstructure:"name,omitempty"`
+ FullName string `json:"fullName" mapstructure:"fullName,omitempty"`
ScopeConfig *models.GithubScopeConfig `mapstructure:"scopeConfig,omitempty" json:"scopeConfig"`
helper.CollectorOptions `mapstructure:",squash"`
}
diff --git a/backend/plugins/gitlab/api/blueprint_V200_test.go b/backend/plugins/gitlab/api/blueprint_V200_test.go
index 94d667d90..f81280843 100644
--- a/backend/plugins/gitlab/api/blueprint_V200_test.go
+++ b/backend/plugins/gitlab/api/blueprint_V200_test.go
@@ -114,9 +114,10 @@ func TestMakeDataSourcePipelinePlanV200(t *testing.T) {
[]*srvhelper.ScopeDetail[models.GitlabProject, models.GitlabScopeConfig]{
{
Scope: models.GitlabProject{
- GitlabId: gitlabProjectId,
- Name: gitlabProjectName,
- HttpUrlToRepo: httpUrlToRepo,
+ GitlabId: gitlabProjectId,
+ Name: gitlabProjectName,
+ PathWithNamespace: pathWithNamespace,
+ HttpUrlToRepo: httpUrlToRepo,
},
ScopeConfig: &models.GitlabScopeConfig{
ScopeConfig: common.ScopeConfig{
@@ -152,15 +153,17 @@ func TestMakeDataSourcePipelinePlanV200(t *testing.T) {
Options: map[string]interface{}{
"connectionId": connectionID,
"projectId": gitlabProjectId,
+ "fullName": pathWithNamespace,
},
},
{
Plugin: "gitextractor",
Options: map[string]interface{}{
- "proxy": "",
- "repoId": expectDomainScopeId,
- "name": gitlabProjectName,
- "url": "https://git:nddtf@this_is_cloneUrl",
+ "proxy": "",
+ "repoId": expectDomainScopeId,
+ "name": gitlabProjectName,
+ "fullName": pathWithNamespace,
+ "url": "https://git:nddtf@this_is_cloneUrl",
},
},
},
diff --git a/backend/plugins/gitlab/api/blueprint_v200.go b/backend/plugins/gitlab/api/blueprint_v200.go
index 3b13fd82c..2596c4ba1 100644
--- a/backend/plugins/gitlab/api/blueprint_v200.go
+++ b/backend/plugins/gitlab/api/blueprint_v200.go
@@ -121,6 +121,7 @@ func makePipelinePlanV200(
options := make(map[string]interface{})
options["connectionId"] = connection.ID
options["projectId"] = gitlabProject.GitlabId
+ options["fullName"] = gitlabProject.PathWithNamespace
// construct subtasks
subtasks, err := helper.MakePipelinePlanSubtasks(subtaskMetas, scopeConfig.Entities)
@@ -144,10 +145,11 @@ func makePipelinePlanV200(
stage = append(stage, &coreModels.PipelineTask{
Plugin: "gitextractor",
Options: map[string]interface{}{
- "url": cloneUrl.String(),
- "name": gitlabProject.Name,
- "repoId": didgen.NewDomainIdGenerator(&models.GitlabProject{}).Generate(connection.ID, gitlabProject.GitlabId),
- "proxy": connection.Proxy,
+ "url": cloneUrl.String(),
+ "name": gitlabProject.Name,
+ "fullName": gitlabProject.PathWithNamespace,
+ "repoId": didgen.NewDomainIdGenerator(&models.GitlabProject{}).Generate(connection.ID, gitlabProject.GitlabId),
+ "proxy": connection.Proxy,
},
})
}
diff --git a/backend/plugins/gitlab/tasks/task_data.go b/backend/plugins/gitlab/tasks/task_data.go
index a2a7fead4..e611dfd07 100644
--- a/backend/plugins/gitlab/tasks/task_data.go
+++ b/backend/plugins/gitlab/tasks/task_data.go
@@ -26,6 +26,7 @@ import (
type GitlabOptions struct {
ConnectionId uint64 `mapstructure:"connectionId" json:"connectionId"`
ProjectId int `mapstructure:"projectId" json:"projectId"`
+ FullName string `mapstructure:"fullName" json:"fullName"`
ScopeConfigId uint64 `mapstructure:"scopeConfigId" json:"scopeConfigId"`
ScopeConfig *models.GitlabScopeConfig `mapstructure:"scopeConfig" json:"scopeConfig"`
helper.CollectorOptions `mapstructure:",squash"`
diff --git a/backend/python/pydevlake/pydevlake/pipeline_tasks.py b/backend/python/pydevlake/pydevlake/pipeline_tasks.py
index 5c2094d3c..b62aaeff6 100644
--- a/backend/python/pydevlake/pydevlake/pipeline_tasks.py
+++ b/backend/python/pydevlake/pydevlake/pipeline_tasks.py
@@ -27,6 +27,7 @@ def gitextractor(url: str, repo_name: str, scope_id: str, proxy: Optional[str]):
options={
"url": url,
"name": repo_name,
+ "fullName": repo_name,
"repoId": scope_id,
"proxy": proxy
},
diff --git a/backend/python/pydevlake/pydevlake/plugin.py b/backend/python/pydevlake/pydevlake/plugin.py
index 98e31f34d..b365bad4a 100644
--- a/backend/python/pydevlake/pydevlake/plugin.py
+++ b/backend/python/pydevlake/pydevlake/plugin.py
@@ -184,7 +184,8 @@ class Plugin(ABC):
options={
"scopeId": scope.id,
"scopeName": scope.name,
- "connectionId": connection.id
+ "connectionId": connection.id,
+ "fullName": scope.name
}
),
*self.extra_tasks(scope, config, connection)