Sonarqube Gitlab integration gitlab-ci yaml question

Hi I want to set up integration in self hosted gitlab.

This is the .gitlab-ci.yaml template:

    name: sonarsource/sonar-scanner-cli:latest
    entrypoint: [""]
    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
    key: "${CI_JOB_NAME}"
      - .sonar/cache
    - sonar-scanner -Dsonar.qualitygate.wait=true
  allow_failure: true
    - merge_requests
    - master # or the name of your main branch
    - develop

In the script, am I supposed to provide the proper, entire list of arguments for sonar-scanner command? So like the login token, project key, etc?

Hey there.

After creating the project in SonarQube, SonarQube will walk you through how to configure everything (what to set in a file, environment variables, etc.)

Is it possible to create and configure new project automatically? For example, when someone create a new project in GitLab, it automatically links with GitLab and create a project that way.