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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰: sync kb binary from source code for docs #3520

Conversation

Kavinjsir
Copy link
Contributor

@Kavinjsir Kavinjsir commented Aug 3, 2023

Description

This PR aims to ensure that the Kubebuilder binary used for docs generation is built from the source code so that the docs can be updated corresponding to the latest code change.

  • Create a new hack/docs/generate.sh that builds the kb executable from source code and run the go code to re-generate docs samples
  • Modify the target generate-docs to call hack/docs/generate.sh
  • Modify the target check-docs to drop unnecessary import and call hack/docs/generate.sh
  • Change the go code to use kb binary /tmp/kubebuilder/bin/kubebuilder which is generated by build_kb (instead of the default kb from user's os env).

Motivation:

Partially resolve #3435
See comments:

  1. Drop unnecessary steps and better logging when generating docs聽#3435 (comment)
  2. Drop unnecessary steps and better logging when generating docs聽#3435 (comment)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 3, 2023
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Aug 3, 2023
@Kavinjsir
Copy link
Contributor Author

/test pull-kubebuilder-e2e-k8s-1-26-0

Makefile Outdated
@@ -63,18 +63,14 @@ install: build ## Build and install the binary with the current source code. Use
##@ Development

.PHONY: generate
generate: generate-testdata generate-docs ## Update/generate all mock data. You should run this commands to update the mock data after your changes.
generate: generate-testdata check-docs ## Update/generate all mock data. You should run this commands to update the mock data after your changes.
Copy link
Member

@camilamacedo86 camilamacedo86 Aug 8, 2023

Choose a reason for hiding this comment

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

The target generate has the purpose to generate only and not check
The check is used in the CI only for we ensure that the docs were properly generate.
IMO it should work at the same way of generate-testdata and check-testdata.

Copy link
Contributor Author

@Kavinjsir Kavinjsir Aug 9, 2023

Choose a reason for hiding this comment

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

Sounds good!
I just follow your idea and make the corresponding updates:

  • Create a new hack/docs/generate.sh that builds the kb executable from source code and run the go code to re-generate docs samples
  • Modify the target generate-docs to call hack/docs/generate.sh
  • Modify the target check-docs to drop unnecessary import and call hack/docs/generate.sh

Let me know how you'd like this or if I'm understanding wrong :)

@Kavinjsir Kavinjsir force-pushed the fix/build-kb-for-docs-generation branch from 1e75efd to dfe3ab8 Compare August 9, 2023 02:37
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 9, 2023
Copy link
Member

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

Great work.
I am moving with this one because the issue faced in the preview has no relation and it is sorted in another PR.

Thank you.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: camilamacedo86, Kavinjsir

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

@camilamacedo86 camilamacedo86 merged commit 68abac1 into kubernetes-sigs:master Aug 15, 2023
18 of 20 checks passed
@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 15, 2023
Sajiyah-Salat pushed a commit to Sajiyah-Salat/kubebuilder that referenced this pull request Aug 22, 2023
yyy1000 pushed a commit to yyy1000/kubebuilder that referenced this pull request Aug 27, 2023
yyy1000 added a commit to yyy1000/kubebuilder that referenced this pull request Aug 27, 2023
feat: get data

feat: add change

feat: remove log

feat: add e2e test

build(deps): bump golang.org/x/tools from 0.11.0 to 0.12.0

Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.11.0 to 0.12.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](golang/tools@v0.11.0...v0.12.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

chore(docs): change folder pkg to internal/controller in the migration guide

fix: ensure external plugin can scaffold files in new dirs

:seedling: Image name edge cases covered (kubernetes-sigs#3514)

imagename edge case cover

:seedling: logs info updated (kubernetes-sigs#3512)

logs info updated

:bug: fix doc preview

馃悰: sync kb binary from source code for docs (kubernetes-sigs#3520)

fix: sync kb binary from source code for docs

:bug: fix typos in scaffolded makefiles

:book: fix escaped html in markdown code segments

:bug: (go/v4) fix makefile target to build images ensuring its single responsability

refactor: externalize cfg

:bug: (deployimage): fix e2e tests which are using go/v3 which is deprecated. Ensure that we are using the go/v4

ensure that we call go tidy when we generate sample docs

:sparkles: (Kustomize/v2, go/v4): upgrade controller-tools from 0.12.0 to 0.13.0 (kubernetes-sigs#3561)

(go/v4): Upgrade controller-tools from 0.12.0 to v0.13.0

:sparkles: improve logs from alpha command generate

:bug: (deployimage/v1-beta1): fix scaffold with multigroup and add optional plugins to multigroup sample to validate changes

:bug: change deprecated warning to yellow

feat: remove quota

fix: add space

fix: change kind

Update test/e2e/alphagenerate/generate_test.go

Co-authored-by: Tony (TianYi) <kavinjsir@gmail.com>
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. 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.

Drop unnecessary steps and better logging when generating docs
3 participants