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

Fix 3812; Error message changed and check for MalformedYamlError #4497

Merged
merged 5 commits into from Mar 24, 2022

Conversation

m-Bilal
Copy link
Member

@m-Bilal m-Bilal commented Feb 27, 2022

Fixes #3812

I have created a new Error type MalformedYamlError and introduced a check for it at:

if errF := kt.accumulateFile(ra, path); errF != nil {
// not much we can do if the error is an HTTP error so we bail out
if errors.Is(errF, load.ErrorHTTP) {
return nil, errF
}
ldr, err := kt.ldr.New(path)
If the check is successful, return so that Kustomize does not try to load the file as a directory.

@k8s-ci-robot
Copy link
Contributor

@m-Bilal: This PR has multiple commits, and the default merge method is: merge.
You can request commits to be squashed using the label: tide/merge-method-squash

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 27, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @m-Bilal. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Feb 27, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: m-Bilal
To complete the pull request process, please assign knverey after the PR has been reviewed.
You can assign the PR to them by writing /assign @knverey in a comment when ready.

The full list of commands accepted by this bot can be found 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

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 27, 2022
@natasha41575
Copy link
Contributor

/ok-to-test

Thank you for working on this!

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 3, 2022
@m-Bilal
Copy link
Member Author

m-Bilal commented Mar 6, 2022

I think this would also partially fix #4348

Copy link
Contributor

@natasha41575 natasha41575 left a comment

Choose a reason for hiding this comment

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

Looks great! Very minor comment, I'd like to have the test compare the full actual error string.

err := th.RunWithErr(".", th.MakeDefaultOptions())
if !kusterr.IsMalformedYAMLError(err) {
t.Fatalf("unexpected error: %q", err)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please also add a check for the error contents, e.g. assert.Equal(t, err.Error(), expectedErr)

@@ -159,8 +159,8 @@ func demandDirectoryRoot(
}
if f != "" {
return "", fmt.Errorf(
"got file '%s', but '%s' must be a directory to be a root",
f, path)
"'%s' must be a directory so that it can used as a build root",
Copy link
Contributor

Choose a reason for hiding this comment

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

This is so much better, thank you!

@natasha41575
Copy link
Contributor

/lgtm
/approve

@natasha41575
Copy link
Contributor

Merging so it can be part of today's release

@natasha41575 natasha41575 merged commit e864072 into kubernetes-sigs:master Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

incomprehensible error message
3 participants