YAML parsing error. Expected <block end>, but found '-'

838 views Asked by At

I have the following config.yml:

    - persist_to_workspace:
        root: ~/project
        paths: *build_cache_paths
         # for integration tests:
        - /home/circleci/cache/Cypress

I'm trying to persist_to_workspace /home/circleci/cache/Cypress. What's wrong with my syntax?

1

There are 1 answers

0
flyx On BEST ANSWER

Your paths key has the value *build_cache_paths which is an alias. That means the value of paths is a reference to the node with the anchor &build_cache_paths (assuming it exists).

Two lines below, you start a sequence with -. Generally, a sequence at this level would be the value of a previous implicit key. But in this case it can't be, since the key paths already has a value. Hence the error.

If your goal is to merge the sequence behind *build_cache_paths with the sequence you give below: That is not possible with YAML. YAML is a serialization language, it doesn't implement operations on data (apart from the non-standard merge key << that is supported by some implementations but only works on mappings, not on sequences).