python-sonarqube-api icon indicating copy to clipboard operation
python-sonarqube-api copied to clipboard

How to get ALM setting key for sonarqube?

Open binbjz opened this issue 4 years ago • 7 comments

Hi, I want to get project name's git lab repository url, but I don't know how to get ALM setting key. Please help me, thanks! SonarQube Server Version: Community EditionVersion 8.9.3 (build 48735)

from sonarqube.enterprise import SonarEnterpriseClient

def sonar_ent_connector() -> SonarEnterpriseClient:
    sonarqube_ent_client = SonarEnterpriseClient(sonarqube_url=SQ_URL, token=SQ_TOKEN)
    sonar_ent_credential = sonarqube_ent_client.auth.check_credentials()

    if "true" not in sonar_ent_credential.lower():
        raise Exception("Permission authentication failure.")
    return sonarqube_ent_client

prj_key = "ABDevUtils"
sqe_connector.alm_integrations.search_gitlab_repos(almSettings="xxxx", projectName=prj_key)

binbjz avatar Dec 07 '21 09:12 binbjz

@shijl0925 Any updates for this questions ?

binbjz avatar Dec 09 '21 00:12 binbjz

how about use the create_gitlab fuction, such as:

almSettings = sonarqube_ent_client.alm_settings.create_gitlab(key, personalAccessToken, url)

shijl0925 avatar Dec 09 '21 15:12 shijl0925

  1. I have configured sonarqube server and imported all projects from git lab. Do I still need to use “create_gitlab” to create almSettings ?
  2. For function "alm_settings.create_gitlab(key, personalAccessToken, url)" key – Unique key of the GitLab instance setting, I want to know how to get the GitLab instance setting, Where do I know where to get personalAccessToken and url.

Thank you very much. @shijl0925

binbjz avatar Dec 10 '21 10:12 binbjz

Hi, @shijl0925 Could you help me to resolve this question ? I would like to get gitlab project repository url by sonar project key. so, could you provide an example?

binbjz avatar Dec 28 '21 03:12 binbjz

Hi @shijl0925, Can you provide an example of how to use Sonar Key or Sonar Name to get its git project address?

binbjz avatar Jan 03 '22 02:01 binbjz

@binbjz were you able to figure out how to do this? Facing a similar problem.

timothestes avatar Oct 31 '22 19:10 timothestes

@binbjz @timothestes Hi all, I know it's a bit late, but the almSetting is actually the configuration name.

When you go here /admin/settings?category=almintegration&alm=gitlab is the first parameter in bold.

skyheis avatar Mar 01 '24 11:03 skyheis