GitLab integration fails

i followed your suggestions - i don’t see a change in the result
raw-additional-info.txt (21.5 KB)
the new job definition is:

  stage: sonar-check
    name: ${CYBELLUM_PSA_REGISTRY}/sonarsource/sonar-scanner-cli:5.0.1
    entrypoint: [""]
  tags: !reference [.global_tags, tags]
  retry: !reference [.global_retry, retry]
    SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"  # Defines the location of the analysis task
    GIT_DEPTH: "0"  # Tells git to fetch all the branches of the project, required by the analysis task
    key: "${CI_JOB_NAME}"
      - .sonar/cache
    - 'echo "sonar-values:"'
    - 'echo "  sonar.token: ${SONAR_TOKEN}"'
    - 'echo " ${SONAR_HOST_URL}"'
    - 'echo "  sonar.pullrequest.key: ${CI_MERGE_REQUEST_IID}"'
    - 'echo "  sonar.pullrequest.base: ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}"'
    - 'echo "  sonar.pullrequest.branch: ${CI_COMMIT_REF_NAME}"'
    - sonar-scanner -X -Dsonar.pullrequest.key=${CI_MERGE_REQUEST_IID} -Dsonar.pullrequest.base=${CI_MERGE_REQUEST_TARGET_BRANCH_NAME} -Dsonar.pullrequest.branch=${CI_COMMIT_REF_NAME}
  needs: []
    - if: $Flow=="sonar_check"
      when: always
      allow_failure: true

Ok, it is good to see that these are being passed correctly. I noticed that you are seeing an authentication issue in the logs you last sent me:

06:35:27.485 INFO: Load branch configuration
06:35:27.486 DEBUG: Found manual configuration of branch/PR analysis. Skipping automatic configuration.
06:35:27.905 DEBUG: GET 401***********&pullrequestKey=********* | time=418ms

Do you have access to see the Access Tokens which have been created on the account? If so can you tell me which values you have defined in the scope?

current gitlab token used have the following permissions: api, read_api, create_runner, read_repository, write_repository, read_registry, write_registry
the token used for the sonarcloud does not have specific permissions but it is belong to a user in the admin group

the error you pointed to is an error in a request to sonar, and not an error in calling gitlab so my guess is that the sonar token is more relevant

issue is now fixed - after i replaced the gitlab token that exists on the sonarcloud administration ui with a new token that belong to the same user and with the same permissions

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.