DanielG / travis-run

Run travis-ci builds locally using Docker [abandoned]
GNU Affero General Public License v3.0
36 stars 6 forks source link

.travis.yml parser does not support YAML lists properly #1

Closed nakedible-p closed 10 years ago

nakedible-p commented 10 years ago

My .travis.yml file is not parsed by travis-run create:

YAML Error: Invalid element in map
   Code: YAML_LOAD_ERR_BAD_MAP_ELEMENT
   Line: 3
   Document: 1
 at /usr/share/perl5/YAML/Loader.pm line 351.
Could not detect language, please add a `language:' declaration
to your `.travis.yml'.

The problem is that the Perl YAML parser does not seem to support lists that are not indented. My .travis.yml file reads:

language: node_js
node_js:
- "0.10"
- "0.11"

Which is completely valid YAML. What works for travis-run is:

language: node_js
node_js:
  - "0.10"
  - "0.11"
nakedible-p commented 10 years ago

Version v0.2.1.

DanielG commented 10 years ago

Hope this fixes your issues. Do note though that node-js is not yet explicitly supported. Adding support for it shouldn't be too hard but I haven't tried languages that need properties in the chef environment yet. If you want to give it a shot that'd be great.

My guess is that you need to add the stuff under the "json" key here to the JSON data passed to chef-solo: here. Ideally rather than hardcoding this stuff adding something to pull a specific revision of travis-image would be nice, or something like that anyways.

nakedible-p commented 10 years ago

This fixes the YAML error, thanks.

And yes, node-js support seems to require tweaks. For some reason, I could not get node-js 0.11 to be automatically installed (with nvm install 0.11) even with the json tweaks, so everything but the default version fails with an error:

$ nvm use 0.11
N/A version is not installed yet

However, that is a separate issue and right now I don't have time to look into it.

DanielG commented 10 years ago

Can you commit the stuff you tried I'd like to have a look.

Btw. just curious, how did you find travis-run?

nakedible-p commented 10 years ago

Here is a snippet:

node_js)
    RUNLIST="-o nodejs::multi,sweeper"
    echo ',"nodejs": {"default": "0.10.29", "versions": ["0.6.21", "0.8.23", "0.8.25", "0.8.27", "0.10.18", "0.10.29", "0.11.13"], "aliases": {"0.10": "0.1", "0.11.13": "node-unstable"}}' >> travis.json
    ;;

This one might even work, not sure.

I found travis-run by googling travis and docker, as I was searching for something unrelated. Looked interesting, so I decided to try. Would help debugging travis failures a lot, especially if the failures are for a version combination not normally installed on developer machines.

nakedible-p commented 10 years ago

It would seem that the above change really works, node 0.11 is installed by default and tests are run. Obviously it should be done by parsing the image yaml files instead of hardcoding.