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/03/07 09:52:59 UTC

(incubator-devlake) branch lw-fix-v1.0-tes created (now 601a767ac)

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

lynwee pushed a change to branch lw-fix-v1.0-tes
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


      at 601a767ac fix(plugins): fix wrong resp when testing connections, fix a typo in bitbucket

This branch includes the following new commits:

     new 601a767ac fix(plugins): fix wrong resp when testing connections, fix a typo in bitbucket

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(incubator-devlake) 01/01: fix(plugins): fix wrong resp when testing connections, fix a typo in bitbucket

Posted by ly...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lynwee pushed a commit to branch lw-fix-v1.0-tes
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit 601a767acd4868a9ffdccc3edcf6c7da48ca0e6d
Author: Lynwee Hou <li...@merico.dev>
AuthorDate: Thu Mar 7 17:52:44 2024 +0800

    fix(plugins): fix wrong resp when testing connections, fix a typo in bitbucket
---
 backend/plugins/bitbucket/api/blueprint_v200.go | 2 +-
 backend/plugins/opsgenie/api/connection.go      | 6 +++---
 backend/plugins/pagerduty/api/connection.go     | 4 ++--
 backend/plugins/sonarqube/api/connection_api.go | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/backend/plugins/bitbucket/api/blueprint_v200.go b/backend/plugins/bitbucket/api/blueprint_v200.go
index f1547df5c..c419c20d3 100644
--- a/backend/plugins/bitbucket/api/blueprint_v200.go
+++ b/backend/plugins/bitbucket/api/blueprint_v200.go
@@ -84,7 +84,7 @@ func makeDataSourcePipelinePlanV200(
 		}
 		// construct task options for Jira
 		task, err := helper.MakePipelinePlanTask(
-			"bamboo",
+			"bitbucket",
 			subtaskMetas,
 			scopeConfig.Entities,
 			tasks.BitbucketOptions{
diff --git a/backend/plugins/opsgenie/api/connection.go b/backend/plugins/opsgenie/api/connection.go
index d53b8b00a..8cc7340b3 100644
--- a/backend/plugins/opsgenie/api/connection.go
+++ b/backend/plugins/opsgenie/api/connection.go
@@ -51,7 +51,7 @@ func testOpsgenieConn(ctx context.Context, connection models.OpsgenieConn) (*plu
 		return nil, errors.HttpStatus(http.StatusForbidden).New("API Key need 'Read' and 'Configuration access' Access rights")
 	}
 
-	if response.StatusCode == http.StatusOK {
+	if response.StatusCode == http.StatusOK || response.StatusCode == http.StatusAccepted {
 		return &plugin.ApiResourceOutput{Body: nil, Status: http.StatusOK}, nil
 	}
 
@@ -79,7 +79,7 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource
 	if testConnectionErr != nil {
 		return nil, plugin.WrapTestConnectionErrResp(basicRes, testConnectionErr)
 	}
-	return &plugin.ApiResourceOutput{Body: testConnectionResult, Status: http.StatusOK}, nil
+	return testConnectionResult, nil
 }
 
 // TestConnection test opsgenie connection
@@ -101,7 +101,7 @@ func TestConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput,
 	if testConnectionErr != nil {
 		return nil, plugin.WrapTestConnectionErrResp(basicRes, testConnectionErr)
 	}
-	return &plugin.ApiResourceOutput{Body: testConnectionResult, Status: http.StatusOK}, nil
+	return testConnectionResult, nil
 }
 
 // @Summary create opsgenie connection
diff --git a/backend/plugins/pagerduty/api/connection.go b/backend/plugins/pagerduty/api/connection.go
index 0c29062ec..13be31f96 100644
--- a/backend/plugins/pagerduty/api/connection.go
+++ b/backend/plugins/pagerduty/api/connection.go
@@ -69,7 +69,7 @@ func TestConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput,
 	if testConnectionErr != nil {
 		return nil, plugin.WrapTestConnectionErrResp(basicRes, testConnectionErr)
 	}
-	return &plugin.ApiResourceOutput{Body: testConnectionResult, Status: http.StatusOK}, nil
+	return testConnectionResult, nil
 }
 
 // TestExistingConnection test pagerduty connection
@@ -93,7 +93,7 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource
 	if testConnectionErr != nil {
 		return nil, plugin.WrapTestConnectionErrResp(basicRes, testConnectionErr)
 	}
-	return &plugin.ApiResourceOutput{Body: testConnectionResult, Status: http.StatusOK}, nil
+	return testConnectionResult, nil
 }
 
 // @Summary create pagerduty connection
diff --git a/backend/plugins/sonarqube/api/connection_api.go b/backend/plugins/sonarqube/api/connection_api.go
index 9058ce3f7..44d2c3b71 100644
--- a/backend/plugins/sonarqube/api/connection_api.go
+++ b/backend/plugins/sonarqube/api/connection_api.go
@@ -100,7 +100,7 @@ func TestConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput,
 		errMsg := fmt.Sprintf("Test connection fail, unexpected status code: %d", testConnectionResult.Status)
 		return nil, plugin.WrapTestConnectionErrResp(basicRes, errors.Default.New(errMsg))
 	}
-	return &plugin.ApiResourceOutput{Body: testConnectionResult, Status: http.StatusOK}, nil
+	return testConnectionResult, nil
 }
 
 // TestExistingConnection test sonarqube connection options
@@ -125,7 +125,7 @@ func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResource
 		errMsg := fmt.Sprintf("Test connection fail, unexpected status code: %d", testConnectionResult.Status)
 		return nil, plugin.WrapTestConnectionErrResp(basicRes, errors.Default.New(errMsg))
 	}
-	return &plugin.ApiResourceOutput{Body: testConnectionResult, Status: http.StatusOK}, nil
+	return testConnectionResult, nil
 }
 
 // PostConnections create sonarqube connection