Whilst writing CI for our minecraft image, we seem to have come across a YAML parsing bug.
This is an excerpt of the test stage from the .drone.yml file:
When running this config in drone, or using drone exec a parsing error is spat out:
2017/09/13 21:36:05 Cannot unmarshal 'map[timeout -t 30 /bin/sh -c 'docker logs --tail="all" -f DEV | grep -qe ":Done ([0-9]\+\.[0-9]\+s)\!"']' of type map[interface {}]interface {} into a string value
indicating that the array value is invalid.
It turns out to be caused by the [..]: part from within the double-nested brackets.
Escaping the space after this seems to resolve the issue
Unfortunately this is not something we control or could resolve at the drone level. I would suggest creating an issue for the library author, but the project has been slow to fix issues and merge pull requests
Strangely enough, vim’s syntax highlighting also picks up on this as being correct behaviour when using some permutations of quotations so whilst it causes some head-scratching I’m putting this down to a non-issue.
Maybe, however, it would be useful to include a section in the documentation to cover this?
It seems a block style command unmarshals properly as well, I am not sure about your exact use case, but running a pipeline with nested brackets works for me… something along the lines of
test:
image: alpine
commands:
- |
if [[ -f /drone ]]; then
touch /drone/test
fi
- ls /drone