Skip to content

fix: sonarqube: missing api/users/search endpoint (#8813)#66

Merged
psturc merged 1 commit into
konflux-ci:mainfrom
psturc:fix-sonarqube-api-search-endpoint-cherry-pick
Apr 1, 2026
Merged

fix: sonarqube: missing api/users/search endpoint (#8813)#66
psturc merged 1 commit into
konflux-ci:mainfrom
psturc:fix-sonarqube-api-search-endpoint-cherry-pick

Conversation

@psturc

@psturc psturc commented Apr 1, 2026

Copy link
Copy Markdown
Member

⚠️ Pre Checklist

Please complete ALL items in this checklist, and remove before submitting

  • I have read through the Contributing Documentation.
  • I have added relevant tests.
  • I have added relevant documentation.
  • I will add labels to the PR, such as pr-type/bug-fix, pr-type/feature-development, etc.

Summary

cherry-pick of my fix for the upstream

@snyk-io

snyk-io Bot commented Apr 1, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@qodo-code-review

Copy link
Copy Markdown

Review Summary by Qodo

Fix missing SonarCloud api/users/search endpoint

🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Add IsCloud field to detect SonarCloud vs SonarQube instances
• Use organizations/search_members endpoint for SonarCloud
• Replace deprecated api/users/search endpoint in accounts collector
• Maintain backward compatibility with self-hosted SonarQube
Diagram
flowchart LR
  A["PrepareTaskData"] -->|"Set IsCloud flag"| B["SonarqubeTaskData"]
  B -->|"Pass IsCloud"| C["CollectAccounts"]
  C -->|"IsCloud=true"| D["organizations/search_members"]
  C -->|"IsCloud=false"| E["users/search"]
Loading

Grey Divider

File Changes

1. backend/plugins/sonarqube/impl/impl.go ✨ Enhancement +1/-0

Initialize IsCloud flag in task data

• Add IsCloud field initialization in PrepareTaskData method
• Populate IsCloud by calling connection.IsCloud() method

backend/plugins/sonarqube/impl/impl.go


2. backend/plugins/sonarqube/tasks/accounts_collector.go 🐞 Bug fix +10/-1

Conditionally select endpoint for accounts collection

• Add conditional logic to select appropriate endpoint based on IsCloud flag
• Use organizations/search_members for SonarCloud instances
• Keep users/search for self-hosted SonarQube
• Add informational logging for SonarCloud endpoint selection

backend/plugins/sonarqube/tasks/accounts_collector.go


3. backend/plugins/sonarqube/tasks/task_data.go ✨ Enhancement +1/-0

Add IsCloud field to task data struct

• Add IsCloud boolean field to SonarqubeTaskData struct
• Enable downstream tasks to determine SonarCloud vs SonarQube instance type

backend/plugins/sonarqube/tasks/task_data.go


Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

Grey Divider

Looking for bugs?

Check back in a few minutes. An AI review agent is analyzing this pull request.

Grey Divider

Qodo Logo

@psturc psturc force-pushed the fix-sonarqube-api-search-endpoint-cherry-pick branch from 04fe7b1 to 305b36d Compare April 1, 2026 14:01
@psturc psturc merged commit 26cadd6 into konflux-ci:main Apr 1, 2026
6 checks passed
@psturc psturc deleted the fix-sonarqube-api-search-endpoint-cherry-pick branch April 1, 2026 14:57
psturc added a commit to psturc/infra-common-deployments that referenced this pull request Apr 1, 2026
psturc added a commit to psturc/infra-common-deployments that referenced this pull request Apr 1, 2026
openshift-merge-bot Bot pushed a commit to redhat-appstudio/infra-common-deployments that referenced this pull request Apr 1, 2026
openshift-merge-bot Bot pushed a commit to redhat-appstudio/infra-common-deployments that referenced this pull request Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants