-
Notifications
You must be signed in to change notification settings - Fork 85
Add butane schemas for CoreOS and Flatcar #698
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| name: Validate Changes | ||
|
|
||
| on: | ||
| push: | ||
| paths: | ||
| - '/schemas/**.json' | ||
| branches: | ||
| - main | ||
|
|
||
| pull_request: | ||
| paths: | ||
| - '/schemas/**.json' | ||
|
|
||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| verify-json-validation: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
|
|
||
| - uses: actions/checkout@v3 | ||
|
|
||
| - name: Validate all json files using their own $schema properties | ||
| uses: cardinalby/schema-validator-action@v3 | ||
| with: | ||
| file: '/schemas/**.json|/schemas/**/*.json' | ||
| fileParser: json | ||
|
|
||
| - name: Validate butane files using associated json schema | ||
| uses: cardinalby/schema-validator-action@v3 | ||
| with: | ||
| file: '/schemas/**/*.bu' | ||
| fileParser: yaml | ||
| schema: './Butane-Schema.json' | ||
| mode: spec | ||
| refSchemasArray: | | ||
| [ | ||
| "./fcos/v1.4.0/1.4.0.json", | ||
| "./fcos/v1.5.0/1.5.0.json", | ||
| "./fcos/v1.6.0/1.6.0.json", | ||
| "./fcos/v1.7.0/1.7.0.json", | ||
| "./flatcar/v1.1.0/1.1.0.json" | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,149 @@ | ||
| { | ||
| "$schema": "http://json-schema.org/draft-07/schema#", | ||
| "$id": "dev/Butane-Schema.json", | ||
| "$comment": "Sources: https://github.com/coreos/butane", | ||
| "title": "Fedora Coreos Butane Schema", | ||
| "type": "object", | ||
| "required": ["variant", "version"], | ||
|
|
||
| "properties": { | ||
| "variant": { | ||
| "$id": "#/properties/variant", | ||
| "type": "string", | ||
| "title": "variant (string):", | ||
| "description": "Used to differentiate configs for different operating systems.", | ||
| "enum": [ | ||
| "fcos", | ||
| "flatcar" | ||
| ], | ||
| "default": "fcos" | ||
| }, | ||
| "version": { | ||
| "$id": "#/properties/version", | ||
| "type": "string", | ||
| "title": "version (string):" | ||
| } | ||
| }, | ||
| "allOf": [ | ||
| { | ||
| "oneOf": [ | ||
| { | ||
| "properties": { | ||
| "variant": { | ||
| "const": "fcos" | ||
| }, | ||
| "version": { | ||
| "enum": [ | ||
| "1.4.0", | ||
| "1.5.0", | ||
| "1.6.0", | ||
| "1.7.0" | ||
| ], | ||
| "default": "1.7.0" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "properties": { | ||
| "variant": { | ||
| "const": "flatcar" | ||
| }, | ||
| "version": { | ||
| "enum": ["1.1.0"], | ||
| "default": "1.1.0" | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "oneOf": [ | ||
| { | ||
| "allOf": [ | ||
| { | ||
| "properties": { | ||
| "variant": { | ||
| "const": "fcos" | ||
| }, | ||
| "version": { | ||
| "const": "1.4.0" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "$ref": "./fcos/v1.4.0/1.4.0.json" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "allOf": [ | ||
| { | ||
| "properties": { | ||
| "variant": { | ||
| "const": "fcos" | ||
| }, | ||
| "version": { | ||
| "const": "1.5.0" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "$ref": "./fcos/v1.5.0/1.5.0.json" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "allOf": [ | ||
| { | ||
| "properties": { | ||
| "variant": { | ||
| "const": "fcos" | ||
| }, | ||
| "version": { | ||
| "const": "1.6.0" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "$ref": "./fcos/v1.6.0/1.6.0.json" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "allOf": [ | ||
| { | ||
| "properties": { | ||
| "variant": { | ||
| "const": "fcos" | ||
| }, | ||
| "version": { | ||
| "const": "1.7.0" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "$ref": "./fcos/v1.7.0/1.7.0.json" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "allOf": [ | ||
| { | ||
| "properties": { | ||
| "variant": { | ||
| "const": "flatcar" | ||
| }, | ||
| "version": { | ||
| "const": "1.1.0" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "$ref": "./flatcar/v1.1.0/1.1.0.json" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,149 @@ | ||
| { | ||
| "$schema": "http://json-schema.org/draft-07/schema#", | ||
| "$id": "https://coreos.github.io/butane/schemas/Butane-Schema.json", | ||
| "$comment": "Sources: https://github.com/coreos/butane", | ||
| "title": "Fedora Coreos Butane Schema", | ||
| "type": "object", | ||
| "required": ["variant", "version"], | ||
|
|
||
| "properties": { | ||
| "variant": { | ||
| "$id": "#/properties/variant", | ||
| "type": "string", | ||
| "title": "variant (string):", | ||
| "description": "Used to differentiate configs for different operating systems.", | ||
| "enum": [ | ||
| "fcos", | ||
| "flatcar" | ||
| ], | ||
| "default": "fcos" | ||
| }, | ||
| "version": { | ||
| "$id": "#/properties/version", | ||
| "type": "string", | ||
| "title": "version (string):" | ||
| } | ||
| }, | ||
| "allOf": [ | ||
| { | ||
| "oneOf": [ | ||
| { | ||
| "properties": { | ||
| "variant": { | ||
| "const": "fcos" | ||
| }, | ||
| "version": { | ||
| "enum": [ | ||
| "1.4.0", | ||
| "1.5.0", | ||
| "1.6.0", | ||
| "1.7.0" | ||
| ], | ||
| "default": "1.7.0" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "properties": { | ||
| "variant": { | ||
| "const": "flatcar" | ||
| }, | ||
| "version": { | ||
| "enum": ["1.1.0"], | ||
| "default": "1.1.0" | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "oneOf": [ | ||
| { | ||
| "allOf": [ | ||
| { | ||
| "properties": { | ||
| "variant": { | ||
| "const": "fcos" | ||
| }, | ||
| "version": { | ||
| "const": "1.4.0" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "$ref": "https://coreos.github.io/butane/schemas/fcos/v1.4.0/1.4.0.json" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "allOf": [ | ||
| { | ||
| "properties": { | ||
| "variant": { | ||
| "const": "fcos" | ||
| }, | ||
| "version": { | ||
| "const": "1.5.0" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "$ref": "https://coreos.github.io/butane/schemas/fcos/v1.5.0/1.5.0.json" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "allOf": [ | ||
| { | ||
| "properties": { | ||
| "variant": { | ||
| "const": "fcos" | ||
| }, | ||
| "version": { | ||
| "const": "1.6.0" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "$ref": "https://coreos.github.io/butane/schemas/fcos/v1.6.0/1.6.0.json" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "allOf": [ | ||
| { | ||
| "properties": { | ||
| "variant": { | ||
| "const": "fcos" | ||
| }, | ||
| "version": { | ||
| "const": "1.7.0" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "$ref": "https://coreos.github.io/butane/schemas/fcos/v1.7.0/1.7.0.json" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "allOf": [ | ||
| { | ||
| "properties": { | ||
| "variant": { | ||
| "const": "flatcar" | ||
| }, | ||
| "version": { | ||
| "const": "1.1.0" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "$ref": "https://coreos.github.io/butane/schemas/flatcar/v1.1.0/1.1.0.json" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,34 @@ | ||||||
| # Butane-Schemas | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's maybe move this doc into a page in the docs directory so that it's rendered on the website. |
||||||
|
|
||||||
| Butane Schemas that helps creating Butane files for [Fedora Coreos](https://fedoraproject.org/fr/coreos/) and [Flatcar Linux](https://www.flatcar.org). | ||||||
|
|
||||||
| This json Schema that can be used as a helper to write a [butane config file](https://docs.fedoraproject.org/en-US/fedora-coreos/producing-ign/#_configuration_process) according to [its specifications](https://coreos.github.io/butane/specs/) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ## Use it with VsCode | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| - Install [VS Code](https://github.com/microsoft/vscode) | ||||||
| - Install the [Red hat YAML extension](https://github.com/redhat-developer/vscode-yaml) | ||||||
| - Associate a schema in the YAML file `# yaml-language-server: $schema=<urlToTheSchema>` : [doc](https://github.com/redhat-developer/vscode-yaml?tab=readme-ov-file#associating-a-schema-in-the-yaml-file) | ||||||
| - For butane schema, use `# yaml-language-server: $schema=https://coreos.github.io/butane/schemas/Butane-Schema.json"` | ||||||
|
|
||||||
| ## Setup vs code to associate a schema to your *.bu files whitout setting schema manually | ||||||
|
|
||||||
| - Edit your `settings.json` file like : | ||||||
|
|
||||||
| New with version 1.8.0 of the [Red hat YAML extension](https://github.com/redhat-developer/vscode-yaml) and since this I've published this work on [JSON Schema Store](https://www.schemastore.org) you just need to change your files associations. | ||||||
|
|
||||||
| ```JSON | ||||||
| "settings": { | ||||||
| "files.associations": { | ||||||
| "*.bu": "yaml" | ||||||
| } | ||||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| ## Use it with Sublime text | ||||||
|
|
||||||
| You can also use these butane schemas with Sublime text editor thanks to [Joe Doss](https://github.com/jdoss) via [sublime-butane](https://github.com/jdoss/sublime-butane). | ||||||
|
|
||||||
| ## List of clients that use uses the Red hat YAML extension | ||||||
|
|
||||||
| [some known clients consuming Red hat YAML extension](https://github.com/redhat-developer/yaml-language-server?tab=readme-ov-file#clients) | ||||||
|
Comment on lines
+32
to
+34
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you clarify why we need this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's informative only ... can be dropped, or not |
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum, what are those fort? If it's for an experimental version then it should be under there?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is used for dev/local purpose
It's called by the dev.bu file to test local things, without that we should create a "how to contribute" file with this sample
[edit] It's essentially called by *.bu files in directories e.g. fcos/v1.7.0/1.7.0.bu for validation
I also have in my repo a github action that validate *.bu files and json files
dev.bu dropped as useless
[edit] I added an updated version of the github action that validate schemas ... don't really know how to test it without merging it 😕