Skip to content

generate-jobs: print diff in case of failure#36831

Open
pohly wants to merge 1 commit intokubernetes:masterfrom
pohly:generate-jobs-diff
Open

generate-jobs: print diff in case of failure#36831
pohly wants to merge 1 commit intokubernetes:masterfrom
pohly:generate-jobs-diff

Conversation

@pohly
Copy link
Copy Markdown
Contributor

@pohly pohly commented Apr 17, 2026

This makes a CI failure more useful. In one case, the CI reported "differs from existing" without saying how and locally the check passed.

/assign @bart0sh

@k8s-ci-robot k8s-ci-robot requested review from dims and upodroid April 17, 2026 07:19
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Apr 17, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: pohly
Once this PR has been reviewed and has the lgtm label, please assign upodroid for approval. For more information see the Code Review Process.

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

Details 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 cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 17, 2026
Comment thread hack/generate-jobs.py Outdated
equal = diff == ""
if verify:
os.unlink(tmp.name)
if not equal:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
if not equal:
if diff != "":

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So you wanted me to remove the equal variable? Okay, removed.

Comment thread hack/generate-jobs.py Outdated
Comment on lines +131 to +132
with open(path) as f:
return list(f)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
with open(path) as f:
return list(f)
with open(path) as f:
return f.readlines()

Comment thread hack/generate-jobs.py Outdated
Comment on lines +110 to +114
expected = read_lines(tmp.name)
actual = read_lines(out)
diff = difflib.context_diff(actual, expected,
fromfile="actual", tofile="expected")
diff = ''.join(diff)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure, but would this be more readable without a helper?

Suggested change
expected = read_lines(tmp.name)
actual = read_lines(out)
diff = difflib.context_diff(actual, expected,
fromfile="actual", tofile="expected")
diff = ''.join(diff)
with open(tmp.name) as expected, open(out) as actual:
diff = difflib.context_diff(actual.readlines(), expected.readlines(),
fromfile="actual", tofile="expected")
diff = ''.join(diff)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Okay, updated.

@pohly pohly force-pushed the generate-jobs-diff branch from 1e6bafb to acb886f Compare April 17, 2026 14:10
This makes a CI failure more useful. In one case, the CI reported "differs from
existing" without saying how and locally the check passed.
@pohly pohly force-pushed the generate-jobs-diff branch from acb886f to 3dbce37 Compare April 17, 2026 14:12
@bart0sh
Copy link
Copy Markdown
Contributor

bart0sh commented Apr 17, 2026

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 17, 2026
@bart0sh
Copy link
Copy Markdown
Contributor

bart0sh commented Apr 17, 2026

/assign @dims
for approval

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. lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants