Skip to content

Fix error when CI entry artifacts:reports:coverage_report is set to null

Leaminn Ma requested to merge 383079-fix-artifacts-coverage-report-null into master

What does this MR do and why?

Currently, a runner error occurs when you set a job's artifacts:reports:coverage_report value to null. It is supposed to run successfully as though the coverage_report is not specified (i.e runs without producing an artifact report).

The issue is that the null value is being converted into an empty array, resulting in a config that looks like {:coverage_report=>[]}. This MR fixes this so that the null value is excluded from the conversion, resulting in a correct empty config {}.

Screenshots or screen recordings

There are two problems here:

  1. An error occurs when you run the job. Screenshot_2023-01-09_at_10.48.24_AM

  2. A minor error in the FE validation schema showing that null is an invalid value (when it should be valid). Screenshot_2023-01-09_at_10.47.08_AM

How to set up and validate locally

  1. Go to your Project's CI/CD > Editor and add the following contents:
job:
  stage: test
  script:
    - []
  artifacts:
    reports:
      coverage_report: null
  1. Observe that the FE validation error no longer occurs on the null value.

Screenshot_2023-01-09_at_11.10.43_AM

  1. Commit the change and let the pipeline run. Observe that the job runs successfully without error.

Screenshot_2023-01-09_at_11.12.17_AM

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #383079 (closed)

Edited by Leaminn Ma

Merge request reports