Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/validate-schemas.yml
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"
]
1 change: 1 addition & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ nav_order: 9

### Features

- Add JSON Schemas for CoreOS and Flatcar Butane variants
- Add `systemd.quadlets` section for embedding Podman Quadlet files
_(fcos 1.8.0-exp, fiot 1.1.0-exp, flatcar 1.2.0-exp, openshift
4.22.0-exp, r4e 1.2.0-exp)_
Expand Down
149 changes: 149 additions & 0 deletions schemas/Butane-Schema-dev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
{

Copy link
Copy Markdown
Member

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?

@Nemric Nemric Apr 21, 2026

Copy link
Copy Markdown
Contributor Author

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 😕

"$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"
}
]
}
]
}
]
}
149 changes: 149 additions & 0 deletions schemas/Butane-Schema.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"
}
]
}
]
}
]
}
34 changes: 34 additions & 0 deletions schemas/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Butane-Schemas

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
# Butane-Schemas
# Butane JSON Schemas

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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/)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
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/)
This JSON Schema 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/).


## Use it with VsCode

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
## Use it with VsCode
## Use it with Visual Studio Code


- 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you clarify why we need this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's informative only ... can be dropped, or not

Loading
Loading