ros2 / ci

ROS 2 CI Infrastructure
http://ci.ros2.org/
Apache License 2.0
48 stars 30 forks source link

Some Windows build issues getting details swallowed: #435

Open rotu opened 4 years ago

rotu commented 4 years ago

Although there are warnings from both cmake and msbuild, the details of the errors are not showing up on their respective warning pages. Just the truncated details "cmd.exe" exited with code 1." for msbuild and nothing for CMake.

https://ci.ros2.org/job/ci_windows/10157/cmake/ https://ci.ros2.org/job/ci_windows/10157/msbuild/

dirk-thomas commented 4 years ago

@j-rivero Can you please look into this since it is related to the new Jenkins warnings-ng plugin you deployed.

j-rivero commented 4 years ago

I've verified that it happens because the console log displays some blank lines among the cmake warning message:

  CMake Warning (dev) in CMakeLists.txt:

    No project() command is present.  The top-level CMakeLists.txt file must

    contain a literal, direct call to the project() command.  Add a line of

    code such as

      project(ProjectName)

    near the top of the file, but after cmake_minimum_required().
...

Is this somehow an effect of colcon output? If so, does it happen in colcon log files? If log files does not have this effect, a similar approach to what we have for tests in https://github.com/ros2/ci/issues/316 could help (injecting directly colcon log in the cmake warning plugin configuration. If it is a desired/difficult-to-avoid-effect we could try some workarounds on top of the colcon log file but I would like to avoid it if possible.

dirk-thomas commented 4 years ago

Is this somehow an effect of colcon output?

I doubt it. colcon passes output from invoked commands without modifications.

If so, does it happen in colcon log files?

I don't know - but I would doubt that the content of the log files would be any different than the console output. Have you checked the content of the log file in the case of such a CMake warning?

A test build of an arbitrary package with a CMake warning doesn't show any extra empty lines in the CMake output: https://ci.ros2.org/job/ci_windows/10828/consoleFull#console-section-84

In the builds referenced above the CMake warning happened in an externalproject_add call. A test build using a package which uses that CMake function shows the empty lines: https://ci.ros2.org/job/ci_windows/10829/consoleFull#console-section-33

In this case the console / log contain \r\n line endings.

When rewriting those to only \n within colcon (https://github.com/colcon/colcon-core/commit/c6cc9c94e6b45cdc50533155b9ec923483016287) Jenkins seems to render and process the output correctly: https://ci.ros2.org/job/ci_windows/10834/consoleFull#console-section-33

patch ``` --- a/colcon_core/task/__init__.py +++ b/colcon_core/task/__init__.py @@ -167,6 +167,8 @@ async def run( :rtype subprocess.CompletedProcess """ def stdout_callback(line): + if line.endswith(b'\r\n'): + line = line[:-2] + b'\n' context.put_event_into_queue(StdoutLine(line)) def stderr_callback(line): ```

So I would argue this is a bug in Jenkins or a Jenkins plugin. Not sure if we want to work around it in colcon or fill an issue somewhere for Jenkins.

j-rivero commented 4 years ago

Thanks for looking into it deeper:

So I would argue this is a bug in Jenkins or a Jenkins plugin. Not sure if we want to work around it in colcon or fill an issue somewhere for Jenkins.

Let's try to file a bug in the Jenkins plugin. I'm trying to reproduce it with a minimal use case: https://github.com/j-rivero/cmake_warning_ng_bug. If I use the build.osrfoundation.org buildfarm to run the test case on Windows, the blank lines do not appear (nor the warning, probably different versions of cmake). Same if I built tinydir_vendor direclty, no blank lines in the output. As you mention, If I use colcon there is no difference.

It could be: something that happen with new versions of cmake or my bet is that is something in the configuration of ci.ros2.org buildfarm (maybe another plugin). I can give a look into it if I can create a test job inside ci.ros2.org for this.

dirk-thomas commented 4 years ago

@j-rivero Any update on this?