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

errors accumulating remote directories are not reported in certain situations #5692

Closed
colinodell opened this issue May 8, 2024 · 1 comment · Fixed by #5693
Closed

errors accumulating remote directories are not reported in certain situations #5692

colinodell opened this issue May 8, 2024 · 1 comment · Fixed by #5693
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@colinodell
Copy link
Contributor

What happened?

Under these conditions ...

  1. A resource is defined with an https git reference
  2. The web server uses a catch-all authentication challenge web page
  3. The resource is successfully retrieved as a base but directory accumulation fails for any reason

... the error from the third step is not reported.

The first two conditions are identical to #5540, so I'll quote the relevant bits here:

Since a catch-all authentication challenge web page is in place, the attempt to accumulate the resource as a file receives a 200 response. As a result, fileloader.httpClientGetContent() does not do a check of the path to see if it's a git repo. That means FromFile processes the HTML of the web page, and properly returns a YAML parse error.

accumulateResources then attempts to process the resource as a git reference.

Unlike #5540, the remote repository is successfully cloned, so the code proceeds to call kt.accumulateDirectory(). If that accumulation fails for any reason, a decision is made how to report the failure. But if errF (from earlier in the method) was a malformed YAML error, the error from kt.accumulateDirectory() is dropped:

if err != nil {
if kusterr.IsMalformedYAMLError(errF) { // Some error occurred while tyring to decode YAML file
return nil, errF
}
return nil, errors.WrapPrefixf(
err, "accumulation err='%s'", errF.Error())
}

The result is that the user does not receive any information about why kustomize failed to accumulate the directory. They instead see an error like:

MalformedYAMLError: yaml: line 3: mapping values are not allowed in this context in File: https://git.example.com/some/repo.git//some/path?ref=main

What did you expect to happen?

I expect to see the error from accumulating the directory - something like:

accumulateDirectory: "recursed accumulation of path '/private/var/folders/17/0lz0_dxs2x7b9pf358vjppp80000gq/T/kustomize-1978055679/some/path': error unmarshaling JSON: while decoding JSON: json: unknown field \"whatever\""

How can we reproduce it (as minimally and precisely as possible)?

I unfortunately don't have a fully working reproducer I can share :-/

Expected output

No response

Actual output

No response

Kustomize version

v5.4.1

Operating system

None

@colinodell colinodell added the kind/bug Categorizes issue or PR as related to a bug. label May 8, 2024
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants