-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[DX/tests] - Update doc tutorials programatically for any PR change #2510
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
Comments
This proposal makes sense to me. Anything that will improve keeping the samples updated is great. |
Hi @camilamacedo86, can I work on this issue as my first contribution to kubebuilder project? 🙏 |
Sure, I'd recommend we begin by trying. to check this approach with the Component Config because this one is a smaller sample the docs |
/assign |
Sorry that I could not find time to work on this for the past few weeks, but I've finally started working on it 🙇 |
That is fine. No worry. |
Sorry, let me clarify what we need to do here in the component-config's case as an example!
I'm not sure where "the code source of the book samples" is located... Would you give me some pointers to it? |
@shuheiktgw
|
Hi @AlmogBaku, If you are looking to know if that are the steps required to update the samples inside of the doc:
If you are asking if the automation will be like a shell script doing these steps: |
Hi @shuheiktgw, Are you working in this one? |
Hi @ shuheiktgw, Are you working on this one? If you need help please feel free to ping your questions into the kubebuilder slack channel. If not, could you please remove your assign so that others might want to looking on this one? |
Sorry that I didn't notice the message and I'm not working on this issue so let me unassign myself 🙇 |
@camilamacedo86 Thx for bringing this great idea! I'm trying to understand the workflow you suggest and list as below, would you like to fix me if anything wrong? IdeaIn brief, we hope every PR can keep the sample sync with the kubebuilder behavior. Similar ScenarioSuch attempt is similar as how we test the kubebuilder behavior through CI:
Proposed workflowSo, what proposed in the issue is: apart from
Challenges
|
Thanks @Kavinjsir for your brief answer. I got some idea on how things work and what needs to change. Hey @camilamacedo86 is thier anything to add in @Kavinjsir comment. |
HI @Kavinjsir, That #2510 (comment) is a great summary 🥇 . The proposed solution to sort out the challenges would be to do scaffolds as operator-sdk does (using kb as lib) to generate the samples with code on top, see:
Therefore, we would no longer need the shell scripts. We would call kubebuilder binary, run the commands to generate the docs samples, then in golang inject the code on top ( using the methods to insert, and replace the string as we do in the plugins. example to insert code in the controller ) |
Thx @camilamacedo86 , just initialized a PR to start with the |
/assign |
For we close this one we just need start to generate the Multiversion-tutorial see: https://github.com/kubernetes-sigs/kubebuilder/tree/master/docs/book/src/multiversion-tutorial/testdata/project as we do that for others now, more info: https://github.com/kubernetes-sigs/kubebuilder/tree/master/hack/docs A help here is very welcome since if we be able to do that it will reduce a lot our effort to keep the things maintained and also help us to better ensure the project and that our samples are still working basically after the changes. |
Hi @Eileen-Yu You did an amazing job here. So, because it is only missing one tutorial to make easier others understand what we need to do I create an issue with all info here: #3880 If you wish to contribute within we will be more than happy to receive your contribution. |
yeah the most work of this task is done except for 1 tutorial. |
What do you want to happen?
Description
Currently, we have the following samples which are used in the docs:
You can see that the docs are using the samples and the info provided on them are comments in the source code generated.
However, it has been very thought we keep updated with the changes performed in the scaffolds. Currently, we need to:
Goal
The goal of this task is we programmatically ensure that all samples will be updated for any pull request sent to the project. It. will help us keep the docs and update and improve the DX for contributors. Also, it can help us check the changes in the review process which also help us to easily ensure them.
Note that we have a shell script generate.sh which is called via the makefile target [make generate] (https://github.com/kubernetes-sigs/kubebuilder/blob/master/Makefile#L65-L67) to re-gen all samples under the testdata dir.
See that in the CI we check if the samples are updated or not and we do not lot contributions that change the scaffold go forward and get merged without the authors ensuring that they executed the
make generate
locally to keep all updated. (You can check the GitHub Action: https://github.com/kubernetes-sigs/kubebuilder/blob/master/.github/workflows/testdata.yml)Proposed Solution
Note that we do something very similar in the SDK project using the same implementations to ensure that is samples under testdatawill have the required code changes. See: https://github.com/operator-framework/operator-sdk/blob/master/hack/generate/samples/internal/go/v3/memcached_with_webhooks.go
make generate
target to ensure that it will be re-gen as tested in the CI.Extra info
Extra Labels
No response
Implementation solution for: #782
Current Status
The text was updated successfully, but these errors were encountered: