gabrie-allaigre / sonar-gitlab-plugin

Add to each commit GitLab in a global commentary on the new anomalies added by this commit and add comment lines of modified files
GNU Lesser General Public License v3.0
713 stars 208 forks source link

'GitLab Commit Issue Publisher' skipped because one of the required properties is missing #273

Closed pavelpraulov closed 4 years ago

pavelpraulov commented 4 years ago

I've been trying to diagnose this issue without any luck. As far as I can tell, I have all the required configurations:

image: java:8-jdk

before_script:
  - export GRADLE_USER_HOME=`pwd`/.gradle

cache:
  paths:
    - .gradle/wrapper
    - .gradle/caches

variables:
  SONAR_URL: http://192.168.74.12:9000/
  SONAR_TOKEN: <SONAR_TOKEN>
  SONAR_PROJECT_KEY: sonarqube-scanner-gradle
  SONAR_PROJECT_NAME: sonarqube-scanner-gradle
  GITLAB_ACCESS_TOKEN: <GITLAB_ACCESS_TOKEN>

after_script:
  - echo "End CI"

sonarqube_preview_feature_job:
  stage: test
  only:
    - /^task\/*/
  script:
    - git config user.email <user.email> && git config user.name <user.name>    
    - git checkout origin/master
    - git merge $CI_COMMIT_SHA --no-commit --no-ff
    - ./gradlew --debug :sonarqube
      -Dsonar.login=$SONAR_TOKEN
      -Dsonar.host.url=$SONAR_URL
      -Dsonar.projectName=$SONAR_PROJECT_NAME
      -Dsonar.projectKey=$SONAR_PROJECT_KEY
      -Dsonar.gitlab.user_token="$GITLAB_ACCESS_TOKEN"
      -Dsonar.gitlab.project_id=$CI_PROJECT_PATH
      -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA
      -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME
      -Dsonar.analysis.mode=publish

The script succeeds however Gitlab isn't updated and the following message is logged:

[INFO]  [org.sonarqube.gradle.SonarQubeTask] Analysis report uploaded in 12ms
[INFO]  [org.sonarqube.gradle.SonarQubeTask] ANALYSIS SUCCESSFUL, you can browse http://192.168.74.12:9000/dashboard?id=sonarqube-scanner-gradle
[INFO]  [org.sonarqube.gradle.SonarQubeTask] Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
[INFO]  [org.sonarqube.gradle.SonarQubeTask] More about the report processing at http://192.168.74.12:9000/api/ce/task?id=AXBX2OmEPnOJAFLW2U-I
[DEBUG] [org.sonarqube.gradle.SonarQubeTask] Report metadata written to /builds/uname/sonar-gitlab-kotlin/build/sonar/report-task.txt
[DEBUG] [org.sonarqube.gradle.SonarQubeTask] 'GitLab Commit Issue Publisher' skipped because one of the required properties is missing

As I know:

Required is gitlab url, user token for gitlab, sha and project id

all of these properties are existed, but I still have the problem.


SonarQube CE 7.9.2 (build 30863) GitLab CE 12.3.5 sonar-gitlab-plugin 4.1.0

kortov commented 4 years ago

I guess for this sonar version you should use this PR, but not sure https://github.com/gabrie-allaigre/sonar-gitlab-plugin/pull/253

rusguliev commented 4 years ago

Hi, try replacing the parameter "$CI_PROJECT_PATH" with "$CI_PROJECT_ID", most likely the matter is in this parameter.

pavelpraulov commented 4 years ago

@kortov , @rusguliev first of all, thank you for your quick response.

I guess for this sonar version you should use this PR, but not sure #253

I will try this way for sure.

try replacing the parameter "$CI_PROJECT_PATH" with "$CI_PROJECT_ID"

Unfortunately, the same result.

Anyway, once again spasibo.

rusguliev commented 4 years ago

as already mentioned by @kortov, the version of sonar-gitlab-plugin 4.1.0 is not compatible with SonarQube 7.9.2.

pavelpraulov commented 4 years ago

Yes, right, the problem was solved after migrating to javamachr/sonar-gitlab-plugin and installing sonarqube-community-branch-plugin Thanks!