Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

sonarqube new project after creation in gitlab

# checking if the project exists
    - export is_project_existing=$(curl https://{$SONAR_TOKEN}@sonarcloud.io/api/projects/search?organization=myorganization | grep -w  $CI_PROJECT_NAME)
    - |
        if [[ ! -z $is_project_existing ]]; then	
          echo "Project exists on sonarcloud, proceeding to analysis"
        else 
          # creating new project
          curl -X POST https://{$SONAR_TOKEN}@sonarcloud.io/api/projects/create -d "name=$CI_PROJECT_NAME&project=myorganization_$CI_PROJECT_NAME&organization=myorganization"
        fi
Source by community.sonarsource.com #
 
PREVIOUS NEXT
Tagged: #sonarqube #project #creation #gitlab
ADD COMMENT
Topic
Name
2+5 =