feat: Generate the Artifact Hub CRD annotation from extra/crds.yaml - #622
feat: Generate the Artifact Hub CRD annotation from extra/crds.yaml#622lfrancke wants to merge 2 commits into
Conversation
This is derived from extra/crds.yaml and ends up in Chart.yaml.
|
If you like I can create this as a test PR in one repo first. |
| # displayName: TrustStore | ||
| # description: A TrustStore requests information about how to validate secrets ... | ||
| crd-annotation: crds | ||
| @CRDS="$$(yq ea -o=yaml '[.] | map(.spec.versions |= map(select(.storage == true))) | map({"kind": .spec.names.kind, "version": .spec.versions[0].name, "name": .metadata.name, "displayName": .spec.names.kind, "description": (.spec.versions[0].schema.openAPIV3Schema.description // "")})' extra/crds.yaml)" \ |
There was a problem hiding this comment.
Does this overrwrite the extra/crds.yaml in the repo, or does it do something else that only gets seen when doing artifact hub stuff?
There was a problem hiding this comment.
Instead of answering here I'll try to clarify the comment. Thanks for taking a look!
Addresses review feedback: the recipe was one long line, so it was not obvious that it reads extra/crds.yaml and writes Chart.yaml. CRD_ANNOTATION_READ and CRD_ANNOTATION_WRITE are now separate, each with its own comment. Still a single shell command: the env-var prefix is needed because the value is multi-line and reaches yq via strenv.
| mkdir -p extra | ||
| cargo run --bin stackable-"${OPERATOR_NAME}" -- crd > extra/crds.yaml | ||
|
|
||
| # This adds CRD metadata for artifacthub.io (AH) to Chart.yaml. |
There was a problem hiding this comment.
I feel like this should be an xtask (or even a subcommand on the operator itself, like the crd subcommand) instead.
Also, this would need to be executed by pre-commit/prek to ensure consistency.
There was a problem hiding this comment.
I want to push back on both.
-
We don't have xtask or anything like that for any other command in here and we already even do rewriting (for version stuff) with yq. So this is consistent
-
This is already executed via prek (regenerate-charts) so that's covered and it triggers when it's inconsistent.
This is derived from extra/crds.yaml and ends up in Chart.yaml.