Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-20462

Allow build warning parser to remove common prefix in filename

    • 0
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      When using the build warning parser together with Bitbucket it is important that the filename in the warning message is a relative path from the root of the repo otherwise Bitbucket will not be able to place the warning in-line in the code of a Pull Request. In many cases the filename in the warning message is instead an absolute path, or a relative path from the build folder.

      Example:

       

      { 
        "repositoryId":1,
        "fileName":"C:/Builds/bamboo-build/xyz/src/source.c",
        "lineNumber":9,
        "message":"unreferenced formal parameter",
        "severity":"NORMAL",
        "category":"C4100",
        "source":"MSBuild"
      }
      

      In this case "C:/Builds/bamboo-build/xyz/" needs to be removed from the "fileName".

      This could be achieved by adding an extra option to the Build Warning Parser task where the user can enter one or more strings that should be removed from the beginning of the fileName.

       

            [BAM-20462] Allow build warning parser to remove common prefix in filename

            Yeah...

            Our work-around is to `tee` the logs to a file:

            powershell "{build command} | tee build_log.txt"

            and add a power shell script task to fix the logs:

            $path = "${bamboo.build.working.directory}\src\"
            cat build_log.txt | %{$_ -replace [regex]::Escape($path),""} | Out-File build_log_fixed.txt -Encoding UTF8
            

            Anton Danielsson added a comment - Yeah... Our work-around is to `tee` the logs to a file: powershell "{build command} | tee build_log.txt" and add a power shell script task to fix the logs: $path = "${bamboo.build.working.directory}\src\" cat build_log.txt | %{$_ -replace [regex]::Escape($path),""} | Out-File build_log_fixed.txt -Encoding UTF8

            Well as of right now MSBuild warnings are entirely unusable for code insights making code insights and the warnings parser completely useless for a shop build around .NET, C++ & Delphi. Seeing the log itself uses relative path i feel like this feature isnt working for anyone really.

            Meik Tranel added a comment - Well as of right now MSBuild warnings are entirely unusable for code insights making code insights and the warnings parser completely useless for a shop build around .NET, C++ & Delphi. Seeing the log itself uses relative path i feel like this feature isnt working for anyone really.

            I probably agree. Or maybe both a bug and a feature

            I just think it might be difficult to find a generic solution for this that will always work?
            Have not thought it through though...

            Anton Danielsson added a comment - I probably agree. Or maybe both a bug and a feature I just think it might be difficult to find a generic solution for this that will always work? Have not thought it through though...

            I honestly think this is a bug not a feature. From some of my logs there's messages of failing path normalization. I assume this already supposed to happen automagically without having to set a prefix.

            Meik Tranel added a comment - I honestly think this is a bug not a feature. From some of my logs there's messages of failing path normalization. I assume this already supposed to happen automagically without having to set a prefix.

              Unassigned Unassigned
              5efa7fe9b5b0 Anton Danielsson
              Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: