📜  在 gitlab 中创建后的 sonarqube 新项目 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:50:38.736000             🧑  作者: Mango

代码示例1
# 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