Commit 937671d2 authored by Mathis Goichon's avatar Mathis Goichon
Browse files

feat: remove html reports

parent 48f73afb
Loading
Loading
Loading
Loading
+11 −28
Original line number Diff line number Diff line
@@ -232,45 +232,28 @@ More info:
* [test coverage & execution parameters](https://docs.sonarqube.org/latest/analysis/coverage/)
* [third-party issues](https://docs.sonarqube.org/latest/analysis/external-issues/)

### `node-npm-audit` job
### `node-audit` job

The Node template features a job `node-npm-audit` that performs [npm audit](https://docs.npmjs.com/cli/audit) to find vulnerabilities (security).
The Node template features a job `node-audit` that performs [npm audit](https://docs.npmjs.com/cli/audit) to find vulnerabilities (security).

It is bound to the `test` stage.
It is bound to the `test` stage. By default `npm audit` provide a long json report. 

By default `npm audit` provide a long json report. For readability, `npm-audit-html` is used to generate an HTML report.

Add the package as a development dependency:

```shell
npm install --save-dev npm-audit-html
```

| Name                   | description                                                                                  | default value                            |
| --------------------- | -----------------  | ----------------- |
|------------------------|----------------------------------------------------------------------------------------------|------------------------------------------|
| `NODE_AUDIT_DISABLED`  | Set to `true` to disable npm audit                                                           | _none_ (enabled)                         |
| `NODE_AUDIT_ARGS`      | NPM [audit](https://docs.npmjs.com/cli/audit) arguments                                      | `--audit-level=low`                      |
| `NODE_AUDIT_JSON_PATH` | NPM [audit](https://docs.npmjs.com/cli/audit) JSON report path                               | `reports/npm-audit-report.json`          |
| `NODE_AUDIT_HTML_ARGS`| NPM [audit HTML](https://www.npmjs.com/package/npm-audit-html) report generation arguments | `--output reports/npm-audit-report.html` |

### `node-npm-outdated` job

The Node template features a job `node-npm-outdated` that performs [npm outdated](https://docs.npmjs.com/cli/outdated) to find dependencies that might be updated.

It is bound to the `test` stage.
The Node template features a job `node-outdated` that performs [npm outdated](https://docs.npmjs.com/cli/outdated) to find dependencies that might be updated.

By default `npm outdated` provide a long json report. For readability, `npm-outdated-html` is used to generate an HTML report.

Add the package as a development dependency:

```shell
npm install --save-dev npm-outdated-html
```
It is bound to the `test` stage. By default `npm outdated` provide a long json report. 

| Name                      | description                                                                                      | default value                               |
|---------------------------|--------------------------------------------------------------------------------------------------|---------------------------------------------|
| `NODE_OUTDATED_DISABLED`  | Set to `true` to disable npm outdated                                                            | _none_ (enabled)                            |
| `NODE_OUTDATED_ARGS`      | NPM [outdated](https://docs.npmjs.com/cli/outdated) arguments                                    | `--long`                                    |
| `NODE_OUTDATED_JSON_PATH` | NPM [outdated](https://docs.npmjs.com/cli/outdated) JSON report path                             | `reports/npm-outdated-report.json`          |
| `NODE_OUTDATED_HTML_ARGS` | NPM [outdated HTML](https://www.npmjs.com/package/npm-outdated-html) report generation arguments | `--output reports/npm-outdated-report.html` |
+0 −12
Original line number Diff line number Diff line
@@ -89,12 +89,6 @@
          "description": "NPM [audit](https://docs.npmjs.com/cli/audit) JSON report path",
          "default": "reports/npm-audit-report.json",
          "advanced": true
        },
        {
          "name": "NODE_AUDIT_HTML_ARGS",
          "description": "NPM [audit HTML](https://www.npmjs.com/package/npm-audit-html) report generation arguments",
          "default": "--output reports/npm-audit-report.html",
          "advanced": true
        }
      ]
    },
@@ -114,12 +108,6 @@
          "description": "NPM [outdated](https://docs.npmjs.com/cli/outdated) JSON report path",
          "default": "reports/npm-outdated-report.json",
          "advanced": true
        },
        {
          "name": "NODE_OUTDATED_HTML_ARGS",
          "description": "NPM [outdated HTML](https://www.npmjs.com/package/npm-outdated-html) report generation arguments",
          "default": "--output reports/npm-outdated-report.html",
          "advanced": true
        }
      ]
    }
+5 −11
Original line number Diff line number Diff line
@@ -45,19 +45,13 @@ variables:
  # Gitlab JUnit test report
  NODE_UNIT_TEST_REPORT_PATH: "reports/unit_test_report.xml"

  # NodeJsScan
  NODEJSSCAN_IMAGE: 'opensecurity/njsscan:latest'

  # NPM audit
  # deprecated - kept for retro-compatibility purpose
  # Audit
  NODE_AUDIT_LEVEL: "low"
  NODE_AUDIT_ARGS: "--audit-level=$NODE_AUDIT_LEVEL"
  NODE_AUDIT_HTML_ARGS: "--output reports/npm-audit-report.html"
  NODE_AUDIT_JSON_PATH: "reports/npm-audit-report.json"

  # NPM outdated
  # Outdated
  NODE_OUTDATED_ARGS: "--long"
  NODE_OUTDATED_HTML_ARGS: "--output reports/npm-outdated-report.html"
  NODE_OUTDATED_JSON_PATH: "reports/npm-outdated-report.json"

  # default production ref name (pattern)
@@ -303,12 +297,12 @@ node-lint:
###############################################################################################

# audit
node-npm-audit:
node-audit:
  extends: .node-base
  stage: test
  script:
    - mkdir -p reports
    - npm audit --json $NODE_AUDIT_ARGS | tee $NODE_AUDIT_JSON_PATH | npx npm-audit-html $NODE_AUDIT_HTML_ARGS
    - npm audit --json $NODE_AUDIT_ARGS | tee $NODE_AUDIT_JSON_PATH
  artifacts:
    name: "$CI_JOB_NAME artifacts from $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG"
    expire_in: 1 day
@@ -331,7 +325,7 @@ node-npm-outdated:
  stage: test
  script:
    - mkdir -p reports
    - npm outdated --json $NODE_OUTDATED_ARGS | tee $NODE_OUTDATED_JSON_PATH | npx npm-outdated-html $NODE_OUTDATED_HTML_ARGS
    - npm outdated --json $NODE_OUTDATED_ARGS | tee $NODE_OUTDATED_JSON_PATH
  artifacts:
    name: "$CI_JOB_NAME artifacts from $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG"
    expire_in: 1 day