Commit 97aaad24 authored by Totara-thib's avatar Totara-thib
Browse files

fix(mega_linter): remove junit reports and update image

parent 1aa69322
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
# Changelog
All notable changes to this job will be documented in this file.

## [1.8.0] - 2023-01-18
* Bump megalinter image version to v6.18.0
* Remove Junit reports

## [1.7.0] - 2022-12-11
* Set `SARIF_REPORTER` to true to enable the SARIF reporter
* Use name in `artifact:paths` instead of variable because they are not expanded there
+3 −8
Original line number Diff line number Diff line
@@ -46,11 +46,10 @@ customize its behavior.
| `MEGALINTER_CONFIG` | MegaLinter configuration file location | `.mega_linter.yml` |
| `VALIDATE_ALL_CODEBASE` | Whether linters should only go through **edited** or **new** files | `true` |
| `REPORT_OUTPUT_FOLDER` | Folder where are stored all the reports | `megalinter-reports` |
| `CONVERTED_OUTPUT_FOLDER` | Folder where are stored `JUnit` or `CodeClimate` reports | `converted-xml.report` |
| `CONVERTED_OUTPUT_FOLDER` | Folder where are stored `CodeClimate` reports | `converted-xml.report` |
|`GITLAB_COMMENT_REPORTER` | Posts Mega-Linter results summary in the comments of the related merge request ([⚠️ GitLab API access require](https://oxsecurity.github.io/megalinter/latest/reporters/GitlabCommentReporter/#configuration){:target="_blank"}) | `true` |
| `REPORT_SUITE_TEST_NAME` | `JUnit` report suites name | `mega_linter` |
| `DISABLE_LINTERS` | Comma separated list of linters to be disabled | ` ` |
| `IMAGE_TAG` | The default tag for the docker image | `v6.13.0` |
| `IMAGE_TAG` | The default tag for the docker image | `v6.18.0` |

## Optimize MegaLinter

@@ -71,14 +70,10 @@ mega_linter:

## Artifacts

Two formats are available for the artifacts:
- [JUnit](https://junit.org/junit5/)'s XML report to display error report directly in pipeline `Test` tab and in
merge request widget.
- [CodeClimate](https://codeclimate.com/quality)'s JSON report to display error report directly in merge request widget.

## Dependencies
The job uses the following dependencies for converting the `output` to `JUnit` or `CodeClimate`:
- [sarif-junit](https://www.npmjs.com/package/sarif-junit) tool to convert `SARIF` to `JUnit`
The job uses the following dependencies for converting the `output` to `CodeClimate`:
- [sarif-codeclimate](https://www.npmjs.com/package/sarif-codeclimate) tool to convert `SARIF` to `CodeClimate`

## Author and contributors
+2 −4
Original line number Diff line number Diff line
@@ -37,9 +37,8 @@ mega_linter:
    ### Custom variables
    # End folder where reports are held
    CONVERTED_OUTPUT_FOLDER: "converted-xml.report"
    # Name of the test suite in JUnit
    REPORT_SUITE_TEST_NAME: "mega_linter"
    IMAGE_TAG: "v6.13.0"
    # Image tag of the MegaLinter image used in this job
    IMAGE_TAG: "v6.18.0"
  script:
    - FAILED=false
    - |
@@ -54,7 +53,6 @@ mega_linter:
    - cp ${CI_PROJECT_DIR}/${REPORT_OUTPUT_FOLDER}/megalinter-report.sarif ${CI_PROJECT_DIR}/${CONVERTED_OUTPUT_FOLDER}
    - cd ${CI_PROJECT_DIR}/${CONVERTED_OUTPUT_FOLDER}
    - npx -y sarif-codeclimate@1.0.2 -i megalinter-report.sarif -o code-climate.json
    - npx -y sarif-junit@1.1.3 -i megalinter-report.sarif -o junit.xml --test-suite ${REPORT_SUITE_TEST_NAME}
    - if [ "$FAILED" = true ]; then
    -   exit 1
    - fi