Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get ALM setting key for sonarqube? #40

Open
binbjz opened this issue Dec 7, 2021 · 7 comments
Open

How to get ALM setting key for sonarqube? #40

binbjz opened this issue Dec 7, 2021 · 7 comments

Comments

@binbjz
Copy link

binbjz commented Dec 7, 2021

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
Copy link
Author

binbjz commented Dec 9, 2021

@shijl0925 Any updates for this questions ?

@shijl0925
Copy link
Owner

how about use the create_gitlab fuction, such as:

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

@binbjz
Copy link
Author

binbjz commented Dec 10, 2021

  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
Copy link
Author

binbjz commented Dec 28, 2021

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
Copy link
Author

binbjz commented Jan 3, 2022

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

@timothestes
Copy link

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

@skyheis
Copy link

skyheis commented Mar 1, 2024

@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.

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

No branches or pull requests

4 participants