You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ab...@apache.org on 2023/10/27 05:47:40 UTC

[incubator-devlake] branch main updated: fix: github some fields (#6349)

This is an automated email from the ASF dual-hosted git repository.

abeizn 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 67faf2df9 fix: github some fields (#6349)
67faf2df9 is described below

commit 67faf2df931c9f2daf2565703381435c26119f3a
Author: abeizn <zi...@merico.dev>
AuthorDate: Fri Oct 27 00:47:36 2023 -0500

    fix: github some fields (#6349)
---
 backend/plugins/github_graphql/tasks/deployment_convertor.go | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/backend/plugins/github_graphql/tasks/deployment_convertor.go b/backend/plugins/github_graphql/tasks/deployment_convertor.go
index 118f20ce8..60479dc90 100644
--- a/backend/plugins/github_graphql/tasks/deployment_convertor.go
+++ b/backend/plugins/github_graphql/tasks/deployment_convertor.go
@@ -53,7 +53,8 @@ func ConvertDeployment(taskCtx plugin.SubTaskContext) errors.Error {
 	}
 	defer cursor.Close()
 
-	jobBuildIdGen := didgen.NewDomainIdGenerator(&githubModels.GithubDeployment{})
+	deploymentIdGen := didgen.NewDomainIdGenerator(&githubModels.GithubDeployment{})
+	deploymentScopeIdGen := didgen.NewDomainIdGenerator(&githubModels.GithubRepo{})
 
 	converter, err := api.NewDataConverter(api.DataConverterArgs{
 		InputRowType:       reflect.TypeOf(githubModels.GithubDeployment{}),
@@ -63,10 +64,10 @@ func ConvertDeployment(taskCtx plugin.SubTaskContext) errors.Error {
 			githubDeployment := inputRow.(*githubModels.GithubDeployment)
 			deploymentCommit := &devops.CicdDeploymentCommit{
 				DomainEntity: domainlayer.DomainEntity{
-					Id: jobBuildIdGen.Generate(githubDeployment.ConnectionId, githubDeployment.Id),
+					Id: deploymentIdGen.Generate(githubDeployment.ConnectionId, githubDeployment.Id),
 				},
-				CicdScopeId: fmt.Sprintf("%d:%d", githubDeployment.ConnectionId, githubDeployment.GithubId),
-				Name:        fmt.Sprintf("%s:%d", githubDeployment.RepositoryName, githubDeployment.DatabaseId), // fixme where does the deploy name field exist?
+				CicdScopeId: deploymentScopeIdGen.Generate(githubDeployment.ConnectionId, githubDeployment.GithubId),
+				Name:        githubDeployment.CommitOid,
 				Result: devops.GetResult(&devops.ResultRule{
 					Success: []string{"SUCCESS"},
 					Failed:  []string{"ERROR", "FAILURE"},
@@ -88,7 +89,7 @@ func ConvertDeployment(taskCtx plugin.SubTaskContext) errors.Error {
 				FinishedDate: &githubDeployment.UpdatedDate, // fixme there is no such field
 				CommitSha:    githubDeployment.CommitOid,
 				RefName:      githubDeployment.RefName,
-				RepoId:       githubDeployment.RepositoryID,
+				RepoId:       fmt.Sprintf("%d", githubDeployment.GithubId),
 				RepoUrl:      githubDeployment.RepositoryUrl,
 			}