Skip to content

Conversation

@smmhatami
Copy link

This is a fix to solve Issue 10542. Resolves #10542. With these changes one can use json formatted index file instead of yaml. the code now looks for index.json file as default and switches to index.yaml if not found.

@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 16, 2023
@yxxhero
Copy link
Member

yxxhero commented Jun 16, 2023

@smmhatami please fix the DCO issue. maybe it's a breaking change?

Signed-off-by: Seyed Mohammad Mahdi Hatami <hatamik7@gmail.com>
Signed-off-by: Seyed Mohammad Mahdi Hatami <hatamik7@gmail.com>
@gausk
Copy link

gausk commented Jun 16, 2023

Changes LGTM

}

resp, err := r.Client.Get(indexURL,
resp, err := r.Client.Get(jsonIndexURL,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the file does not exist (HTTP 404), this would return an error and it would not fallback to loading the index.yaml. See also

if resp.StatusCode != http.StatusOK {
return nil, errors.Errorf("failed to fetch %s : %s", href, resp.Status)
}

In addition, on a successful retrieval any parsing error would be swallowed by an attempt to fetch and load the index.yaml (which may not exist). Yielding absolutely no information to the user to figure out what went wrong.

Given this, I think it would be better to not perform a fallback based on loading errors. But to rather fall back based on the error from r.Client.Get, which may require introducing a typed error in httpgetter.go to distinguish a HTTP 404 from transient errors.

@hiddeco
Copy link
Contributor

hiddeco commented Jun 23, 2023

In addition, this lacks any configuration options to generate an index.json. For this to happen, and as requested in #10542 (comment). I would advise to add the following things:

Co-authored-by: Hidde Beydals <hiddeco@users.noreply.github.com>
Signed-off-by: Seyed Mohammad Mahdi Hatami <62210297+smmhatami@users.noreply.github.com>
@hiddeco
Copy link
Contributor

hiddeco commented Jul 18, 2023

@smmhatami do you think you would be able to continue with this attempt based on my comments? Otherwise I would be happy to take it over, as I think it would be beneficial to Helm given the growing number of (bigger) indexes.

@hiddeco
Copy link
Contributor

hiddeco commented Sep 11, 2023

Given the other PR has been merged, this can be closed.

@joejulian @sabre1041

@joejulian joejulian closed this Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

index.json - necessary for large projects

5 participants