This is an automated email from the ASF dual-hosted git repository.
mappjzc 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 f68c17dd0 fix: set the namespace for gitlab/bitbucket name (#5283)
f68c17dd0 is described below
commit f68c17dd07a2ed9f5a00a1d9a62b9d7fe00ba515
Author: abeizn <[email protected]>
AuthorDate: Thu May 25 17:29:15 2023 +0800
fix: set the namespace for gitlab/bitbucket name (#5283)
* fix: set the namespace for gitlab/bitbucket name
* fix: gitlab project e2e
---
backend/plugins/bitbucket/e2e/snapshot_tables/boards.csv | 2 +-
backend/plugins/bitbucket/e2e/snapshot_tables/cicd_scopes.csv | 2 +-
backend/plugins/bitbucket/e2e/snapshot_tables/repos.csv | 2 +-
backend/plugins/bitbucket/impl/impl.go | 1 -
backend/plugins/bitbucket/tasks/repo_convertor.go | 6 +++---
backend/plugins/gitlab/e2e/snapshot_tables/boards.csv | 2 +-
backend/plugins/gitlab/e2e/snapshot_tables/cicd_scopes.csv | 2 +-
backend/plugins/gitlab/e2e/snapshot_tables/repos.csv | 2 +-
backend/plugins/gitlab/tasks/project_convertor.go | 9 +++++----
9 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/backend/plugins/bitbucket/e2e/snapshot_tables/boards.csv
b/backend/plugins/bitbucket/e2e/snapshot_tables/boards.csv
index cf77c6767..110802761 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 cf77c6767..110802761 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 2cea80e69..13f5d2c46 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 69372603f..07037e298 100644
--- a/backend/plugins/bitbucket/impl/impl.go
+++ b/backend/plugins/bitbucket/impl/impl.go
@@ -247,7 +247,6 @@ func EnrichOptions(taskCtx plugin.TaskContext,
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 48a49cfc8..40aaf908c 100644
--- a/backend/plugins/bitbucket/tasks/repo_convertor.go
+++ b/backend/plugins/bitbucket/tasks/repo_convertor.go
@@ -111,7 +111,7 @@ func ConvertRepo(taskCtx plugin.SubTaskContext)
errors.Error {
DomainEntity: domainlayer.DomainEntity{
Id: repoId,
},
- Name: repository.Name,
+ Name: repository.BitbucketId,
Url: repository.HTMLUrl,
Description: repository.Description,
Language: repository.Language,
@@ -123,7 +123,7 @@ func ConvertRepo(taskCtx plugin.SubTaskContext)
errors.Error {
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 @@ func ConvertRepo(taskCtx plugin.SubTaskContext)
errors.Error {
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 5f83b7047..bc86133ae 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 a540e4504..4e75ca7ff 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 426c3e163..7b69b6b72 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 24378a193..419f1073b 100644
--- a/backend/plugins/gitlab/tasks/project_convertor.go
+++ b/backend/plugins/gitlab/tasks/project_convertor.go
@@ -18,6 +18,8 @@ limitations under the License.
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 @@ import (
"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 @@ func convertToRepositoryModel(project
*models.GitlabProject) *code.Repo {
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 @@ func convertToBoardModel(project *models.GitlabProject)
*ticket.Board {
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 @@ func convertToCicdScopeModel(project *models.GitlabProject)
*devops.CicdScope {
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,