Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Why cant specify projectKey and projectName? #24

Open
josevavia opened this issue Oct 24, 2020 · 4 comments
Open

Why cant specify projectKey and projectName? #24

josevavia opened this issue Oct 24, 2020 · 4 comments

Comments

@josevavia
Copy link

josevavia commented Oct 24, 2020

According to docs:

projectKey: DRONE_REPO
projectName: DRONE_REPO
You could also add a file named sonar-project.properties at the root of your project to specify parameters.

why not be able to set projectKey and projectName using settings in drone pipeline?

I have a project with a lot of git branches, and I want to send to sonarqube each branch as a different project. With the actual approach, I need to set different settings in sonar-project.properties for each branch to get that.

It would be great if I can set key and project name in the plugin settings, as I have different steps in drone.yml for each branch.

I dont know if there is any technical reason for this

@josevavia
Copy link
Author

As a solution, I can get it working using following setup:

drone.yml:

  - name: sonarqube
    image: aosapps/drone-sonar-plugin
    settings:
      sonar_host:
        from_secret: sonar_host
      sonar_token:
        from_secret: sonar_token
      usingProperties: true

sonar-project.properties (in branch-1):

sonar.projectName=Branch 1
sonar.projectKey=com.domain.branch-1

sonar-project.properties (in branch-2):

sonar.projectName=Branch 2
sonar.projectKey=com.domain.branch-2

Anyway, I think it would be great that we can be able to set projectKey and projectName as settings in drone pipeline, something like this:

  - name: sonarqube
    image: aosapps/drone-sonar-plugin
    when:
      branch:
        branch-name-1
    settings:
      sonar_host:
        from_secret: sonar_host
      sonar_token:
        from_secret: sonar_token
      projectKey: com.domain-branch-1
      projectName: Branch 1


  - name: sonarqube
    image: aosapps/drone-sonar-plugin
    when:
      branch:
        branch-name-2
    settings:
      sonar_host:
        from_secret: sonar_host
      sonar_token:
        from_secret: sonar_token
      projectKey: com.domain-branch-2
      projectName: Branch 2

This way, the configuration is made in the specific step for each branch, and sonar-project.properties is not needed.

@Hpareek07
Copy link

Hi can you please help I am also facing the same issue. Not able to specify projectKey and Name parameters. I tried adding it to sonar-project.properties but it is not picking up the values. I am using drone v 0.8 , so usingProperties flag does not work for me.

@josevavia
Copy link
Author

Hi @Hpareek07 I cant help you. As you can see in my example, I am using usingProperties flag to get it work

It seems that this feature has no interest in the community. If I have some spare time I will try to fork the plugin to do it myself, but cant promise anything

@Et7f3
Copy link

Et7f3 commented Nov 28, 2022

linked to #28

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants