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

Give more information for errors of failed chart repo index #135

Merged
merged 1 commit into from
Sep 13, 2019

Conversation

ghost
Copy link

@ghost ghost commented Jul 26, 2019

Add an error for no chart repo to give more information to the user
This error will be used when we failed to fetch chart repo, and there's no previous index in cache for fallback

@ghost ghost marked this pull request as ready for review July 26, 2019 13:35
@@ -22,6 +22,10 @@ func ResolveChartVersionFunc(c *Catalog) ChartVersionResolver {

if _, err := repo.RefreshIndex(); err != nil {
glog.Warningf("failed to refresh repo[%s] index: %s", chartspec.RepoURL, err)
switch err.(type) {
case errors.NoCachedChartRepoIndexError:
return nil, err
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest adding default: statement (even an empty one if a fall through is meant here) so the alternative action is explicitly visible.

@@ -61,6 +61,13 @@ func (r *Repo) RefreshIndex() (*repo.IndexFile, error) {

data, err := r.fetcher(indexURL)
if err != nil {
_, cacheErr := r.cache.Fetch("index.yaml")
if cacheErr != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we care about cacheErr contents? It seems it's lost after a non-nil check

Copy link
Author

Choose a reason for hiding this comment

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

The error that we are printing to logs is the response code from the server when trying to fetch the chart (for example: "unsuccessful response code: 500 Internal Server Error (500)"). cacheErr will hold the error for trying to fetch from cache (for example: "open /tmp/chart-cache/https-charts.prod.booking.com-charts/index.yaml: no such file or directory")
I can add cacheErr if you think it should be there as well

Copy link
Contributor

Choose a reason for hiding this comment

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

I see your point. It seems to be a composite error: we got err and cacheErr, both worth reporting. I might suggest using shippererrors.MultiError in that case so we don't miss the actual err reason contained in err.

@osdrv osdrv added the enhancement New feature or request label Jul 29, 2019
@ghost ghost changed the title Hbarkal/handle failed chart repo index Give more information for errors of failed chart repo index Aug 1, 2019
juliogreff
juliogreff previously approved these changes Aug 7, 2019
@juliogreff
Copy link
Contributor

It looks like we have conflicts from when #143 got merged. @hbarkal can you rebase?

@ghost ghost force-pushed the hbarkal/handle-failed-chart-repo-index branch 4 times, most recently from d8aaa5b to 8d8e1fa Compare August 8, 2019 14:25
@juliogreff
Copy link
Contributor

@hbarkal we have conflicts again after recent refactorings on repo index fetching. Can you rebase again?

@ghost ghost force-pushed the hbarkal/handle-failed-chart-repo-index branch from 8d8e1fa to 1a67d9c Compare August 29, 2019 10:03
juliogreff
juliogreff previously approved these changes Sep 12, 2019
@juliogreff juliogreff added this to the release-0.6 milestone Sep 13, 2019
Add an error for no chart repo to give more information to the user
This error will be used when we failed to fetch chart repo, and there's no previous index in cache for fallback
@ghost ghost force-pushed the hbarkal/handle-failed-chart-repo-index branch from d2b7ea2 to d3f668d Compare September 13, 2019 12:39
@osdrv osdrv merged commit 9b92933 into master Sep 13, 2019
@osdrv osdrv deleted the hbarkal/handle-failed-chart-repo-index branch September 13, 2019 13:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants