bgamari / dhall-gitlab-ci

A Dhall encoding of the GitLab CI configuration schema
BSD 3-Clause "New" or "Revised" License
46 stars 19 forks source link

Generated JSON does not include test report key #17

Open m4dc4p opened 1 year ago

m4dc4p commented 1 year ago

The JSON generated for a job containing a test report does NOT include that report (even though it is specified in the Dhall source). (The JSON should contain a artifacts:report:sjunit value as specified at https://docs.gitlab.com/ee/ci/yaml/index.html#artifactsreports.)

For example, this (intended to be run from the top-level directory):

let GitLab =./package.dhall

let Prelude = GitLab.Prelude

let renderTop = GitLab.Top.toJSON

let When = GitLab.When.Type

let jobWithReport =
      GitLab.Job::{
      , stage = Some "build"
      , image = Some { name = "alpine:latest", entrypoint = Some [ " " ] }
      , script = [ "echo 'Hello World'" ]
      -- generated JSON will include NOT "reports" key
      , artifacts = Some
            { when = When.Always
                  , expire_in.seconds = 365 * 24 * 60 * 60
                  , paths = [ "report.xml" ]
                  , reports = { junit = Some "report.xml" }
            }
      }

let top = GitLab.Top::{ jobs = toMap { 
      job-with-report = jobWithReport
} }

in  Prelude.JSON.renderYAML (renderTop top)

produces the following JSON, which does NOT include the artifacts:reports:junit key:

"job-with-report":
  "allow_failure": false
  "artifacts":
    "expire_in": "31536000 second"
    "paths":
      - "report.xml"
    "when": "always"
  "image":
    "entrypoint":
      - " "
    "name": "alpine:latest"
  "script":
    - "echo 'Hello World'"
  "stage": "build"
  "variables": {}
"variables":
  "GIT_SUBMODULE_STRATEGY": "normal"
m4dc4p commented 1 year ago

See #18 for a fix. Note that the reports key will NOT appear in the output if no value is given (so existing files should not see any change, except more correct output.)