forked from kubernetes-sigs/kubebuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: automatically update componentconfig tutorial
Co-authored-by: Camila Macedo <7708031+camilamacedo86@users.noreply.github.com> chore: refactor
- Loading branch information
Showing
12 changed files
with
270 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 0 additions & 61 deletions
61
docs/book/src/component-config-tutorial/testdata/generate_componentconfig.sh
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
docs/book/src/component-config-tutorial/testdata/project/api/v2/groupversion_info.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
docs/book/src/component-config-tutorial/testdata/project/api/v2/zz_generated.deepcopy.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
docs/book/src/component-config-tutorial/testdata/project/hack/boilerplate.go.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
docs/book/src/component-config-tutorial/testdata/project/main.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2023 The Kubernetes Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
|
||
check_directory="$(dirname "$0")/../../docs/book/src/" | ||
|
||
# Check docs directory first. If there are any uncommitted change, fail the test. | ||
if [[ $(git status ${check_directory} --porcelain) ]]; then | ||
echo "Generate Docs test precondition failed!" | ||
echo "Please commit the change under docs directory before running the Generate Docs test" | ||
exit 1 | ||
fi | ||
|
||
make generate-docs | ||
|
||
# Check if there are any changes to files under testdata directory. | ||
if [[ $(git status ${check_directory} --porcelain) ]]; then | ||
git status ${check_directory} --porcelain | ||
git diff ${check_directory} | ||
echo "Generate Docs failed!" | ||
echo "Please, if you have changed the scaffolding make sure you have run: make generate" | ||
exit 1 | ||
else | ||
echo "Generate Docs passed!" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
Copyright 2023 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
componentconfig "sigs.k8s.io/kubebuilder/v3/hack/docs/internal" | ||
) | ||
|
||
func main() { | ||
fmt.Println("Generating documents...") | ||
|
||
fmt.Println("Generating component-config tutorial...") | ||
UpdateComponentConfigTutorial() | ||
|
||
// TODO: Generate cronjob-tutorial | ||
|
||
// TODO: Generate multiversion-tutorial | ||
} | ||
|
||
func UpdateComponentConfigTutorial() { | ||
binaryPath := "/tmp/kubebuilder/bin/kubebuilder" | ||
samplePath := "docs/book/src/component-config-tutorial/testdata/project/" | ||
|
||
sp := componentconfig.NewSample(binaryPath, samplePath) | ||
|
||
sp.Prepare() | ||
|
||
sp.GenerateSampleProject() | ||
|
||
sp.UpdateTutorial() | ||
|
||
sp.CodeGen() | ||
} |
Oops, something went wrong.