Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Helm repository URL comparison logic does not ignore trailing slashes #303

Open
haines opened this issue Jul 2, 2020 · 0 comments
Open
Labels
bug Something isn't working

Comments

@haines
Copy link
Contributor

haines commented Jul 2, 2020

Describe the bug:

When updating Helm chart dependencies, Fabrikate looks for existing repositories by comparing URLs using strings.EqualFold

if strings.EqualFold(re.URL, url) {

This means that trailing slashes are significant, so https://kubernetes-charts.storage.googleapis.com/ is treated as a different repository to https://kubernetes-charts.storage.googleapis.com

Helm does not treat these as different repositories since 2.0.1 (helm/helm#1603), its logic uses filepath.Clean to normalize URLs before comparison:

https://github.com/helm/helm/blob/9b42702a4bced339ff424a78ad68dd6be6e1a80a/internal/urlutil/urlutil.go#L44-L64

The knock-on impact of this is that we get sporadic failures in fab install

...
INFO requirements.yaml found at 'prometheus/helm_repos/prometheus/requirements.yaml', ensuring repositories exist on helm client 
INFO 👀  Looking for repo https://kubernetes-charts.storage.googleapis.com/ 
INFO ✏  Adding helm dependency repository 'https://kubernetes-charts.storage.googleapis.com/'
...
INFO 🚁  Updating helm chart's dependencies for chart in 'prometheus/helm_repos/prometheus' 
WARN 🚫  Updating chart dependencies failed for chart in 'prometheus/helm_repos/prometheus'; run `helm dependency update prometheus/helm_repos/prometheus` for more error details.
exit status 1: Error: repository file is out of date 

To Reproduce:

Install this component:

name: prometheus
type: helm
method: helm
source: https://kubernetes-charts.storage.googleapis.com
path: prometheus
version: 11.6.1

Expected behavior:

Fabrikate detects that the dependency uses the existing stable Helm repository, and does not add a new repository.

Desktop (please complete the following information):

  • OS: Alpine Linux
@haines haines added the bug Something isn't working label Jul 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant