This is an automated email from the ASF dual-hosted git repository.
abeizn pushed a commit to branch release-v0.21
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/release-v0.21 by this push:
new d1eed6cab fix: sonarqube connection delete on no scope config (#7093)
(#7103)
d1eed6cab is described below
commit d1eed6cabe8878f05954adc93fdb9a315e525b68
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Mar 5 11:13:47 2024 +0800
fix: sonarqube connection delete on no scope config (#7093) (#7103)
* fix: sonarqube connection delete on no scope config
Co-authored-by: abeizn <[email protected]>
---
backend/plugins/sonarqube/api/blueprint_v200.go | 54 +++++++++++--------------
backend/plugins/sonarqube/api/init.go | 5 ++-
2 files changed, 27 insertions(+), 32 deletions(-)
diff --git a/backend/plugins/sonarqube/api/blueprint_v200.go
b/backend/plugins/sonarqube/api/blueprint_v200.go
index cd396541b..250b1bf1d 100644
--- a/backend/plugins/sonarqube/api/blueprint_v200.go
+++ b/backend/plugins/sonarqube/api/blueprint_v200.go
@@ -29,7 +29,6 @@ import (
"github.com/apache/incubator-devlake/core/models/domainlayer/codequality"
"github.com/apache/incubator-devlake/core/models/domainlayer/didgen"
"github.com/apache/incubator-devlake/core/plugin"
- "github.com/apache/incubator-devlake/core/utils"
helper "github.com/apache/incubator-devlake/helpers/pluginhelper/api"
"github.com/apache/incubator-devlake/helpers/srvhelper"
"github.com/apache/incubator-devlake/plugins/sonarqube/models"
@@ -72,7 +71,7 @@ func MakeDataSourcePipelinePlanV200(
func makeDataSourcePipelinePlanV200(
subtaskMetas []plugin.SubTaskMeta,
- scopeDetails []*srvhelper.ScopeDetail[models.SonarqubeProject,
models.SonarqubeScopeConfig],
+ scopeDetails []*srvhelper.ScopeDetail[models.SonarqubeProject,
srvhelper.NoScopeConfig],
connection *models.SonarqubeConnection,
) (coreModels.PipelinePlan, errors.Error) {
plan := make(coreModels.PipelinePlan, len(scopeDetails))
@@ -81,48 +80,43 @@ func makeDataSourcePipelinePlanV200(
if stage == nil {
stage = coreModels.PipelineStage{}
}
-
- scope, scopeConfig := scopeDetail.Scope, scopeDetail.ScopeConfig
+ scope := scopeDetail.Scope
// construct task options
- if utils.StringsContains(scopeConfig.Entities,
plugin.DOMAIN_TYPE_CODE_QUALITY) {
- task, err := helper.MakePipelinePlanTask(
- "sonarqube",
- subtaskMetas,
- nil,
- tasks.SonarqubeOptions{
- ConnectionId: scope.ConnectionId,
- ProjectKey: scope.ProjectKey,
- },
- )
- if err != nil {
- return nil, err
- }
-
- stage = append(stage, task)
- plan[i] = stage
+ task, err := helper.MakePipelinePlanTask(
+ "sonarqube",
+ subtaskMetas,
+ nil,
+ tasks.SonarqubeOptions{
+ ConnectionId: scope.ConnectionId,
+ ProjectKey: scope.ProjectKey,
+ },
+ )
+ if err != nil {
+ return nil, err
}
+
+ stage = append(stage, task)
+ plan[i] = stage
}
return plan, nil
}
func makeScopesV200(
- scopeDetails []*srvhelper.ScopeDetail[models.SonarqubeProject,
models.SonarqubeScopeConfig],
+ scopeDetails []*srvhelper.ScopeDetail[models.SonarqubeProject,
srvhelper.NoScopeConfig],
connection *models.SonarqubeConnection,
) ([]plugin.Scope, errors.Error) {
scopes := make([]plugin.Scope, 0)
for _, scopeDetail := range scopeDetails {
- sonarqubeProject, scopeConfig := scopeDetail.Scope,
scopeDetail.ScopeConfig
+ sonarqubeProject := scopeDetail.Scope
// add board to scopes
- if utils.StringsContains(scopeConfig.Entities,
plugin.DOMAIN_TYPE_CODE_QUALITY) {
- domainBoard := &codequality.CqProject{
- DomainEntity: domainlayer.DomainEntity{
- Id:
didgen.NewDomainIdGenerator(&models.SonarqubeProject{}).Generate(sonarqubeProject.ConnectionId,
sonarqubeProject.ProjectKey),
- },
- Name: sonarqubeProject.Name,
- }
- scopes = append(scopes, domainBoard)
+ domainBoard := &codequality.CqProject{
+ DomainEntity: domainlayer.DomainEntity{
+ Id:
didgen.NewDomainIdGenerator(&models.SonarqubeProject{}).Generate(sonarqubeProject.ConnectionId,
sonarqubeProject.ProjectKey),
+ },
+ Name: sonarqubeProject.Name,
}
+ scopes = append(scopes, domainBoard)
}
return scopes, nil
diff --git a/backend/plugins/sonarqube/api/init.go
b/backend/plugins/sonarqube/api/init.go
index 25ec647f6..9d3ca84f4 100644
--- a/backend/plugins/sonarqube/api/init.go
+++ b/backend/plugins/sonarqube/api/init.go
@@ -21,6 +21,7 @@ import (
"github.com/apache/incubator-devlake/core/context"
"github.com/apache/incubator-devlake/core/plugin"
"github.com/apache/incubator-devlake/helpers/pluginhelper/api"
+ "github.com/apache/incubator-devlake/helpers/srvhelper"
"github.com/apache/incubator-devlake/plugins/sonarqube/models"
"github.com/go-playground/validator/v10"
)
@@ -28,7 +29,7 @@ import (
var vld *validator.Validate
var basicRes context.BasicRes
-var dsHelper *api.DsHelper[models.SonarqubeConnection,
models.SonarqubeProject, models.SonarqubeScopeConfig]
+var dsHelper *api.DsHelper[models.SonarqubeConnection,
models.SonarqubeProject, srvhelper.NoScopeConfig]
var raProxy *api.DsRemoteApiProxyHelper[models.SonarqubeConnection]
var raScopeList *api.DsRemoteApiScopeListHelper[models.SonarqubeConnection,
models.SonarqubeProject, SonarqubeRemotePagination]
var raScopeSearch
*api.DsRemoteApiScopeSearchHelper[models.SonarqubeConnection,
models.SonarqubeProject]
@@ -39,7 +40,7 @@ func Init(br context.BasicRes, p plugin.PluginMeta) {
dsHelper = api.NewDataSourceHelper[
models.SonarqubeConnection,
models.SonarqubeProject,
- models.SonarqubeScopeConfig,
+ srvhelper.NoScopeConfig,
](
br,
p.Name(),