Config.yml error reporting extremely obscure


#1

Hi all, not the greatest yaml expert myself but the error reporting for ill-written yaml file is very obscure.

example:

- persist_to_workspace:
    root: /tmp/workspace
    paths:
      - target/application.jar
      - build/*
  • Config file is invalid:
    at jobs.steps.7: jobs.steps.7: Must validate one and only one schema (oneOf)
    at jobs.steps.7: jobs.steps.7: Invalid type. Expected: [object,string], given: array
  1. Missing line number of actual error
  2. Error looks like an internal syntax error of your ymal parser but hard to understand out of context
  3. Not sure if that’s a syntax error or it depends from interpreting the config file itself, as I’ve just tried that sample from your docs.
  4. Not sure where the actual error is: “persist_to_workspace”, “root” or “paths”?

Cheers,
Dado.


#2

Thanks for the thoughtful feedback. We agree these error reports need to be improved. We have work scheduled to do that, though I don’t have an ETA right now.


#3

No problem, I’ve discovered what the problem was:

- persist_to_workspace:
[2spaces]root: /tmp/workspace
[2spaces]paths:

Validation error.

- persist_to_workspace:
[4spaces]root: /tmp/workspace
[4spaces]paths:

Validation ok.

Alining to 4 spaces (2 aligments) instead of 2 spaces (1 alignment).
Again, I’m not ylm expert but I think it should be stated more clearly in the docs, and then, in the validator error report of course.

Cheers,
Dado.


#4

That sounds like a YAML problem rather than a CircleCI issue. As far as I know, the YAML standard does not allow tabs at all. Use spaces instead, and then run them through an online validator.


#5

Apologies for the poor formatting, fixed now.


#6

Gotcha.

It looks like two/four spaces causes a difference in the structure that the YAML creates. Put both in this tool to see that the two-spaces creates keys at the same level, and four creates keys inside the first item as a parent.


#7

Yeah I was visually bluffed by the heading dash, thinking that I was already a scope out in the root/paths section instead I was exactly in the same scope of persist_to_workspace (2nd column).

Oh well :wink:


#8