fix: set the namespace for gitlab/bitbucket name (#5283)
* fix: set the namespace for gitlab/bitbucket name
* fix: gitlab project e2e
diff --git a/backend/plugins/bitbucket/e2e/snapshot_tables/boards.csv b/backend/plugins/bitbucket/e2e/snapshot_tables/boards.csv
index cf77c67..1108027 100644
--- a/backend/plugins/bitbucket/e2e/snapshot_tables/boards.csv
+++ b/backend/plugins/bitbucket/e2e/snapshot_tables/boards.csv
@@ -1,2 +1,2 @@
id,name,description,url,created_date,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark
-bitbucket:BitbucketRepo:1:likyh/likyhphp,likyhphp,,https://bitbucket.org/likyh/likyhphp/issues,2022-06-17T03:27:18.865+00:00,,,0,
+bitbucket:BitbucketRepo:1:likyh/likyhphp,likyh/likyhphp,,https://bitbucket.org/likyh/likyhphp/issues,2022-06-17T03:27:18.865+00:00,,,0,
diff --git a/backend/plugins/bitbucket/e2e/snapshot_tables/cicd_scopes.csv b/backend/plugins/bitbucket/e2e/snapshot_tables/cicd_scopes.csv
index cf77c67..1108027 100644
--- a/backend/plugins/bitbucket/e2e/snapshot_tables/cicd_scopes.csv
+++ b/backend/plugins/bitbucket/e2e/snapshot_tables/cicd_scopes.csv
@@ -1,2 +1,2 @@
id,name,description,url,created_date,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark
-bitbucket:BitbucketRepo:1:likyh/likyhphp,likyhphp,,https://bitbucket.org/likyh/likyhphp/issues,2022-06-17T03:27:18.865+00:00,,,0,
+bitbucket:BitbucketRepo:1:likyh/likyhphp,likyh/likyhphp,,https://bitbucket.org/likyh/likyhphp/issues,2022-06-17T03:27:18.865+00:00,,,0,
diff --git a/backend/plugins/bitbucket/e2e/snapshot_tables/repos.csv b/backend/plugins/bitbucket/e2e/snapshot_tables/repos.csv
index 2cea80e..13f5d2c 100644
--- a/backend/plugins/bitbucket/e2e/snapshot_tables/repos.csv
+++ b/backend/plugins/bitbucket/e2e/snapshot_tables/repos.csv
@@ -1,2 +1,2 @@
id,name,url,description,owner_id,language,forked_from,deleted,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark
-bitbucket:BitbucketRepo:1:likyh/likyhphp,likyhphp,https://bitbucket.org/likyh/likyhphp,,,,,0,,,0,
+bitbucket:BitbucketRepo:1:likyh/likyhphp,likyh/likyhphp,https://bitbucket.org/likyh/likyhphp,,,,,0,,,0,
diff --git a/backend/plugins/bitbucket/impl/impl.go b/backend/plugins/bitbucket/impl/impl.go
index 6937260..07037e2 100644
--- a/backend/plugins/bitbucket/impl/impl.go
+++ b/backend/plugins/bitbucket/impl/impl.go
@@ -247,7 +247,6 @@
return err
}
logger := taskCtx.GetLogger()
- // for advanced mode or others which we only have name, for bp v200, we have githubId
err = taskCtx.GetDal().First(&repo, dal.Where(
"connection_id = ? AND bitbucket_id = ?",
op.ConnectionId, op.FullName))
diff --git a/backend/plugins/bitbucket/tasks/repo_convertor.go b/backend/plugins/bitbucket/tasks/repo_convertor.go
index 48a49cf..40aaf90 100644
--- a/backend/plugins/bitbucket/tasks/repo_convertor.go
+++ b/backend/plugins/bitbucket/tasks/repo_convertor.go
@@ -111,7 +111,7 @@
DomainEntity: domainlayer.DomainEntity{
Id: repoId,
},
- Name: repository.Name,
+ Name: repository.BitbucketId,
Url: repository.HTMLUrl,
Description: repository.Description,
Language: repository.Language,
@@ -123,7 +123,7 @@
DomainEntity: domainlayer.DomainEntity{
Id: repoId,
},
- Name: repository.Name,
+ Name: repository.BitbucketId,
Url: fmt.Sprintf("%s/%s", repository.HTMLUrl, "issues"),
Description: repository.Description,
CreatedDate: repository.CreatedDate,
@@ -133,7 +133,7 @@
DomainEntity: domainlayer.DomainEntity{
Id: repoId,
},
- Name: repository.Name,
+ Name: repository.BitbucketId,
Url: fmt.Sprintf("%s/%s", repository.HTMLUrl, "issues"),
Description: repository.Description,
CreatedDate: repository.CreatedDate,
diff --git a/backend/plugins/gitlab/e2e/snapshot_tables/boards.csv b/backend/plugins/gitlab/e2e/snapshot_tables/boards.csv
index 5f83b70..bc86133 100644
--- a/backend/plugins/gitlab/e2e/snapshot_tables/boards.csv
+++ b/backend/plugins/gitlab/e2e/snapshot_tables/boards.csv
@@ -1,2 +1,2 @@
id,name,description,url,created_date,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark
-gitlab:GitlabProject:1:12345678,Snowflake Spend,This is a dbt package for understanding the cost your Snowflake Data Warehouse is accruing.,https://gitlab.com/gitlab-data/snowflake_spend,2019-06-20T14:14:45.108+00:00,"{""ConnectionId"":1,""ProjectId"":12345678}",_raw_gitlab_api_project,1,
+gitlab:GitlabProject:1:12345678,gitlab-data/snowflake_spend,This is a dbt package for understanding the cost your Snowflake Data Warehouse is accruing.,https://gitlab.com/gitlab-data/snowflake_spend,2019-06-20T14:14:45.108+00:00,"{""ConnectionId"":1,""ProjectId"":12345678}",_raw_gitlab_api_project,1,
diff --git a/backend/plugins/gitlab/e2e/snapshot_tables/cicd_scopes.csv b/backend/plugins/gitlab/e2e/snapshot_tables/cicd_scopes.csv
index a540e45..4e75ca7 100644
--- a/backend/plugins/gitlab/e2e/snapshot_tables/cicd_scopes.csv
+++ b/backend/plugins/gitlab/e2e/snapshot_tables/cicd_scopes.csv
@@ -1,2 +1,2 @@
id,name,description,url,created_date,updated_date
-gitlab:GitlabProject:1:12345678,Snowflake Spend,This is a dbt package for understanding the cost your Snowflake Data Warehouse is accruing.,https://gitlab.com/gitlab-data/snowflake_spend,2019-06-20T14:14:45.108+00:00,2022-06-16T16:23:09.458+00:00
+gitlab:GitlabProject:1:12345678,gitlab-data/snowflake_spend,This is a dbt package for understanding the cost your Snowflake Data Warehouse is accruing.,https://gitlab.com/gitlab-data/snowflake_spend,2019-06-20T14:14:45.108+00:00,2022-06-16T16:23:09.458+00:00
diff --git a/backend/plugins/gitlab/e2e/snapshot_tables/repos.csv b/backend/plugins/gitlab/e2e/snapshot_tables/repos.csv
index 426c3e1..7b69b6b 100644
--- a/backend/plugins/gitlab/e2e/snapshot_tables/repos.csv
+++ b/backend/plugins/gitlab/e2e/snapshot_tables/repos.csv
@@ -1,2 +1,2 @@
id,name,url,description,owner_id,language,forked_from,created_date,updated_date,deleted,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark
-gitlab:GitlabProject:1:12345678,Snowflake Spend,https://gitlab.com/gitlab-data/snowflake_spend,This is a dbt package for understanding the cost your Snowflake Data Warehouse is accruing.,,,,2019-06-20T14:14:45.108+00:00,2022-06-16T16:23:09.458+00:00,0,"{""ConnectionId"":1,""ProjectId"":12345678}",_raw_gitlab_api_project,1,
+gitlab:GitlabProject:1:12345678,gitlab-data/snowflake_spend,https://gitlab.com/gitlab-data/snowflake_spend,This is a dbt package for understanding the cost your Snowflake Data Warehouse is accruing.,,,,2019-06-20T14:14:45.108+00:00,2022-06-16T16:23:09.458+00:00,0,"{""ConnectionId"":1,""ProjectId"":12345678}",_raw_gitlab_api_project,1,
diff --git a/backend/plugins/gitlab/tasks/project_convertor.go b/backend/plugins/gitlab/tasks/project_convertor.go
index 24378a1..419f107 100644
--- a/backend/plugins/gitlab/tasks/project_convertor.go
+++ b/backend/plugins/gitlab/tasks/project_convertor.go
@@ -18,6 +18,8 @@
package tasks
import (
+ "reflect"
+
"github.com/apache/incubator-devlake/core/dal"
"github.com/apache/incubator-devlake/core/errors"
"github.com/apache/incubator-devlake/core/models/domainlayer"
@@ -29,7 +31,6 @@
"github.com/apache/incubator-devlake/core/plugin"
helper "github.com/apache/incubator-devlake/helpers/pluginhelper/api"
"github.com/apache/incubator-devlake/plugins/gitlab/models"
- "reflect"
)
const RAW_PROJECT_TABLE = "gitlab_api_project"
@@ -104,7 +105,7 @@
DomainEntity: domainlayer.DomainEntity{
Id: didgen.NewDomainIdGenerator(project).Generate(project.ConnectionId, project.GitlabId),
},
- Name: project.Name,
+ Name: project.PathWithNamespace,
Url: project.WebUrl,
Description: project.Description,
ForkedFrom: project.ForkedFromProjectWebUrl,
@@ -119,7 +120,7 @@
DomainEntity: domainlayer.DomainEntity{
Id: didgen.NewDomainIdGenerator(project).Generate(project.ConnectionId, project.GitlabId),
},
- Name: project.Name,
+ Name: project.PathWithNamespace,
Url: project.WebUrl,
Description: project.Description,
CreatedDate: project.CreatedDate,
@@ -140,7 +141,7 @@
DomainEntity: domainlayer.DomainEntity{
Id: didgen.NewDomainIdGenerator(project).Generate(project.ConnectionId, project.GitlabId),
},
- Name: project.Name,
+ Name: project.PathWithNamespace,
Url: project.WebUrl,
Description: project.Description,
CreatedDate: project.CreatedDate,