Skip to content

Commit

Permalink
fix: Solves #217 where helm-docs would segfault due in charts with ce…
Browse files Browse the repository at this point in the history
…rtain comment format

    The issue was that if a user had a comment which started with the
    old comment format "# field.name -- description", but then underneath had a
    comment of the new format "# -- description", the tool would mark
    the field as having an old style comment, with the key pulled from
    the latter comment "". This meant that we'd try to document the
    root-level mapping node, however the key is `nil` at this point.
  • Loading branch information
norwoodj committed Feb 24, 2024
1 parent e91f4af commit dd5640c
Show file tree
Hide file tree
Showing 22 changed files with 4 additions and 43 deletions.
2 changes: 0 additions & 2 deletions example-charts/best-values-example/README.md
Expand Up @@ -30,5 +30,3 @@ One of the best values parsing example charts here, exhibits several more compli
| statefulset.livenessProbe | object | `{"enabled":false}` | Configure the healthcheck for the database |
| statefulset.podLabels | object | `{}` | The labels to be applied to instances of the database |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
2 changes: 0 additions & 2 deletions example-charts/custom-template/README.md
Expand Up @@ -58,5 +58,3 @@ $ helm install my-release foo-bar/custom-template
| controller.service.annotations."external-dns.alpha.kubernetes.io/hostname" | string | `"stupidchess.jmn23.com"` | Hostname to be assigned to the ELB for the service |
| controller.service.type | string | `"LoadBalancer"` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
2 changes: 0 additions & 2 deletions example-charts/custom-value-notation-type/README.md
Expand Up @@ -1104,5 +1104,3 @@ string
</tbody>
</table>

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
2 changes: 0 additions & 2 deletions example-charts/dos-line-endings/README.md
Expand Up @@ -13,5 +13,3 @@ A chart whose values file has dos line endings rather than unix ones
| livenessProbe.httpGet.path | string | `"/healthz"` | This is the liveness check endpoint |
| livenessProbe.httpGet.port | string | `"http"` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
2 changes: 0 additions & 2 deletions example-charts/files-values/README.md
Expand Up @@ -67,5 +67,3 @@ File: example-charts/files-values/values.yaml
| statefulset.livenessProbe | object | `{"enabled":false}` | Configure the healthcheck for the database |
| statefulset.podLabels | object | `{}` | The labels to be applied to instances of the database |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
2 changes: 0 additions & 2 deletions example-charts/full-template/README.md
Expand Up @@ -162,5 +162,3 @@ Kubernetes: `<=1.18`
| controller.service.annotations."external-dns.alpha.kubernetes.io/hostname" | string | `"stupidchess.jmn23.com"` | Hostname to be assigned to the ELB for the service |
| controller.service.type | string | `"LoadBalancer"` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
2 changes: 0 additions & 2 deletions example-charts/fully-documented/README.md
Expand Up @@ -32,5 +32,3 @@ A simple wrapper around the stable/nginx-ingress chart that adds a few of our co
| controller.image.tag | string | `"18.0831"` | The tag of the image of the controller |
| controller.name | string | `"controller"` | The name of the controller |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
2 changes: 0 additions & 2 deletions example-charts/funky-version/README.md
Expand Up @@ -16,5 +16,3 @@ A very simple chart with a funky version

* <https://github.com/norwoodj/helm-docs/tree/master/example-charts/funky-version>

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
2 changes: 0 additions & 2 deletions example-charts/helm-3/README.md
Expand Up @@ -40,5 +40,3 @@ A simple wrapper around the stable/nginx-ingress chart that adds a few of our co
| controller.service.annotations."external-dns.alpha.kubernetes.io/hostname" | string | `"stupidchess.jmn23.com"` | Hostname to be assigned to the ELB for the service |
| controller.service.type | string | `"LoadBalancer"` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
2 changes: 0 additions & 2 deletions example-charts/ignored-values-example/README.md
Expand Up @@ -31,5 +31,3 @@ Based on best-values-example
| statefulset.livenessProbe | object | `{"enabled":false}` | Configure the healthcheck for the database |
| statefulset.podLabels | object | `{}` | The labels to be applied to instances of the database |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
2 changes: 0 additions & 2 deletions example-charts/most-empty/README.md
Expand Up @@ -20,5 +20,3 @@ There is a flower though:
__|_____________
```

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
2 changes: 0 additions & 2 deletions example-charts/nginx-ingress-but-auto-comments/README.md
Expand Up @@ -40,5 +40,3 @@ A simple wrapper around the stable/nginx-ingress chart that adds a few of our co
| controller.service.annotations."external-dns.alpha.kubernetes.io/hostname" | string | `"stupidchess.jmn23.com"` | Hostname to be assigned to the ELB for the service |
| controller.service.type | string | `"LoadBalancer"` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
2 changes: 0 additions & 2 deletions example-charts/nginx-ingress/README.md
Expand Up @@ -40,5 +40,3 @@ A simple wrapper around the stable/nginx-ingress chart that adds a few of our co
| controller.service.annotations."external-dns.alpha.kubernetes.io/hostname" | string | `"stupidchess.jmn23.com"` | Hostname to be assigned to the ELB for the service |
| controller.service.type | string | `"LoadBalancer"` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
2 changes: 0 additions & 2 deletions example-charts/no-requirements/README.md
Expand Up @@ -25,5 +25,3 @@ A simple chart that installs, let's say PrometheusRules, that needs no sub-chart
| rules.statusCodes.codes.5xx.duration | string | `"5m"` | Duration for which the percent of 5xx responses must be above the threshold to alert |
| rules.statusCodes.codes.5xx.threshold | float | `1.5` | Threshold percentage of 5xx responses above which the alert will fire |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
2 changes: 0 additions & 2 deletions example-charts/no-values/README.md
Expand Up @@ -16,5 +16,3 @@ A very simple chart that doesn't even need any values for customization

* <https://github.com/norwoodj/helm-docs/tree/master/example-charts/no-values>

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
2 changes: 0 additions & 2 deletions example-charts/special-characters-but-auto-comments/README.md
Expand Up @@ -26,5 +26,3 @@ A chart demonstrating handling of special characters in values files
| htmlSnippets.three | string | `"<html><head></head></html>"` | Another description |
| htmlSnippets.two | string | `""` | Let's put it in the description <html></html> |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
2 changes: 0 additions & 2 deletions example-charts/special-characters/README.md
Expand Up @@ -26,5 +26,3 @@ A chart demonstrating handling of special characters in values files
| htmlSnippets.three | string | `"<html><head></head></html>"` | Another description |
| htmlSnippets.two | string | `""` | Let's put it in the description <html></html> |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
2 changes: 0 additions & 2 deletions example-charts/umbrella/README.md
Expand Up @@ -24,5 +24,3 @@ A chart demonstrating that values documentation from child charts are aggregated
| sub-a.mySubKeyA | string | `"my-sub-value-a"` | Value for sub-chart A |
| sub-b.mySubKeyB | string | `"my-sub-value-b"` | Value for sub-chart B |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
2 changes: 0 additions & 2 deletions example-charts/umbrella/charts/sub-a/README.md
Expand Up @@ -18,5 +18,3 @@ A sub-chart.
| global.myGlobalSubChartKey | string | `"my-global-sub-chart-value"` | A global key defined in a sub chart |
| mySubKeyA | string | `"my-sub-value-a"` | Value for sub-chart A |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
2 changes: 0 additions & 2 deletions example-charts/umbrella/charts/sub-b/README.md
Expand Up @@ -17,5 +17,3 @@ A sub-chart.
| global.myGlobalKey | string | `"my-global-value"` | A global key |
| mySubKeyB | string | `"my-sub-value-b"` | Value for sub-chart B |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
2 changes: 0 additions & 2 deletions example-charts/umbrella/charts/sub-c/README.md
Expand Up @@ -16,5 +16,3 @@ A sub-chart.
|-----|------|---------|-------------|
| global | object | `{}` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
5 changes: 4 additions & 1 deletion pkg/helm/chart_info.go
Expand Up @@ -286,7 +286,10 @@ func parseChartValuesFileComments(chartDirectory string, values *yaml.Node, lint
// If we haven't continued by this point, we didn't match any of the comment formats we want, so we need to add
// the in progress value to the map, and reset to looking for a new key
key, description := ParseComment(commentLines)
keyToDescriptions[key] = description
if key != "" {
keyToDescriptions[key] = description
}

commentLines = make([]string, 0)
foundValuesComment = false
}
Expand Down

0 comments on commit dd5640c

Please sign in to comment.