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

[release-1.4] 🐛 Drop uid from error messages #8337

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func (j *jsonPatchGenerator) Generate(_ context.Context, _ client.Object, req *r
errs := []error{}
for i := range req.Items {
item := &req.Items[i]
objectKind := item.Object.Object.GetObjectKind().GroupVersionKind().Kind

templateVariables := patchvariables.ToMap(item.Variables)

Expand All @@ -81,13 +82,13 @@ func (j *jsonPatchGenerator) Generate(_ context.Context, _ client.Object, req *r
// Merge template-specific and global variables.
variables, err := patchvariables.MergeVariableMaps(globalVariables, templateVariables)
if err != nil {
errs = append(errs, errors.Wrapf(err, "failed to merge global and template-specific variables for item with uid %q", item.UID))
errs = append(errs, errors.Wrapf(err, "failed to merge global and template-specific variables for %q", objectKind))
continue
}

enabled, err := patchIsEnabled(j.patch.EnabledIf, variables)
if err != nil {
errs = append(errs, errors.Wrapf(err, "failed to calculate if patch %s is enabled for item with uid %q", j.patch.Name, item.UID))
errs = append(errs, errors.Wrapf(err, "failed to calculate if patch is enabled for %q", objectKind))
continue
}
if !enabled {
Expand All @@ -100,7 +101,7 @@ func (j *jsonPatchGenerator) Generate(_ context.Context, _ client.Object, req *r
// Generate JSON patches.
jsonPatches, err := generateJSONPatches(patch.JSONPatches, variables)
if err != nil {
errs = append(errs, errors.Wrapf(err, "failed to generate JSON patches for item with uid %q", item.UID))
errs = append(errs, errors.Wrapf(err, "failed to generate JSON patches for %q", objectKind))
continue
}

Expand Down