-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Description
While trying to figure out the issue fluxcd/source-controller#1515 in the flux source controller of filtering chart versions from a Helm index with broken dependencies we stumbled over this issue #12748 where it has already been fixed in Helm.
On further investigation it appeared that the exclusion of invalid versions in
Line 345 in 1a500d5
| func loadIndex(data []byte, source string) (*IndexFile, error) { |
even though the copied slice cvs was adjusted to the correct size, the original slice i.Entries still remained the original size. It just contained copies of references of valid versions.
example of i.Entries before filtering:
[0xc000130f30 0xc0001315f0 0xc000131a70 0xc00021f710]
assuming chart versions at location 0xc0001315f0 and 0xc000131a70 are invalid. The content of cvs after validating the versions looked like this (which is correct):
[0xc000130f30 0xc00021f710]
But i.Entries still remains the original size:
[0xc000130f30 0xc00021f710 0xc00021f710 0xc00021f710]
Technically it does not contain any invalid version. But later on the index gets further sorted and filtered which unnecessarily contains duplicate versions.
a simple reassignment of cvs to i.Entries[name] solves this issue.
Additionally:
If the last chart in the index is malformed, it will not be removed