Sonar-scanner-vsts - New 4.x analyze task.json file minimumAgentVersion is incorrect for TFS 2017u2

vsts
sonarqube

(Tom Slavens) #1

Hello,

According to the SQ TFS task extension 4.0 compatibility documentation (sorry, tried to link this, but I’m a new user limited to two links, and the other links seemed more important), the TFS extension is compatible with “TFS 2017 Update 2+”. Unfortunately, it seems that in the task.json files for both 4.0.1 TFS task extensions, the minimumAgentVersion is incorrect. In the case of the SonarQubeAnalyze task, the incorrect version causes unexpected build failures.

  • Versions

    1. SQ scanner 4.0.1
    2. TFS 2017u2 (also known as 2017.2)
    3. TFS agent 2.117.2 (agent version corresponding to TFS 2017u2)
    4. Unrelated to SQ server version
  • Observed Error

    • On TFS 2017u2 with corresponding TFS agent 2.117.2, the SQ SonarQubePrepare 4.0.1 task succeeds, but the SQ SonarQubeAnalyze 4.0.1 task fails with an error message about minimum agent version
  • Reproduction

    • Given
      • TFS 2017u2 server
      • TFS agent 2.117.2 (corresponds to TFS 2017u2)
      • SQ VSTS task extension 4.0.1 installed
      • Working build which uses prior SQ VSTS tasks 3.x (either manually downgraded, or version selected before 4.0.1 extension was installed)
    • When
      • Edit the working build to upgrade the SQ VSTS tasks from 3.x to 4.0.1
      • Save and Queue the edited build
    • Then
      • SQ Analyze task fails with error message about minimum agent version
  • Workarounds

    1. Use 3.x SQ tasks until 4.0.1 SQ task.json files are corrected
    2. Upgrade TFS to 2017u3.1 or later, subsequently upgrading agents via TFS web portal
    3. (untested but likely to work) Remain on TFS 2017u2, but manually upgrade TFS agents to version >= 2.119.1; agent 2.122.1 (corresponds to TFS 2017u3, 2017u3.1, and 2018 RTW) should work with TFS 2017u2
  • Suggested Remediation

    1. Alter line 17 of the SonarQubeAnalyze 4.0.1 task.json file to set the version to “2.117.2”. This will prevent unwarranted build failures.
    2. Alter line 18 of the SonarQubePrepare 4.0.1 task.json file (new user limited to two links, and the one below matters more) to set the version to “2.117.2”. Since both tasks are used together for MSBuild analysis, there is no good reason for them to have different minimum requirements for TFS agent version. However, this inconsistency does not produce build failures, and leaving it as the TFS 2015u3 agent version should cause no harm.

For reference, the designation for the TFS agent 2.117.2 release includes “TFS 2017 QU2” and the release description there states “This will be the TFS2017 Update2 Agent”. Based on experience with our TFS 2017u2 instances, I can confirm that information.

Thanks and Regards,
Tom Slavens


(Julien Henry) #3

Hi Tom,

Thanks for the very detailed report.

I can’t remember why we set this minimal version to 2.119.1. On our integration test platform, I applied your workaround 3, but without really thinking if it was really necessary.

I have created a ticket to clarify the situation (either revert to 2.117.2, or document the reason why we would need a more recent version):
https://jira.sonarsource.com/browse/VSTS-164