How to integrate sonarcloud?

Hi,

I searched the community and google, but I cannot find any info with how to integrate sonarcloud in circle-ci.

Here is my test yml file.

version: 2
jobs:
  build:
    branches:
      ignore:
        - gh-pages
    docker:
      - image: rikorose/gcc-cmake
    steps:
      - checkout
      - run:
          name: build
          command: |
            cd dep
            chmod -R 755 build_dep.sh 
            ./build_dep.sh
            cd ..
            if [ -d "build" ]; then rm -rf build; fi
            mkdir build && cd build
            cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DENABLE_COVERAGE=OFF ..
            make -j 4
      #- run:
      #    name: Install sonarqube
      #    command: |
      #      wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.3.0.1492-linux.zip
      #      unzip sonar-scanner-cli-3.3.0.1492-linux.zip
      #- run:
      #    name: Run Sonarqube scanner
      #    command: |
      #      export SONARQUBE_TOKEN=<My token>
      #      eval ./sonar-scanner-3.3.0.1492-linux/bin/sonar-scanner -Dsonar.projectKey=ark \
      #      -Dsonar.organization=ark-game \
      #      -Dsonar.projectName=ARK \
      #      -Dsonar.sources=../frame/ \
      #      -Dsonar.sourceEncoding=UTF-8 \
      #      -Dsonar.exclusions=**proto** \
      #      -Dsonar.host.url=https://sonarcloud.io \
      #      -Dsonar.projectVersion=0.9.4 \
      #      -Dsonar.login=${SONARQUBE_TOKEN} \
      #      -Dsonar.password= -X

But I don’t know where to get this token in circle-ci. In travis-ci I can get this token by using travis-cli.

Waiting for the reply, thanks.

Hello and welcome! You can generate a CircleCI API token from this page https://circleci.com/account/api

https://circleci.com/docs/2.0/managing-api-tokens/#creating-a-personal-api-token

If you are looking for a SonarQube Token, perhaps https://docs.sonarqube.org/latest/user-guide/user-token/ and what you are looking for.

Thanks a lot, I’ll try this way.