Helm chart scanning failing to recognize sub-charts

  • ALM and CI system used: Bitbucket Cloud
  • Scanner command used when applicable: Using a bitbucket pipe sonarsource/sonarcloud-scan:2.0.0: Bitbucket
  • Languages of the repository: Helm Charts

  • Error observed:
    Sharing log for one of many similar errors, please note that tomcat is being used as a sub-chart here.
09:50:28.149 ERROR: Failed to evaluate Helm file sms-registration/templates/scripts-config.yaml: Template evaluation failed
09:50:28.149 DEBUG: Evaluation error in Go library: template: sms-registration/templates/scripts-config.yaml:4:20: executing "sms-registration/templates/scripts-config.yaml" at <{{template "tomcat.name" .}}>: template "tomcat.name" not defined
09:50:28.154 DEBUG: org.sonar.iac.common.extension.ParseException: Failed to evaluate Helm file sms-registration/templates/scripts-config.yaml: Template evaluation failed

  • Steps to reproduce:
  1. Create a repository to contain helm charts
  2. Add a base chart in the repository
  3. Create another helm chart, and make it dependent on the base chart
  4. Run sonarcloud scan in any way possible in the repository (enable debugging). We use bitbucket pipe to do so.
  5. Observe ERROR and DEBUG logs
  • Potential workaround: No workaround. Cannot add sonarcloud to the repository until this is resolved.

Thanks,
Tejas Meshram

Hello Tejas,

Thanks for reporting this. Being unable to resolve named templates from chart dependencies is a known limitation of the Helm analyzer at the moment. You can keep track of this feature in this ticket: [SONARIAC-1273] - Jira.

FWIW, I believe it shouldn’t prevent you from enabling SonarCloud analysis completely, as other files still can be analyzed successfully.

Hope that helps,

Peter

Hey Peter,

Thanks for the update, and thank you for sharing the link to the ticket.

  • Tejas