Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new endpoint /api/project_pull_requests/gitlab_report for GitLab #974

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Oct 7, 2024

  1. Add new endpoint /api/project_pull_requests/gitlab_report for GitLab …

    …codeclimate
    
    The plugin [sonar-gitlab-plugin](https://github.com/javamachr/sonar-gitlab-plugin) is relying on `/api/issues/search` with _query-parameter_ `pullRequest` to retrieve information and generate json.
    
    Unfortunately the `pullRequest` parameter isn't available for CE edition.
    
    Thus I've created a new endpoint called `/api/project_pull_requests/gitlab_report` with 2 mands parameters
    
    1. `project`
    2. `pullRequest`
    
    This endpoint will transform all `OPEN` issue to `GitLab codeclimate` json format.
    
    Thus simply add following inside your `.gitlab-ci.yml` after the analysis to get report (adapt your variables name, only `CI_MERGE_REQUEST_IID` is predefined)
    
    ```
        - |
          curl -o gl-code-quality-report.json --header "Authorization: Bearer ${SONAR_TOKEN}" "${SONAR_HOST_URL}/api/project_pull_requests/gitlab_report?project=${SONAR_PROJECT_KEY}&pullRequest=${CI_MERGE_REQUEST_IID}"
      artifacts:
        reports:
          codequality: gl-code-quality-report.json
    ```
    
    And tada is working
    kakawait committed Oct 7, 2024
    Configuration menu
    Copy the full SHA
    f7aabef View commit details
    Browse the repository at this point in the history