-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add generating samples for any kind of object that supports ope…
…nAPIV3schema (#121) * feat: add generating samples for any kind of object that supports openAPIV3schema * fix defer closing write closer in function instead of at the place of creation * adding release docs and README update
- Loading branch information
Showing
29 changed files
with
2,057 additions
and
181 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Sync File from Repo B | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * *" # Runs daily at midnight | ||
workflow_dispatch: | ||
|
||
jobs: | ||
sync-file: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Kubernetes API server | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: kubernetes/apiextensions-apiserver | ||
path: apiextensions-apiserver | ||
- name: Checkout This Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ github.repository }} | ||
path: this | ||
|
||
- name: Install GitHub CLI | ||
run: sudo apt-get install gh | ||
|
||
- name: Run sync script | ||
run: | | ||
./this/hack/sync-file.sh | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
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
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
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,21 @@ | ||
# Release v1.0.0 | ||
|
||
:boom: _**BREAKING CHANGE**_ :boom: | ||
|
||
This is the first official 1.0.0 version of CRD sample. This tool has come a long way | ||
from simply generating sample YAML files from CRDs. It now supports the following | ||
major features: | ||
|
||
- CRD testing | ||
- Generating JSON schemas | ||
- Validating more types other than CRD that support openAPIV3schema section in their `spec` field | ||
- Generating minimum required yamls | ||
- Adding comments | ||
- Generating YAML that 100% conforms to the given schema, respecting minimum values, regex, formats, etc. | ||
- A feature rich website with | ||
- live code changes rendering | ||
- back navigation | ||
- lots of tiny options | ||
|
||
This has been quite the journey. Hopefully, from now on, the API will be somewhat stable. I can't promise completey | ||
unbreakable changes, but I promise not to break anything in Patch versions. |
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,33 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
# Move into the directory of repo_a and setup git user | ||
git config user.name "GitHub Action" | ||
git config user.email "[email protected]" | ||
|
||
# Copy from api server to local | ||
BRANCH_NAME="update-file-$(date +%Y%m%d%H%M%S)" | ||
FILE_PATH=this/pkg/types_jsonschema.go | ||
cp apiextensions-apiserver/pkg/apis/apiextensions/v1beta1/types_jsonschema.go this/pkg | ||
|
||
# Check if there is a difference between the files | ||
if git diff --exit-code "$FILE_PATH"; then | ||
echo "No changes detected, exiting." | ||
exit 0 | ||
fi | ||
|
||
echo "Changes detected, creating a pull request..." | ||
|
||
# Stage the changes | ||
git add "$FILE_PATH" | ||
git commit -m "Updated $FILE_PATH from repository B" | ||
|
||
# Push the branch to repository A | ||
git push origin "$BRANCH_NAME" | ||
|
||
# Create a pull request using the GitHub CLI | ||
gh auth login --with-token <<< "$GITHUB_TOKEN" | ||
gh pr create --title "Sync $FILE_PATH from repo B" --body "This PR updates $FILE_PATH from repository B" --head "$BRANCH_NAME" --base main | ||
|
||
echo "Pull request created successfully." |
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,11 @@ | ||
# Files in this folder | ||
|
||
Some of the files in this folder are taken from the following repository verbatim: | ||
[Kubernetes Extensions api server repository](https://github.com/kubernetes/apiextensions-apiserver) | ||
|
||
The following files are copied over: | ||
- types_jsonschema.go | ||
- marshal.go | ||
- marshal_test.go | ||
|
||
This is to ensure that we marshal the JSON schema types correctly. |
Oops, something went wrong.