Skip to content
Merged
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
11 changes: 8 additions & 3 deletions data/distrodefs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ disk or installer images for rpm based distributions.

## Overview

The definitions start with a "distros.yaml" file that contains details
about the supported distributions and distribution releases.
The definitions start with ".yaml" files that contain details
about the supported distributions and distribution releases. Each
".yaml" file's entries are appended to the previous in sorted order.

Note that in order to be available a distribution needs an auxiliary
repository JSON file under `./data/repositories` (or in a system
Expand Down Expand Up @@ -58,10 +59,14 @@ to make a complete new distro.

### distros.yaml

The existing `distros.yaml` contains:
The existing `fedora.yaml` contains:
- fedora

The existing `rhel.yaml` contains:
- rhel-{7,8,9,10}
- centos-{8,9,10}
- almalinux-{9,10}
- almalinux_kitten-10

#### Example of a real distros.yaml snippet

Expand Down
65 changes: 65 additions & 0 deletions data/distrodefs/fedora.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
distros:
- &fedora_rawhide
name: fedora-44
distro_like: fedora
preview: true
os_version: 44
release_version: 44
module_platform_id: platform:f44
product: "Fedora"
ostree_ref_tmpl: "fedora/44/%s/iot"
iso_label_tmpl: "{{.Product}}-{{.Distro.MajorVersion}}-{{.ISOLabel}}-{{.Arch}}"
default_fs_type: "ext4"
defs_path: fedora
runner: &fedora_runner
name: org.osbuild.fedora44
build_packages:
- "glibc" # ldconfig
- "systemd" # systemd-tmpfiles and systemd-sysusers
- "python3" # osbuild
oscap_profiles_allowlist:
- "xccdf_org.ssgproject.content_profile_ospp"
- "xccdf_org.ssgproject.content_profile_pci-dss"
- "xccdf_org.ssgproject.content_profile_standard"
bootstrap_containers:
x86_64: "registry.fedoraproject.org/fedora-toolbox:44"
aarch64: "registry.fedoraproject.org/fedora-toolbox:44"
ppc64le: "registry.fedoraproject.org/fedora-toolbox:44"
s390x: "registry.fedoraproject.org/fedora-toolbox:44"
# XXX: remove once fedora containers are part of the upstream
# fedora registry (and can be validated via tls)
riscv64: "ghcr.io/mvo5/fedora-buildroot:44"

# XXX: add repos here too, that requires some churn, see
# https://github.com/osbuild/images/compare/main...mvo5:yaml-distroconfig?expand=1
# and we will also need to think about backward compat, as currently
# dropping "$distro-$ver.json" files into
# /etc/osbuild-composer/repositories will define what distros are
# available via images and we will need to provide compatibility for
# that.
#
# Having the repos separated means when a new fedora release is out
# we will need to update two places which is clearly a regression from
# before.

- &fedora_stable
<<: *fedora_rawhide
name: "fedora-{{.MajorVersion}}"
match: 'fedora-[1-9][0-9]+'
preview: false
os_version: "{{.MajorVersion}}"
release_version: "{{.MajorVersion}}"
module_platform_id: "platform:f{{.MajorVersion}}"
ostree_ref_tmpl: "fedora/{{.MajorVersion}}/%s/iot"
runner:
<<: *fedora_runner
name: "org.osbuild.fedora{{.MajorVersion}}"
bootstrap_containers:
x86_64: "registry.fedoraproject.org/fedora-toolbox:{{.MajorVersion}}"
aarch64: "registry.fedoraproject.org/fedora-toolbox:{{.MajorVersion}}"
ppc64le: "registry.fedoraproject.org/fedora-toolbox:{{.MajorVersion}}"
s390x: "registry.fedoraproject.org/fedora-toolbox:{{.MajorVersion}}"
# XXX: remove once fedora containers are part of the upstream
# fedora registry (and can be validated via tls)
riscv64: "ghcr.io/mvo5/fedora-buildroot:{{.MajorVersion}}"
64 changes: 0 additions & 64 deletions data/distrodefs/distros.yaml → data/distrodefs/rhel.yaml
Original file line number Diff line number Diff line change
@@ -1,69 +1,5 @@
---
distros:
- &fedora_rawhide
name: fedora-44
distro_like: fedora
preview: true
os_version: 44
release_version: 44
module_platform_id: platform:f44
product: "Fedora"
ostree_ref_tmpl: "fedora/44/%s/iot"
iso_label_tmpl: "{{.Product}}-{{.Distro.MajorVersion}}-{{.ISOLabel}}-{{.Arch}}"
default_fs_type: "ext4"
defs_path: fedora
runner: &fedora_runner
name: org.osbuild.fedora44
build_packages:
- "glibc" # ldconfig
- "systemd" # systemd-tmpfiles and systemd-sysusers
- "python3" # osbuild
oscap_profiles_allowlist:
- "xccdf_org.ssgproject.content_profile_ospp"
- "xccdf_org.ssgproject.content_profile_pci-dss"
- "xccdf_org.ssgproject.content_profile_standard"
bootstrap_containers:
x86_64: "registry.fedoraproject.org/fedora-toolbox:44"
aarch64: "registry.fedoraproject.org/fedora-toolbox:44"
ppc64le: "registry.fedoraproject.org/fedora-toolbox:44"
s390x: "registry.fedoraproject.org/fedora-toolbox:44"
# XXX: remove once fedora containers are part of the upstream
# fedora registry (and can be validated via tls)
riscv64: "ghcr.io/mvo5/fedora-buildroot:44"

# XXX: add repos here too, that requires some churn, see
# https://github.com/osbuild/images/compare/main...mvo5:yaml-distroconfig?expand=1
# and we will also need to think about backward compat, as currently
# dropping "$distro-$ver.json" files into
# /etc/osbuild-composer/repositories will define what distros are
# available via images and we will need to provide compatibility for
# that.
#
# Having the repos separated means when a new fedora release is out
# we will need to update two places which is clearly a regression from
# before.

- &fedora_stable
<<: *fedora_rawhide
name: "fedora-{{.MajorVersion}}"
match: 'fedora-[1-9][0-9]+'
preview: false
os_version: "{{.MajorVersion}}"
release_version: "{{.MajorVersion}}"
module_platform_id: "platform:f{{.MajorVersion}}"
ostree_ref_tmpl: "fedora/{{.MajorVersion}}/%s/iot"
runner:
<<: *fedora_runner
name: "org.osbuild.fedora{{.MajorVersion}}"
bootstrap_containers:
x86_64: "registry.fedoraproject.org/fedora-toolbox:{{.MajorVersion}}"
aarch64: "registry.fedoraproject.org/fedora-toolbox:{{.MajorVersion}}"
ppc64le: "registry.fedoraproject.org/fedora-toolbox:{{.MajorVersion}}"
s390x: "registry.fedoraproject.org/fedora-toolbox:{{.MajorVersion}}"
# XXX: remove once fedora containers are part of the upstream
# fedora registry (and can be validated via tls)
riscv64: "ghcr.io/mvo5/fedora-buildroot:{{.MajorVersion}}"

- &rhel10
name: "rhel-{{.MajorVersion}}.{{.MinorVersion}}"
match: 'rhel-10\.[0-9]{1,2}'
Expand Down
36 changes: 27 additions & 9 deletions pkg/distro/defs/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ func dataFS() fs.FS {
return dataFS
}

// distrosYAML defines all supported YAML based distributions
// distrosYAML defines all supported YAML based distributions, since this can
// come from multiple sources we should make sure that we only have things in
// here that are easily merged
type distrosYAML struct {
Distros []DistroYAML
}
Expand Down Expand Up @@ -158,22 +160,38 @@ func (d *DistroYAML) runTemplates(id distro.ID) error {
return errors.Join(errs...)
}

// Load all YAML files directly in the root of the definitions filesystem. Each
// file is read in sorted order and the entries found under the `distros` key
// are appended together.
// Note that files are read separately from each other, so anchors and other
// references can only be done within the same file.
func loadDistros() (*distrosYAML, error) {
f, err := dataFS().Open("distros.yaml")
dents, err := fs.Glob(dataFS(), "*.yaml")
if err != nil {
return nil, err
}
defer f.Close()

decoder := yaml.NewDecoder(f)
decoder.KnownFields(true)
var allDistros distrosYAML

var distros distrosYAML
if err := decoder.Decode(&distros); err != nil {
return nil, err
for _, name := range dents {
f, err := dataFS().Open(name)
if err != nil {
return nil, err
}
defer f.Close()

decoder := yaml.NewDecoder(f)
decoder.KnownFields(true)

var distros distrosYAML
if err := decoder.Decode(&distros); err != nil {
return nil, err
}

allDistros.Distros = append(allDistros.Distros, distros.Distros...)
}

return &distros, nil
return &allDistros, nil
}

// NewDistroYAML return the given distro or nil if the distro is not
Expand Down
Loading