Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

retryImageAction: strip error wrappings for MultiError members #68

Merged
merged 1 commit into from
Jul 4, 2019

Conversation

nalind
Copy link
Member

@nalind nalind commented Apr 30, 2019

If the error we get back from attempting to push or pull an image is a multi-error, extend our change from #66 to process each of its component errors as we would have a single error.

@openshift-ci-robot openshift-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 30, 2019
@nalind
Copy link
Member Author

nalind commented Apr 30, 2019

Doh. Forgot to mention the bug ID in the commit log message.

@nalind
Copy link
Member Author

nalind commented Apr 30, 2019

/retest

2 similar comments
@nalind
Copy link
Member Author

nalind commented May 1, 2019

/retest

@nalind
Copy link
Member Author

nalind commented May 1, 2019

/retest

Copy link
Contributor

@adambkaplan adambkaplan left a comment

Choose a reason for hiding this comment

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

@nalind one ask, otherwise lgtm

pkg/build/builder/dockerutil.go Outdated Show resolved Hide resolved
@openshift-ci-robot openshift-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 2, 2019
@nalind
Copy link
Member Author

nalind commented May 2, 2019

/retest

@nalind
Copy link
Member Author

nalind commented May 2, 2019

/test e2e-aws-builds

@mrunalp
Copy link
Member

mrunalp commented May 3, 2019

/retest

@rhatdan
Copy link
Contributor

rhatdan commented Jun 28, 2019

@adambkaplan Can we get this merged, seems to have gotten lost in the weeds.

@rhatdan
Copy link
Contributor

rhatdan commented Jul 2, 2019

/approve

@rhatdan
Copy link
Contributor

rhatdan commented Jul 2, 2019

@gabemontero @bparees @adambkaplan PTAL

}
}
if unwrap {
err = errors.Cause(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't this stomping the original group of errors? so now you'll only log a single (unwrapped)error from the original group?

Copy link
Member Author

Choose a reason for hiding this comment

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

The scoping here is probably confusing - the errors.Cause() call on line 74 is removing additional context (that errors.Wrapf() would have added) from the err defined on line 52, when we detect that there's an authorization error in there somewhere. If the result that first went into errors.Wrapf() is ultimately an errcode.Errors, that list is what err will be set to on line 74. I'll change the name of the one we create on line 67.

Copy link
Contributor

Choose a reason for hiding this comment

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

sorry i'm still a little confused:
if errs, ok := errors.Cause(err).(errcode.Errors); ok

if that's true, then err = errors.Cause(err) is going to set err== something that is an array of errors (errcode.Errors)

then you're going to pass array of errors (interface errcode.Errors) down to unwrapUnauthorizedError

which then calls cause := errors.Cause(err). What does errors.Cause(err) return when err is an errcode.Errors?

I would have expected logic that iterates the array and unwraps each err within the array that needs unwrapping.

Copy link
Member Author

Choose a reason for hiding this comment

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

errors.Cause() looks at the error that err wraps, repeating until it reaches an error that isn't a wrapper (i.e., an object that doesn't provide a Cause() method), and errcode.Errors does not provide such a method, so if it's an errcode.Errors, and one of the errors in its list is an "unauthorized" error that we recognize, we're removing the layers of wrapping around the errors list.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok.....so if action() returned an errors list or a wrapped errors list, you will scan the errors list, see if it contains an "unauthorized error", and then attempt to unwrap the list (leaving the list itself).

if that's the intent (as compared w/ unwrapping the unauthorized error specifically), then this lgtm

More from bug #1703262: if the error we get back from attempting to push
or pull an image is a multi-error, process each component error as we
would a single error.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
@bparees
Copy link
Contributor

bparees commented Jul 3, 2019

/lgtm
/assign @adambkaplan

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 3, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bparees, nalind, rhatdan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 3, 2019
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 524ae7b into openshift:master Jul 4, 2019
@nalind nalind deleted the auth-error-2 branch July 15, 2019 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants