which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
Hi, I’m new to sonarQube, our company is using enterprise edition of sonarQube with version 7.x
what are you trying to achieve
We own our own CI/CD platform(internal to our company). Here, when a pull request is raised then we trigger the corresponding pipeline. We run sonar PR branch analysis as a part of pipeline execution. Our goal is: on Pull request merge, we want to use this same analysis results and populate it as pull request’s base branch analysis in sonarQube
I would like to know the better way of doing it.
what have you tried so far to achieve this
I found this api POST api/project_analyses/set_baseline and tried to set one branch’s analysis result to the another branch
While trying this API, I’m getting 401 Unauthorised error, even after using Administrator credentials
Here I’m attaching a screenshot of the API that I’m using. And I’m using the parameters as query params.
Hi, any update on this?
How to use this https://sonarcloud.io/web_api/api/project_analyses/set_baseline API in sonarQube? with admin credentials, I’m getting 401 Unauthorised error
Welcome to the community!
I’ve folded your other thread into this one since it’s on the same topic. So you know, this community is peopled by folks who help out here in their spare time or as a work-hobby (i.e. spare time at work). There’s generally not anyone sitting around looking for new threads to answer. So it’s entirely normal to go a day or two or even three or four before getting an answer.
So… there are a couple things here. You’re on version “7.x”. Functionality gets added and updated in every version, so knowing your precise version can make a difference.
Your other thread (folded in here as post 3) cites a SonarCloud API documentation. That may or may not represent the functionality you have access to in your “7.x” instance.
At root, your complaint is a 401 error while calling a web service. The docs on calling the Web API may help.
To be honest, it’s not clear to me from your description that what you’re attempting to do via the API is even doable in the latest version of SonarQube. My best advice to you is to accomplish your goal via the UI and use your browser’s web tools to eavesdrop on what web services the UI calls to accomplish the job.
Hi Ann, thanks for replying.
Our sonarQube version is 7.9.3
Can you help out in pointing to UI where this API is being called?
IIRC, in 7.9.* you’ll find it under Administration -> General Settings. And BTW, are you sure this API exists in your version? Do you find it listed in your on-board API documentation?
Yes this API is present in our version. API is available since version 7.7 and ours is 7.9.3.
In UI, I’m still not able to find it under Administration -> General Settings
Re-reading your OP to brush up on the context, I was struck by this:
The meaning is still not clear to me, but if you’re trying to set an analysis from one branch/PR as the baseline for a different branch/PR, it’s not going to work.
Are you looking at project-level Administration?
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.