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

Trigger Schema Generated Tool #6489

Open
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

SpiritZhou
Copy link
Contributor

Generating trigger metadata schema according to new declarative scaler configuration, which can be used for validation or other related improvement.

Input:
make generate-scaler-schemas [--keda-version][--scalers-builder-file][--scalers-files-dir][--specify-scaler][--output-file-path]

Output:
scaler-metadata-schemas.yaml

Checklist

Relates to # #6345

SpiritZhou added 3 commits January 20, 2025 10:11
Signed-off-by: SpiritZhou <[email protected]>
Signed-off-by: SpiritZhou <[email protected]>
Signed-off-by: SpiritZhou <[email protected]>
@SpiritZhou SpiritZhou requested a review from a team as a code owner January 20, 2025 02:39
SpiritZhou added 10 commits January 20, 2025 10:43
Signed-off-by: SpiritZhou <[email protected]>
fix
Signed-off-by: SpiritZhou <[email protected]>
Fix
Signed-off-by: SpiritZhou <[email protected]>
Signed-off-by: SpiritZhou <[email protected]>
Signed-off-by: SpiritZhou <[email protected]>
Signed-off-by: SpiritZhou <[email protected]>
Signed-off-by: SpiritZhou <[email protected]>
Signed-off-by: SpiritZhou <[email protected]>
Signed-off-by: SpiritZhou <[email protected]>
Signed-off-by: SpiritZhou <[email protected]>
Copy link
Member

@JorTurFer JorTurFer left a comment

Choose a reason for hiding this comment

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

This PR is simply awesome! Could I suggest generating the output also as json as add a verification step during the CI to verify that the generated schemas are up to date?

Copy link
Member

@JorTurFer JorTurFer left a comment

Choose a reason for hiding this comment

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

This PR is simply awesome! Could I suggest generating the output also as json as add a verification step during the CI to verify that the generated schemas are up-to-date?

And probably we want to pull the schema during the release too, using the specific version of the release

@SpiritZhou
Copy link
Contributor Author

Sure, will add json as one more output file formate.

SpiritZhou added 2 commits January 23, 2025 16:20
Signed-off-by: SpiritZhou <[email protected]>
Signed-off-by: SpiritZhou <[email protected]>
Copy link
Member

@zroubalik zroubalik left a comment

Choose a reason for hiding this comment

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

Great stuff!

Minor improvements/suggestions:

  1. change the ouptup filename from scaler-metadata-schemas to scalers-metadata-schema
  2. store the schema in schema/generated
  3. regenerate the schema as part of the other generation stuff (probalby build step in the Makefile)
  4. add a verification step to make sure schema is up to data (similar like it is done for clientset)
  5. let's produce versioned schema file in the release pipeline named scalers-metadata-schema-v$KEDA_VERSION.json/yaml

SpiritZhou and others added 4 commits February 7, 2025 11:09
Signed-off-by: SpiritZhou <[email protected]>
Signed-off-by: SpiritZhou <[email protected]>
Signed-off-by: SpiritZhou <[email protected]>
SpiritZhou added 4 commits February 14, 2025 10:13
Fix
Signed-off-by: SpiritZhou <[email protected]>
Fix
Signed-off-by: SpiritZhou <[email protected]>
Fix
Signed-off-by: SpiritZhou <[email protected]>
fix
Signed-off-by: SpiritZhou <[email protected]>
@JorTurFer
Copy link
Member

My point about generating the schema for the release was more related with generating it during the release and pushing it to the release itself as we do with manifests ->

# Upload CRD deployment YAML file to GitHub release
- name: Upload Deployment YAML file
id: upload-crd-deployment-yaml
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: https://uploads.github.com/repos/kedacore/keda/releases/${{ steps.get-release-info.outputs.id }}/assets?name=keda-${{ steps.get_version.outputs.VERSION }}-crds.yaml
asset_path: keda-${{ steps.get_version.outputs.VERSION }}-crds.yaml
asset_name: keda-${{ steps.get_version.outputs.VERSION }}-crds.yaml
asset_content_type: application/x-yaml

Having the file in the repo could be worth, but not versioned, just generated from main always, WDYT?

@SpiritZhou
Copy link
Contributor Author

My point about generating the schema for the release was more related with generating it during the release and pushing it to the release itself as we do with manifests ->

# Upload CRD deployment YAML file to GitHub release
- name: Upload Deployment YAML file
id: upload-crd-deployment-yaml
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: https://uploads.github.com/repos/kedacore/keda/releases/${{ steps.get-release-info.outputs.id }}/assets?name=keda-${{ steps.get_version.outputs.VERSION }}-crds.yaml
asset_path: keda-${{ steps.get_version.outputs.VERSION }}-crds.yaml
asset_name: keda-${{ steps.get_version.outputs.VERSION }}-crds.yaml
asset_content_type: application/x-yaml

Having the file in the repo could be worth, but not versioned, just generated from main always, WDYT?

@JorTurFer I misunderstood your meaning before. Please correct me if I'm wrong:

  1. Generate the versioned JSON and YAML schema files and push them to release assets.
  2. Just keep the latest JSON and YAML schema files in the repo.

By the way, is there a way to test the release pipeline?

@JorTurFer
Copy link
Member

@JorTurFer I misunderstood your meaning before. Please correct me if I'm wrong:

  1. Generate the versioned JSON and YAML schema files and push them to release assets.
  2. Just keep the latest JSON and YAML schema files in the repo.

Yeah, With this approach, if someone is using them, just downloading the files from the release will give a versionated files or checking out the tag (but publishing them as other release assets is worth IMHO)

By the way, is there a way to test the release pipeline?

Sadly, no. There isn't any good way to test that pipeline. The way that I used in the past is enabling workflows on my fork and triggering it there, but it's not the best either

Signed-off-by: SpiritZhou <[email protected]>
@SpiritZhou SpiritZhou force-pushed the spiritzhou/triggerschema branch from 931ec5d to 5986674 Compare February 18, 2025 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants