Skip to content

Add json support for index.yaml file #10542#12151

Closed
smmhatami wants to merge 3 commits into
helm:mainfrom
smmhatami:main
Closed

Add json support for index.yaml file #10542#12151
smmhatami wants to merge 3 commits into
helm:mainfrom
smmhatami:main

Conversation

@smmhatami

Copy link
Copy Markdown

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

yxxhero commented Jun 16, 2023

Copy link
Copy Markdown
Member

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

@gausk

gausk commented Jun 16, 2023

Copy link
Copy Markdown

Changes LGTM

Comment thread pkg/repo/index.go Outdated
Comment thread pkg/repo/chartrepo.go
}

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

Copy link
Copy Markdown
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

hiddeco commented Jun 23, 2023

Copy link
Copy Markdown
Contributor

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 <[email protected]>
Signed-off-by: Seyed Mohammad Mahdi Hatami <[email protected]>
@hiddeco

hiddeco commented Jul 18, 2023

Copy link
Copy Markdown
Contributor

@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

hiddeco commented Sep 11, 2023

Copy link
Copy Markdown
Contributor

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