Travis CI Not Triggering Build for .yml format issues

My .travis.yml file was not triggering a build when pushed. My coworker suggested I change the indentation spacing on my deploy key. It was indented with one space instead of zero spaces and that fixed the issue.

I would have expected the behavior to “fail loudly” and let me know the travis build did not trigger because of a formatting error in my .yml file instead of silently failing.

File that errored:

language: node_js

node_js:
  - node

cache: npm

script:
  - npm test

 deploy: <-- The following lines had an extra space space at the beginning of the line
   - provider: script
     skip_cleanup: true
     script: npm install -g serverless && sls deploy --stage staging
     on:
       all_branches: true
   - provider: script
     skip_cleanup: true
     script: npm install -g serverless && sls deploy --stage prod
     on:
       branch: master

Fixed file that works

language: node_js

node_js:
  - node

cache: npm

script:
  - npm test

deploy:
 - provider: script
   skip_cleanup: true
   script: npm install -g serverless && sls deploy --stage staging
   on:
     all_branches: true
 - provider: script
   skip_cleanup: true
   script: npm install -g serverless && sls deploy --stage prod
   on:
     branch: master


Originally posted at https://github.com/travis-ci/travis-ci/issues/10435

I agree. The YAML syntax error should be reported via GitHub status on the relevant commit. This is currently not happening because notifications fire only after the build has been configured. The syntax error does not allow the build to be configured at all, hence no notification.

1 Like
Imprint