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

🌱 Add .gitattributes file to hide generated diffs #7045

Merged

Conversation

killianmuldoon
Copy link
Contributor

@killianmuldoon killianmuldoon commented Aug 10, 2022

Signed-off-by: killianmuldoon [email protected]

Add a .gitattributes file to hide generated CRD yamls in PRs. Our generated go code is already automatically hidden by github linguist.

The .gitattributes file lets us customize it's config - I'm sure there will be more potential additions to this in future.

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Aug 10, 2022
@k8s-ci-robot
Copy link
Contributor

@killianmuldoon: This issue is currently awaiting triage.

If CAPI contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

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

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Aug 10, 2022
@killianmuldoon killianmuldoon force-pushed the git/add-git-attributes branch 8 times, most recently from 68d5757 to f3fca14 Compare August 10, 2022 13:07
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 10, 2022
@killianmuldoon killianmuldoon force-pushed the git/add-git-attributes branch 2 times, most recently from 9f78afc to 5d1d8d0 Compare August 10, 2022 13:12
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 10, 2022
@killianmuldoon killianmuldoon changed the title [WIP] Add .gitattributes file to hide generated diffs 🌱 Add .gitattributes file to hide generated diffs Aug 10, 2022
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 10, 2022
Copy link
Contributor

@ykakarap ykakarap left a comment

Choose a reason for hiding this comment

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

/lgtm

How about also adding the zz_generated go files. Looks like github already does that using this check (thanks for finding this @killianmuldoon) but it might be good to make it explicit.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 11, 2022
@killianmuldoon
Copy link
Contributor Author

How about also adding the zz_generated go files. Looks like github already does that using this check (thanks for finding this @killianmuldoon) but it might be good to make it explicit.

Could do, but I'd prefer to use the defaulting for now to see what the weaknesses are and where it might fail. Going forward though I'd expect to add a number of additional generated files to this.

Copy link
Contributor

@ykakarap ykakarap left a comment

Choose a reason for hiding this comment

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

Sounds good. 👍

@sbueringer
Copy link
Member

sbueringer commented Aug 15, 2022

I might be missing context, but why do we want to hide the diff? For me it sounds rather surprising. I also wonder if that means that our CI jobs won't fail now as an outdated generated YAML might not show up anymore in git diff? e.g.

cluster-api/Makefile

Lines 471 to 474 in 05f10fd

@if !(git diff --quiet HEAD -- go.sum go.mod $(TOOLS_DIR)/go.mod $(TOOLS_DIR)/go.sum $(TEST_DIR)/go.mod $(TEST_DIR)/go.sum); then \
git diff; \
echo "go module files are out of date"; exit 1; \
fi

Or does it only hide it on the GitHub PR diff? But I also find it rather confusing if we can't see the diff there anymore.

@killianmuldoon
Copy link
Contributor Author

Or does it only hide it on the GitHub PR diff? But I also find it rather confusing if we can't see the diff there anymore.

This only hides the diff by default on the PR view, pretty much just making it easier to scroll on that page - github already automatically does this with our generated go code and with "large" files.

@sbueringer
Copy link
Member

Ah got it. Can you please add a comment to the .gitattributes file to explain that there as well? Thank you!

.gitattributes Outdated Show resolved Hide resolved
@killianmuldoon killianmuldoon force-pushed the git/add-git-attributes branch from 5d1d8d0 to 7be7dc5 Compare August 16, 2022 09:21
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 16, 2022
@sbueringer
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 16, 2022
Copy link
Contributor

@ykakarap ykakarap left a comment

Choose a reason for hiding this comment

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

/lgtm

@sbueringer
Copy link
Member

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 18, 2022
@k8s-ci-robot k8s-ci-robot merged commit 6c1ddaf into kubernetes-sigs:main Aug 18, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.3 milestone Aug 18, 2022
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. 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. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants