You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by li...@apache.org on 2023/03/07 10:08:16 UTC

[incubator-devlake] branch main updated: fix: add related repo id for webhook deployments (#4603)

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

likyh 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 6038ef511 fix: add related repo id for webhook deployments (#4603)
6038ef511 is described below

commit 6038ef511063b95b7c08896e264d7671baba2ff3
Author: Likyh <ya...@meri.co>
AuthorDate: Tue Mar 7 18:08:11 2023 +0800

    fix: add related repo id for webhook deployments (#4603)
---
 backend/plugins/webhook/api/cicd_pipeline.go | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/backend/plugins/webhook/api/cicd_pipeline.go b/backend/plugins/webhook/api/cicd_pipeline.go
index 19f77006c..b81b982eb 100644
--- a/backend/plugins/webhook/api/cicd_pipeline.go
+++ b/backend/plugins/webhook/api/cicd_pipeline.go
@@ -23,6 +23,7 @@ import (
 	"github.com/apache/incubator-devlake/core/dal"
 	"github.com/apache/incubator-devlake/core/errors"
 	"github.com/apache/incubator-devlake/core/models/domainlayer"
+	"github.com/apache/incubator-devlake/core/models/domainlayer/code"
 	"github.com/apache/incubator-devlake/core/models/domainlayer/devops"
 	"github.com/apache/incubator-devlake/core/models/domainlayer/ticket"
 	"github.com/apache/incubator-devlake/core/plugin"
@@ -350,7 +351,13 @@ func PostDeploymentCicdTask(input *plugin.ApiResourceInput) (*plugin.ApiResource
 		PipelineId: pipelineId,
 		CommitSha:  request.CommitSha,
 		Branch:     ``,
-		RepoId:     request.RepoUrl,
+		Repo:       request.RepoUrl,
+	}
+
+	mayRelatedRepo := code.Repo{}
+	relatedRepoErr := db.First(&mayRelatedRepo, dal.Where("url = ?", request.RepoUrl))
+	if relatedRepoErr == nil {
+		domainPipelineCommit.RepoId = mayRelatedRepo.Id
 	}
 
 	// save