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

Don't commit generated (some) code #33440

Conversation

thockin
Copy link
Member

@thockin thockin commented Sep 24, 2016

Now that we are past 1.4 and we have a real client library, let's try this
again. This is not perfect, it still is missing other generated files, but
this is a start.

@caesarxuchao I'm assuming we do not need the generated files in the client lib?


This change is Reviewable

@thockin thockin added the release-note-none Denotes a PR that doesn't merit a release note. label Sep 24, 2016
@k8s-github-robot k8s-github-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Sep 24, 2016
@thockin thockin force-pushed the dont-checkin-generated-code-revert-revert branch from 7ccf69f to 256a39b Compare September 26, 2016 16:01
@thockin
Copy link
Member Author

thockin commented Sep 26, 2016

@caesarxuchao I don't know where the script that generates staging/ lives - it needs to make generated_files before saving directories. Point me at it to confirm?

@k8s-ci-robot
Copy link
Contributor

Jenkins GCI Kubemark GCE e2e failed for commit 256a39b975c8606b49d6fc54039fc4e4c899c080. Full PR test history.

The magic incantation to run this job again is @k8s-bot kubemark gci e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@thockin
Copy link
Member Author

thockin commented Sep 26, 2016

@k8s-bot gci gce e2e test this

@caesarxuchao
Copy link
Member

Yeah, client-go needs the generated files. Could you call make generated_files in this script?

@thockin
Copy link
Member Author

thockin commented Sep 26, 2016

Yeah, that should be enough - do you have bandwidth to make that change
if/when this PR goes through?

On Mon, Sep 26, 2016 at 10:04 AM, Chao Xu notifications@github.com wrote:

Yeah, client-go needs the generated files. Could you call make
generated_files in this script
https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/client-go/copy.sh
?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#33440 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFVgVEi84k5JqYxC4Awww0bTKUNjPxkdks5qt_segaJpZM4KFxZc
.

@caesarxuchao
Copy link
Member

Sure. We have an e2e test that will catch the missing generated files, so I won't forget.

@thockin
Copy link
Member Author

thockin commented Sep 26, 2016

@k8s-bot gci gce e2e test this

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 26, 2016
@thockin thockin force-pushed the dont-checkin-generated-code-revert-revert branch from 256a39b to a9c6223 Compare September 27, 2016 03:07
@k8s-github-robot k8s-github-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Sep 27, 2016
@thockin thockin force-pushed the dont-checkin-generated-code-revert-revert branch from a9c6223 to 51aa4e8 Compare September 27, 2016 15:47
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 27, 2016
@thockin
Copy link
Member Author

thockin commented Sep 27, 2016

rebased

@caesarxuchao
Copy link
Member

LGTM. Thanks.

@caesarxuchao caesarxuchao added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 27, 2016
@krousey
Copy link
Contributor

krousey commented Sep 27, 2016

Is there a way to do this while still leaving the API packages in a build-able state?

@thockin
Copy link
Member Author

thockin commented Sep 27, 2016

You mean to check it in but not check it in? Schrodinger's code - it is
both committed and not committed, as long as you don't try to compile it.

On Tue, Sep 27, 2016 at 10:28 AM, krousey notifications@github.com wrote:

Is there a way to do this while still leaving the API packages in a
build-able state?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#33440 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFVgVBwe6phbRVALODeE2RFNxIzo-Vqiks5quVI6gaJpZM4KFxZc
.

@krousey
Copy link
Contributor

krousey commented Sep 27, 2016

No. The main errors seem to be referencing conversion functions that are generated. These function are registered with the scheme. Perhaps define and register the functions in the same file, so when it's not there, all references are gone.

@thockin thockin removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 27, 2016
@thockin
Copy link
Member Author

thockin commented Sep 27, 2016

Ahh, yes, the places that register their own conversions should not be
needed - I didn't fix that in this PR. If you want me to do that, I can.
I will remove LGTM.

On Tue, Sep 27, 2016 at 10:38 AM, krousey notifications@github.com wrote:

No. The main errors seem to be referencing conversion functions that are
generated. These function are registered with the scheme. Perhaps define
and register the functions in the same file, so when it's not there, all
references are gone.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#33440 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFVgVKn6ft5HVd1FJB_BkpHQEPhs8-Jlks5quVSsgaJpZM4KFxZc
.

@nikhiljindal
Copy link
Contributor

Verifying that this does not break federation

@k8s-bot federation gce e2e test this

@lavalamp
Copy link
Member

I haven't looked at this and probably won't have a chance today, but please try to make everything build even without these files checked in.

@k8s-ci-robot
Copy link
Contributor

Jenkins Federation GCE e2e failed for commit 51aa4e817470fa33f805b766cc914541c6af698e. Full PR test history.

The magic incantation to run this job again is @k8s-bot federation gce e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@thockin
Copy link
Member Author

thockin commented Aug 10, 2017

@spxtr - any way to make progress on this? It is LITERALLY a year later. I'm rebasing for the hundredth time and finding new things that have changed underneath me. I am tired of this. I love the idea of Bazel, but it's not paying off for me...

@thockin
Copy link
Member Author

thockin commented Aug 10, 2017

@caesarxuchao I need your advice on the staging export process after this - if the zz_generated files are not checked in, we need to generate and add them before the export happens. Where does that happen?

@thockin thockin force-pushed the dont-checkin-generated-code-revert-revert branch from 30510a0 to ddd90a0 Compare August 10, 2017 15:37
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 10, 2017
@thockin
Copy link
Member Author

thockin commented Aug 10, 2017

@ixdy @mikedanese PTAL at bazel fail - the generated BUILD file is failing.

W0810 15:39:01.141] ERROR: /workspace/k8s.io/kubernetes/pkg/generated/openapi/BUILD:7:1: unexpected keyword 'deps' in call to openapi_library(name, tags, srcs, openapi_targets = [], vendor_targets = []).
W0810 15:39:01.143] ERROR: package contains errors: pkg/generated/openapi.
W0810 15:39:25.101] ERROR: /workspace/k8s.io/kubernetes/pkg/generated/openapi/BUILD:71:1: Target '//pkg/generated/openapi:def.bzl' contains an error and its package is in error and referenced by '//pkg/generated/openapi:package-srcs'.

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Aug 10, 2017

@thockin: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
Jenkins Bazel Build 506030d link @k8s-bot bazel test this
Jenkins verification 506030d link @k8s-bot verify test this
pull-kubernetes-bazel ddd90a0 link /test pull-kubernetes-bazel
pull-kubernetes-unit ddd90a0 link /test pull-kubernetes-unit
pull-kubernetes-federation-e2e-gce ddd90a0 link /test pull-kubernetes-federation-e2e-gce
pull-kubernetes-verify ddd90a0 link /test pull-kubernetes-verify

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@k8s-github-robot
Copy link

@thockin PR needs rebase

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 11, 2017
@spxtr
Copy link
Contributor

spxtr commented Aug 14, 2017

@spxtr - any way to make progress on this? It is LITERALLY a year later.

For incremental progress we can do zz_generated.deepcopy.go right now. I ran the merge-conflict-finder script and the top 20 are

     12 hack/verify-flags/known-flags.txt
     12 api/openapi-spec/swagger.json
      9 pkg/kubelet/kubelet.go
      9 pkg/api/zz_generated.deepcopy.go
      9 pkg/api/v1/types.go
      8 staging/src/k8s.io/api/core/v1/generated.pb.go
      8 pkg/api/v1/types_swagger_doc_generated.go
      8 cmd/kubelet/app/server.go
      7 pkg/api/v1/generated.proto
      7 hack/make-rules/test-cmd-util.sh
      6 test/e2e_node/BUILD
      6 staging/src/k8s.io/client-go/pkg/api/v1/zz_generated.conversion.go
      6 staging/src/k8s.io/client-go/pkg/api/v1/types_swagger_doc_generated.go
      6 staging/src/k8s.io/client-go/pkg/api/v1/types.go
      6 staging/src/k8s.io/client-go/pkg/api/v1/generated.proto
      6 pkg/controller/daemon/daemoncontroller.go
      6 pkg/api/v1/zz_generated.deepcopy.go
      6 pkg/api/v1/zz_generated.conversion.go
      6 pkg/api/v1/types.generated.go
      6 pkg/api/v1/generated.pb.go

, so evidently that will help. I got conversion and default generated files partway complete, but they're not quite ready to go yet. I might've bitten off a bit more than I should've. I was hoping to make it so that adding a new api group would require no manual editing of BUILD files, but if we drop that requirement then we can do the rest of these with much less effort. When adding a new dependency or a new API group, I would then make the conversion-gen and default-gen programs print out an error when they notice it's missing.

I think @ixdy is interested in moving this forward.

@thockin
Copy link
Member Author

thockin commented Aug 20, 2017

I'm on hold waiting for the bazel experts to tell me what they need. Manually editing a BUILD file is bad, but as long as something can error and tell users they need to do that, it might be livable.

@thockin
Copy link
Member Author

thockin commented Aug 20, 2017

Are we approaching this wrong? Maybe making bazel do the regeneration is not the right answer. Maybe make should call bazel after it has recalculated automatic deps and rebuilt BUILD files and whatever precursors we need to do anyway?

@spxtr
Copy link
Contributor

spxtr commented Aug 21, 2017

While preparing my PR for deepcopy I found that the recent switch to gazelle invalidated much of my work in a non-trivial fashion. It's not clear how kazel and gazelle should play together when both need to touch the same rules. @mikedanese thinks that bazel-contrib/rules_go#614 is the way forward.

Maybe make should call bazel after it has recalculated automatic deps and rebuilt BUILD files and whatever precursors we need to do anyway?

As much as I hate the idea of this, it's actually a pretty good way to get generated files out of the repo in a way that lets us migrate to bazel-generation over time. We just need to be careful about the order in which we run things.

@k8s-github-robot k8s-github-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 23, 2017
@k8s-ci-robot k8s-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed keep-open labels Dec 15, 2017
@cblecker
Copy link
Member

I know the goal of moving away from checking in generated code is still there, but is this PR still relevant @thockin @spxtr ? It's currently frozen with no activity in 6+ months.

@spiffxp
Copy link
Member

spiffxp commented May 10, 2019

/remove-lifecycle frozen
/lifecycle rotten
/close
I'm closing this due to inactivity. Please /reopen if you wish to continue working on this

@k8s-ci-robot
Copy link
Contributor

@spiffxp: Closed this PR.

In response to this:

/remove-lifecycle frozen
/lifecycle rotten
/close
I'm closing this due to inactivity. Please /reopen if you wish to continue working on this

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 lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. labels May 10, 2019
@thockin thockin deleted the dont-checkin-generated-code-revert-revert branch November 5, 2022 20:26
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. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.