SonarQube Jenkins
  1. SonarQube Jenkins
  2. SONARJNKNS-57

Environment Variables not taken into account in "Additional properties" field

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8
    • Fix Version/s: 2.0
    • Labels:
      None
    • Environment:
      Using Jenkins ver. 1.458, Hudson Sonar Plugin 1.8, Sonar 2.9 & maven 3
    • Number of attachments :
      0

      Description

      Hello everyone,

      A regression seemed to have been introduced by http://jira.codehaus.org/browse/SONARPLUGINS-1309 regarding the handling of environment variables in the "Additional properties" field of the Sonar Jenkins plugin.

      For instance, when I was able to set in this field something like "-Dsonar.branch=$

      {P_SONAR_BRANCH}

      " where P_SONAR_BRANCH is one of the parameter of the job, it was well handled and in the jenkins logs we could see that the variables have been expanded.
      This is not the case anymore with the plugin in version 1.8 leading to several issues in our jobs execution.

      As far as I could understand from the changes introduced by SONARPLUGINS-1309, the handling of the additional properties has been moved from the main Maven class inherited by SonarMaven to handle it in the overridden wrapUpArguments method this way :
      args.addTokenized(additionalProperties);

      This allows to fix the issue, but is not functionally equivalent since the following lines are not applied anymore to the additionalProperties (from Maven#perform(...)):
      String targets = Util.replaceMacro(this.targets,vr);
      targets = env.expand(targets);

      Regards,
      Guillaume

        Issue Links

          Activity

          Show
          Vitaliy Tymchyshyn added a comment - I've got a fix in https://github.com/SonarSource/jenkins-sonar-plugin/pull/7
          Hide
          Fabrice Bellingard added a comment -

          Manually tested.

          Show
          Fabrice Bellingard added a comment - Manually tested.

            People

            • Assignee:
              Julien HENRY
              Reporter:
              Guillaume Fournols
            • Votes:
              4 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: