ciricihq / gitlab-sonar-scanner

This project is no longer maintained
GNU General Public License v3.0
80 stars 62 forks source link

Missing projperty sonar.projectKey #21

Closed oko-x closed 6 years ago

oko-x commented 6 years ago

After yesterday's remove of unnecessary assignment SONAR_PROJECT_KEY=$CI_PROJECT_NAME, I get

You must define the following mandatory properties for 'Unknown': sonar.projectKey

my yml config looks like this:

sonarqube:
  stage: analysis
  image: ciricihq/gitlab-sonar-scanner
  variables:
    SONAR_URL: "https://sonarurl.sonar"
    SONAR_ANALYSIS_MODE: "issues"
    SONAR_TOKEN: "token"
    SONAR_PROJECT_KEY: "$CI_PROJECT_NAME"
    SONAR_PROJECT_NAME: "$CI_PROJECT_NAME"
    SONAR_PROJECT_VERSION: "$CI_JOB_ID"
    SONAR_GITLAB_PROJECT_ID: "$CI_PROJECT_ID"
  script:
    - /usr/bin/sonar-scanner-run.sh
  tags:
    - runner

Should I add it to the script execution like /usr/bin/sonar-scanner-run.sh -Dsonar.projectKey=$CI_PROJECT_NAME ?

gtrias commented 6 years ago

Take a look at this issue https://github.com/ciricihq/gitlab-sonar-scanner/issues/10 In resume you should define your projectKey either in the sonar-project.properties file or as a parameter of sonar-scanner-run gitlab-sonar-scanner -Dsonar.projectKey=$CI_PROJECT_NAME

oko-x commented 6 years ago

Thank you, I should have found that myself.