Skip to content

Commit

Permalink
fix: generate the values schema to not require external URLs
Browse files Browse the repository at this point in the history
fixes #431
  • Loading branch information
RangerRick committed Dec 3, 2024
1 parent 1b9c55d commit 22939b1
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ jobs:
with:
fetch-depth: 0

- name: Generate production values.yaml schema
run: |
npm --no-progress --no-audit ci
npm run schema
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.6.1

Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ jobs:
with:
fetch-depth: 0

- name: Generate production values.yaml schema
run: |
npm --no-progress --no-audit ci
npm run schema
- name: Lint Code Base
uses: super-linter/super-linter/slim@v7.2.0
env:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ jobs:
with:
fetch-depth: 0

- name: Generate production values.yaml schema
run: |
npm --no-progress --no-audit ci
npm run schema
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ jobs:
with:
fetch-depth: 0

- name: Generate production values.yaml schema
run: |
npm --no-progress --no-audit ci
npm run schema
- name: Set up Helm
uses: azure/setup-helm@v4.2.0

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ dist/
values-*.yaml
.history
/public

/charts/netbox/values.schema.json
/node_modules
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@
"description": "https://artifacthub.io/packages/helm/bitnami/postgresql",
"allOf": [
{
"$ref": "https://raw.githubusercontent.com/bitnami/charts/master/bitnami/postgresql/values.schema.json"
"$ref": "https://raw.githubusercontent.com/bitnami/charts/refs/tags/postgresql/16.2.4/bitnami/postgresql/values.schema.json"
},
{
"properties": {
Expand Down Expand Up @@ -935,7 +935,7 @@
"description": "https://artifacthub.io/packages/helm/bitnami/redis",
"allOf": [
{
"$ref": "https://raw.githubusercontent.com/bitnami/charts/master/bitnami/redis/values.schema.json"
"$ref": "https://raw.githubusercontent.com/bitnami/charts/refs/tags/redis/20.4.0/bitnami/redis/values.schema.json"
},
{
"properties": {
Expand Down
16 changes: 16 additions & 0 deletions generate-values-schema.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import $RefParser from '@apidevtools/json-schema-ref-parser'
import fs from 'fs'

const mySchema = JSON.parse(
fs.readFileSync('./charts/netbox/values.schema.in.json', 'utf-8')
)

try {
await $RefParser.dereference(mySchema)
fs.writeFileSync(
'./charts/netbox/values.schema.json',
JSON.stringify(mySchema, undefined, 2) + '\n'
)
} catch (err) {
console.error(err)
}
68 changes: 68 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "netbox-chart",
"version": "0.1.0",
"type": "module",
"description": "NetBox Helm Chart",
"repository": {
"type": "git",
"url": "git+https://github.com/netboxcommunity/helm-chart.git"
},
"author": "Benjamin Reed <github@raccoonfink.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/netboxcommunity/helm-chart/issues"
},
"homepage": "https://github.com/netboxcommunity/helm-chart#readme",
"scripts": {
"schema": "node ./generate-values-schema.js"
},
"devDependencies": {
"@apidevtools/json-schema-ref-parser": "^11.7.2"
}
}

0 comments on commit 22939b1

Please sign in to comment.