ros-industrial / industrial_ci

Easy continuous integration repository for ROS repositories
Apache License 2.0
246 stars 129 forks source link

Backslash notation in .travis.yml not working with local run_travis #417

Closed agutenkunst closed 4 years ago

agutenkunst commented 4 years ago

I needed https://github.com/PilzDE/pilz_robots/commit/0f0a2810fb813be79de6403053b4638ffec7bb8e because when running locally via run_travis only the first variable would be set. And therefore e.g. there would be no AFTER_SCRIPT

yamllint indicates that both versions should be valid.

@ipa-mdl you opinion?

mathias-luedtke commented 4 years ago

Thanks for reporting!

I will have a look, but I doubt that we can do much about it. Even if yamllint says it is correct, PyYAML (used by run_travis) and Ruby's YAML (used by Travis) don't behave the same in all cases; especially w.r.t. string handling.

mathias-luedtke commented 4 years ago

PyYAML (used by run_travis) and Ruby's YAML (used by Travis) don't behave the same in all cases; especially w.r.t. string handling.

In this case they treat things alike: The backslash is a literal, i.e. it is a part of the string. I could not find any hint that a backslash is needed for multi-line strings in YAML. I guess that Travis filters this out somehow.

mathias-luedtke commented 4 years ago

I guess that Travis filters this out somehow.

While the backslash is listed in the web view of 3016.2, travis-build creates something like this:

travis_cmd export\ ROS_DISTRO\=\"melodic\" --echo
travis_cmd export\ CATKIN_LINT\=true --echo
travis_cmd export\ CMAKE_ARGS\=\"-DCATKIN_ENABLE_CLANG_TIDY\=true\" --echo
travis_cmd export\ ADDITIONAL_DEBS\=\"clang-tidy\ libclang-dev\" --echo
travis_cmd export\ ROS_REPO\=\"testing\" --echo
travis_cmd export\ CATKIN_LINT\=false --echo
travis_cmd export\ NOT_TEST_BUILD\=true --echo
travis_cmd export\ AFTER_SCRIPT\=\"./.coverage.sh\" --echo
travis_cmd export\ CMAKE_ARGS\=\"-DENABLE_COVERAGE_TESTING\=ON\ -DCMAKE_BUILD_TYPE\=Debug\" --echo
travis_cmd export\ DOCKER_RUN_OPTS\=\'-e\ COVERAGE_PKGS\=\"prbt_hardware_support\"\' --echo

I was not able to find the code for the env parser yet. https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/env/var.rb#L23 just skips literal backslashes. run_travis just passes the line as-is, without parsing the individual entries.

mathias-luedtke commented 4 years ago

run_travis just passes the line as-is, without parsing the individual entries.

\ AFTER_SCRIPT="./.coverage.sh" gets parsed as <SPACE>AFTER_SCRIPT="./.coverage.sh" by bash.

419 should filter / (and all other invalid parts).

mathias-luedtke commented 4 years ago

419 was merged