Dears,
I added a project in Gitlab and configuring analysis however sonarcloud is not able to analyse my code on Gitlab.
i followed the steps in " Analyze with GitLab CI/CD Pipeline":
a. Define the SonarCloud Token environment variable
In GitLab, go to Settings > CI/CD > Variables to add the following variable and make sure it is available for your project:
- In the Key field, enter
SONAR_TOKEN
- In the Value field, enter
9033a219261e4b8484f304e305e9cffc62301e1b
- Make sure that the Protect variable checkbox is unticked
- Make sure that the Mask variable checkbox is ticked
b. Define the SonarCloud URL environment variable
Still in Settings > CI/CD > Variables add a new variable and make sure it is available for your project:
- In the Key field, enter
SONAR_HOST_URL
- In the Value field, enter
https://sonarcloud.io
- Make sure that the Protect variable checkbox is unticked
- No need to tick the Mask variable checkbox this time
Updated the .gitlab-ci.yml
file’
‘’’
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
sonarcloud-check:
image:
name: sonarsource/sonar-scanner-cli:latest
entrypoint: [""]
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
script:
- sonar-scanner
only:
- merge_requests
- master
- develop
Created a sonar-project.properties
file:
sonar.projectKey=sast11_sast1-project
sonar.organization=sast11
# This is the name and version displayed in the SonarCloud UI.
#sonar.projectName=sast1 project
#sonar.projectVersion=1.0
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
#sonar.sources=.
# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8
-
ALM used (GitLab)
-
CI system used (GitLab)
-
Languages of the repository (Python)
-
Only if the SonarCloud project is public, the URL (sast1 / sast1 project · GitLab)
-
Error observed (no errors observed)
-
Steps to reproduce ( just do the Analyze with GitLab CI/CD Pipeline steps)
-
What are you seeing, and how does that differ from what you expect to see?
i’m not able to see the analysis SAST of my code on gitlab
=
=