You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ly...@apache.org on 2024/05/27 06:48:16 UTC

(incubator-devlake) branch main updated: Return nil when record not found (#7515)

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

lynwee 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 9e2a26dcc Return nil when record not found (#7515)
9e2a26dcc is described below

commit 9e2a26dcc27c8bc2dbdba1022517ac028ed567bf
Author: Lynwee <li...@merico.dev>
AuthorDate: Mon May 27 14:48:12 2024 +0800

    Return nil when record not found (#7515)
    
    * fix(apikey): abort request if api key doesn't match
    
    * feat(webhook): update deployment commit id
    
    * fix(plugins): update path parameter, adapt to latest plugin helper
    
    * feat(plugins): add new plugin linker
    
    * feat(linker): fix compile errors
    
    * feat(linker): remove `since` in options
    
    * feat(linker): add e2e test, fix dora errors
    
    * fix(test): fix test errors
    
    * docs(linker): remove some comments
    
    * fix(linker): fix plugin name
    
    * fix(linker): fix unpected error
---
 backend/plugins/linker/e2e/link_pr_and_issue_test.go | 2 +-
 backend/plugins/linker/tasks/link_pr_and_issue.go    | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/backend/plugins/linker/e2e/link_pr_and_issue_test.go b/backend/plugins/linker/e2e/link_pr_and_issue_test.go
index a199764d4..321c61723 100644
--- a/backend/plugins/linker/e2e/link_pr_and_issue_test.go
+++ b/backend/plugins/linker/e2e/link_pr_and_issue_test.go
@@ -31,7 +31,7 @@ import (
 
 func TestLinkPrToIssue(t *testing.T) {
 	var plugin impl.Linker
-	dataflowTester := e2ehelper.NewDataFlowTester(t, "issue_linker", plugin)
+	dataflowTester := e2ehelper.NewDataFlowTester(t, "linker", plugin)
 
 	regexpStr := "#(\\d+)"
 	re, err := regexp.Compile(regexpStr)
diff --git a/backend/plugins/linker/tasks/link_pr_and_issue.go b/backend/plugins/linker/tasks/link_pr_and_issue.go
index 4456f1947..39ad5aa8e 100644
--- a/backend/plugins/linker/tasks/link_pr_and_issue.go
+++ b/backend/plugins/linker/tasks/link_pr_and_issue.go
@@ -81,6 +81,9 @@ func LinkPrToIssue(taskCtx plugin.SubTaskContext) errors.Error {
 
 			issue := &ticket.Issue{}
 			if err := db.First(issue, dal.Where("issue_key = ?", issueKey)); err != nil {
+				if db.IsErrorNotFound(err) {
+					return nil, nil
+				}
 				return nil, err
 			}