Skip to content
This repository has been archived by the owner on Feb 2, 2024. It is now read-only.

fix: dereference jsonschema from a template #66

Merged
merged 1 commit into from
Jun 8, 2023

Conversation

tumido
Copy link
Member

@tumido tumido commented Jun 3, 2023

Description of the change

Relocates values.schema.json to values.schema.tmpl.json. This file can be templated by Jinja2 and can contain $refs. This file is later processed by pre-commit: it renders the template and unpacks the references.

Existing or Associated Issue(s)

Resolves: #64
Workaround for: https://issues.redhat.com/browse/ODC-7324 (won't be fixed in OCP)

Additional Information

I chose to write this small action in Python since it's native to pre-commit (therefore we're not introducing new stack, instead reusing what's available). It's easy to automate this through pre-commit to ensure our values.schema.json always matches values.schema.tmpl.json recipe. And also it also a very short script compared to golang or js. I know we're introducing a different templating language than used in Helm or helm-docs, it's unfortunate.

You can verify this change by installing this chart from a custom repository:

apiVersion: helm.openshift.io/v1beta1
kind: ProjectHelmChartRepository
metadata:
  name: test-repo
spec:
  connectionConfig:
    url: 'https://raw.githubusercontent.com/tumido/helm-backstage/test-repo'

Checklist

  • Chart version bumped in Chart.yaml according to semver.
  • Variables are documented in the values.yaml and added to the README.md. The helm-docs utility can be used to generate the necessary content. Use helm-docs --dry-run to preview the content.
  • JSON Schema generated.
  • List tests pass for Chart using the Chart Testing tool and the ct lint command.

Copy link
Member

@schultzp2020 schultzp2020 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@sabre1041 sabre1041 left a comment

Choose a reason for hiding this comment

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

This looks good. Made one small enhancement so that the output is formatted

.pre-commit/jsonschema-dereference.py Outdated Show resolved Hide resolved
Signed-off-by: Tomas Coufal <tcoufal@redhat.com>
@tumido tumido force-pushed the fix-dereference-jsonschema branch from 523a356 to d844883 Compare June 8, 2023 11:06
@tumido tumido requested a review from sabre1041 June 8, 2023 11:07
@tumido tumido merged commit c0009f1 into janus-idp:main Jun 8, 2023
@tumido tumido deleted the fix-dereference-jsonschema branch June 8, 2023 11:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Openshift Helm catalog is unable to pull remote JSON schemas on OpenShift Local
3 participants