Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cherry pick #7137 fix(plugins): fix wrong resp when testing connections, fix a typo in bitbucket to v0.21. #7138

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions backend/plugins/opsgenie/api/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions backend/plugins/pagerduty/api/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions backend/plugins/sonarqube/api/connection_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading