Skip to content
Open
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
1 change: 1 addition & 0 deletions backend/plugins/sonarqube/impl/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ func (p Sonarqube) PrepareTaskData(taskCtx plugin.TaskContext, options map[strin
Options: op,
ApiClient: apiClient,
TaskStartTime: time.Now(),
IsCloud: connection.IsCloud(),
}
// even we have project in _tool_sonaqube_projects, we still need to collect project to update LastAnalysisDate
var apiProject *models.SonarqubeApiProject
Expand Down
11 changes: 10 additions & 1 deletion backend/plugins/sonarqube/tasks/accounts_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,20 @@ func CollectAccounts(taskCtx plugin.SubTaskContext) errors.Error {
logger := taskCtx.GetLogger()
logger.Info("collect accounts")
rawDataSubTaskArgs, data := CreateRawDataSubTaskArgs(taskCtx, RAW_ACCOUNTS_TABLE)

// SonarCloud removed api/users/search - use organizations/search_members instead
// The "organization" query param is auto-added by PrepareApiClient
urlTemplate := "users/search"
if data.IsCloud {
urlTemplate = "organizations/search_members"
logger.Info("using organizations/search_members for SonarCloud")
}

collector, err := helper.NewApiCollector(helper.ApiCollectorArgs{
RawDataSubTaskArgs: *rawDataSubTaskArgs,
ApiClient: data.ApiClient,
PageSize: 100,
UrlTemplate: "users/search",
UrlTemplate: urlTemplate,
Query: func(reqData *helper.RequestData) (url.Values, errors.Error) {
query := url.Values{}
query.Set("p", fmt.Sprintf("%v", reqData.Pager.Page))
Expand Down
1 change: 1 addition & 0 deletions backend/plugins/sonarqube/tasks/task_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type SonarqubeTaskData struct {
ApiClient *api.ApiAsyncClient
LastAnalysisDate *time.Time
TaskStartTime time.Time
IsCloud bool
}

func DecodeAndValidateTaskOptions(options map[string]interface{}) (*SonarqubeOptions, errors.Error) {
Expand Down