SonarQube Runner
  1. SonarQube Runner
  2. SONARUNNER-48

SONAR_RUNNER_HOME: autodetection over symbolic links + validation when automaticly resolved

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      Debian 6.0.5 Squeeze
      kernel 2.6.32-5-xen-amd64
    • Number of attachments :
      1

      Description

      Hello,

      I ran into two problems regarding the sonar-runner script (v2.0). On our installation I created a symbolic link in /usr/local/bin to start sonar-runner. I wanted to keep things clean by avoiding to set SONAR_RUNNER_HOME explicitly before execution of the script.

      I also noticed that when SONAR_RUNNER_HOME is automatically resolved, the validation of SONAR_RUNNER_HOME was skipped. This means that invalid resolutions can skip validation (as was the case with my symlink).

      I added a patch that will:

      • test for the readlink command and if present, use it to correctly resolve symbolic links
      • always run the validation of SONAR_RUNNER_HOME, even if it was automatically detected

      Both are small changes, so I included them in one patch-file. You can find the patch in attachment.

        Issue Links

          Activity

          Hide
          Julien HENRY added a comment -

          Also took the opportunity to return a non zero exit code when SONAR_RUNNER_HOME is wrong (previously it was logging an error but returned 0)

          Show
          Julien HENRY added a comment - Also took the opportunity to return a non zero exit code when SONAR_RUNNER_HOME is wrong (previously it was logging an error but returned 0)
          Hide
          Fabrice Bellingard added a comment -

          On MacOS, I get the following error:

          MyMac:MyProject fbellingard$ my-sonnar-runner 
          readlink: illegal option -- f
          usage: readlink [-n] [file ...]
          $SONAR_RUNNER_HOME does not point to a valid installation directory: /Users/fbellingard/Temp
          

          For the exit code, it returns 1, which is what I expect. However, the BAT script should also be updated to reflect this new behaviour - in order to be consistent accross platforms.

          Show
          Fabrice Bellingard added a comment - On MacOS, I get the following error: MyMac:MyProject fbellingard$ my-sonnar-runner readlink: illegal option -- f usage: readlink [-n] [file ...] $SONAR_RUNNER_HOME does not point to a valid installation directory: /Users/fbellingard/Temp For the exit code, it returns 1, which is what I expect. However, the BAT script should also be updated to reflect this new behaviour - in order to be consistent accross platforms.
          Hide
          Julien HENRY added a comment -

          readlink -f is not supported on Macosx. As a workaround I have replaced call to readlink -f by a custom function copied from: https://sites.google.com/site/jdisnard/realpath

          Show
          Julien HENRY added a comment - readlink -f is not supported on Macosx. As a workaround I have replaced call to readlink -f by a custom function copied from: https://sites.google.com/site/jdisnard/realpath
          Hide
          Fabrice Bellingard added a comment -

          Works well Julien!

          Show
          Fabrice Bellingard added a comment - Works well Julien!

            People

            • Assignee:
              Julien HENRY
              Reporter:
              Fabrice Bellingard
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: