Skip to content

ci/check: Fix broken regexp and spec version replacement#810

Merged
dustymabe merged 8 commits into
coreos:mainfrom
travier:main-ci-fix
Jun 5, 2026
Merged

ci/check: Fix broken regexp and spec version replacement#810
dustymabe merged 8 commits into
coreos:mainfrom
travier:main-ci-fix

Conversation

@travier

@travier travier commented Jun 5, 2026

Copy link
Copy Markdown
Member

ci/check: Replace spec version attribute in config snippets

In [1], I replaced all hardcoded FCOS Butane spec versions by an
AsciiDoc document attribute that is dynamically replaced when generating
the docs.

This attribute is however not replaced when we run the script to check
the configurations snippets in the documentation as we process the
source documentation files. Thus we need to manually do the
substitution.

[1] #612

Fixes: #612


ci/check: Fix regexp used to extract Butane config snippets

In [1], I replaced all hardcoded FCOS Butane spec versions by an
AsciiDoc document attribute that is dynamically replaced when generating
the docs. Attributes are not replaced by default in source snippets in
AsciiDoc so I had to set the subs="attributes" option on those
snippets.

The script that checks Butane config snippets in the docs relies on a
regexp to find the config snippets and extract them for validation. With
the change in [1], the regexp did not match anymore and no configuration
was thus checked anymore.

Thus update the regexp to match the added attribute to Butane config
source snippets.

[1] #612


ci/check: Fail if less than expected number of configs have been tested

In [1], I realized that CI was silently broken since [2] as we
dynamically generate our test cases from config snippets in the docs
using a regular expression match that did not match anymore with the
changes in [2].

Thus count the number of configs checked by this script and fail if it's
under an arbitrary number, which the current number of config that we
test. We don't strictly need to increase this number as we add tests and
we can decrease it if we ever reduce the number of tests cases.

[1] #809
[2] #612

Fixes: #612


ci/check: Run Butane container with SELinux isolation

Match how we recommend running Butane from a container in the documentation:
https://coreos.github.io/butane/getting-started/#getting-butane

Fixes the following errors:

Invalid Butane config at ./modules/ROOT/pages/authentication.adoc:55:
  error at $.passwd.users.0.ssh_authorized_keys_local.0, line 7 col 11: open /files-dir/users/core/id_rsa.pub: permission denied
  error at $.passwd.users.1.ssh_authorized_keys_local.0, line 10 col 11: open /files-dir/users/jlebon/id_rsa.pub: permission denied
  error at $.passwd.users.1.ssh_authorized_keys_local.1, line 11 col 11: open /files-dir/users/jlebon/id_ed25519.pub: permission denied
  error at $.passwd.users.2.ssh_authorized_keys_local.0, line 14 col 11: open /files-dir/users/miabbott/id_rsa.pub: permission denied
  Error translating config: source config is invalid

Invalid Butane config at ./modules/ROOT/pages/tutorial-containers.adoc:22:
  error at $.passwd.users.0.ssh_authorized_keys_local.0, line 7 col 11: open /files-dir/ssh-key.pub: permission denied
  Error translating config: source config is invalid

Invalid Butane config at ./modules/ROOT/pages/tutorial-services.adoc:59:
  error at $.storage.files.2.contents.local, line 33 col 16: open /files-dir/public-ipv4.sh: permission denied
  error at $.systemd.units.1.contents_local, line 16 col 23: open /files-dir/issuegen-public-ipv4.service: permission denied
  Error translating config: source config is invalid

Invalid Butane config at ./modules/ROOT/pages/tutorial-updates.adoc:53:
  error at $.passwd.users.0.ssh_authorized_keys_local.0, line 7 col 11: open /files-dir/ssh-key.pub: permission denied
  Error translating config: source config is invalid

Invalid Butane config at ./modules/ROOT/pages/tutorial-user-systemd-unit-on-boot.adoc:121:
  error at $.passwd.users.0.ssh_authorized_keys_local.0, line 7 col 11: open /files-dir/ssh-key.pub: permission denied
  Error translating config: source config is invalid

ci/check: Fix minor Python lints

  • Ignore missing docstrings
  • Open files as UTF-8
  • Split some long lines
  • Make it explicit that we don't need the subprocess function to check
    the return code as we will do it ourselves right after

wireguard: Drop some attributes substitution

Those configuration snippets are not full Butane configs and they do not
include any AsciiDoc attribute to replace, thus this option is not
needed and we don't need to validate them.


storage: add boot_device.layout to mirror examples

Starting with Butane spec 1.7.0, boot_device.layout is required when
boot_device.mirror is specified (previously it was only a warning).
Since the examples use {butane-latest-stable-spec} which resolves to
1.7.0, they now fail with:

error at $.boot_device.mirror: boot_device.layout should be
specified when boot_device.mirror is specified

Add layout: x86_64 to both examples that use boot_device.mirror, with
a comment noting users should change this to match their target
architecture.

Fixes: #808

Assisted-by: <anthropic/claude-opus-4.6>


storage: Fix /var partition re-use example

Fixes:

Invalid Butane config at ./modules/ROOT/pages/storage.adoc:92:
  warning at $.storage.disks.0.partitions.0.number, line 8 col 7: partitions cannot be reused by label; number must be specified except on boot disk (/dev/disk/by-id/coreos-boot-disk) or when wipe_table is true
  Config produced warnings and --strict was specified

See: coreos/butane#711 (comment)

@travier

travier commented Jun 5, 2026

Copy link
Copy Markdown
Member Author
Invalid Butane config at ./modules/ROOT/pages/authentication.adoc:55:
  error at $.passwd.users.0.ssh_authorized_keys_local.0, line 7 col 11: open /files-dir/users/core/id_rsa.pub: permission denied
  error at $.passwd.users.1.ssh_authorized_keys_local.0, line 10 col 11: open /files-dir/users/jlebon/id_rsa.pub: permission denied
  error at $.passwd.users.1.ssh_authorized_keys_local.1, line 11 col 11: open /files-dir/users/jlebon/id_ed25519.pub: permission denied
  error at $.passwd.users.2.ssh_authorized_keys_local.0, line 14 col 11: open /files-dir/users/miabbott/id_rsa.pub: permission denied
  Error translating config: source config is invalid
Invalid Butane config at ./modules/ROOT/pages/storage.adoc:92:
  warning at $.storage.disks.0.partitions.0.number, line 8 col 7: partitions cannot be reused by label; number must be specified except on boot disk (/dev/disk/by-id/coreos-boot-disk) or when wipe_table is true
  Config produced warnings and --strict was specified
Invalid Butane config at ./modules/ROOT/pages/storage.adoc:191:
  error at $.boot_device.mirror, line 5 col 5: boot_device.layout should be specified when boot_device.mirror is specified
  Error translating config: source config is invalid
Invalid Butane config at ./modules/ROOT/pages/storage.adoc:506:
  warning at $.storage.disks.0.partitions.0.number, line 16 col 11: partitions cannot be reused by label; number must be specified except on boot disk (/dev/disk/by-id/coreos-boot-disk) or when wipe_table is true
  warning at $.storage.disks.0.partitions.1.number, line 19 col 11: partitions cannot be reused by label; number must be specified except on boot disk (/dev/disk/by-id/coreos-boot-disk) or when wipe_table is true
  warning at $.storage.disks.1.partitions.0.number, line 23 col 11: partitions cannot be reused by label; number must be specified except on boot disk (/dev/disk/by-id/coreos-boot-disk) or when wipe_table is true
  warning at $.storage.disks.1.partitions.1.number, line 25 col 11: partitions cannot be reused by label; number must be specified except on boot disk (/dev/disk/by-id/coreos-boot-disk) or when wipe_table is true
  error at $.boot_device.mirror, line 7 col 5: boot_device.layout should be specified when boot_device.mirror is specified
  Error translating config: source config is invalid
Invalid Butane config at ./modules/ROOT/pages/tutorial-containers.adoc:22:
  error at $.passwd.users.0.ssh_authorized_keys_local.0, line 7 col 11: open /files-dir/ssh-key.pub: permission denied
  Error translating config: source config is invalid
Invalid Butane config at ./modules/ROOT/pages/tutorial-services.adoc:59:
  error at $.storage.files.2.contents.local, line 33 col 16: open /files-dir/public-ipv4.sh: permission denied
  error at $.systemd.units.1.contents_local, line 16 col 23: open /files-dir/issuegen-public-ipv4.service: permission denied
  Error translating config: source config is invalid
Invalid Butane config at ./modules/ROOT/pages/tutorial-updates.adoc:53:
  error at $.passwd.users.0.ssh_authorized_keys_local.0, line 7 col 11: open /files-dir/ssh-key.pub: permission denied
  Error translating config: source config is invalid
Invalid Butane config at ./modules/ROOT/pages/tutorial-user-systemd-unit-on-boot.adoc:121:
  error at $.passwd.users.0.ssh_authorized_keys_local.0, line 7 col 11: open /files-dir/ssh-key.pub: permission denied
  Error translating config: source config is invalid

@travier

travier commented Jun 5, 2026

Copy link
Copy Markdown
Member Author
Invalid Butane config at ./modules/ROOT/pages/storage.adoc:191:
  error at $.boot_device.mirror, line 5 col 5: boot_device.layout should be specified when boot_device.mirror is specified
  Error translating config: source config is invalid
Invalid Butane config at ./modules/ROOT/pages/storage.adoc:506:
  error at $.boot_device.mirror, line 7 col 5: boot_device.layout should be specified when boot_device.mirror is specified
  Error translating config: source config is invalid

Taking fix from #809

@travier

travier commented Jun 5, 2026

Copy link
Copy Markdown
Member Author
Invalid Butane config at ./modules/ROOT/pages/storage.adoc:92:
  warning at $.storage.disks.0.partitions.0.number, line 8 col 7: partitions cannot be reused by label; number must be specified except on boot disk (/dev/disk/by-id/coreos-boot-disk) or when wipe_table is true
  Config produced warnings and --strict was specified
Invalid Butane config at ./modules/ROOT/pages/storage.adoc:506:
  warning at $.storage.disks.0.partitions.0.number, line 16 col 11: partitions cannot be reused by label; number must be specified except on boot disk (/dev/disk/by-id/coreos-boot-disk) or when wipe_table is true
  warning at $.storage.disks.0.partitions.1.number, line 19 col 11: partitions cannot be reused by label; number must be specified except on boot disk (/dev/disk/by-id/coreos-boot-disk) or when wipe_table is true
  warning at $.storage.disks.1.partitions.0.number, line 23 col 11: partitions cannot be reused by label; number must be specified except on boot disk (/dev/disk/by-id/coreos-boot-disk) or when wipe_table is true
  warning at $.storage.disks.1.partitions.1.number, line 25 col 11: partitions cannot be reused by label; number must be specified except on boot disk (/dev/disk/by-id/coreos-boot-disk) or when wipe_table is true
  error at $.boot_device.mirror, line 7 col 5: boot_device.layout should be specified when boot_device.mirror is specified
  Error translating config: source config is invalid

With another fix, those are the only remaining ones.

Second one is fixed by coreos/butane#711.

@travier

travier commented Jun 5, 2026

Copy link
Copy Markdown
Member Author

The single remaining failure is the one fixed in coreos/butane#711 so I think this is good to go.

@travier travier requested a review from dustymabe June 5, 2026 13:45

@dustymabe dustymabe left a comment

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.

This LGTM.

I have some suggestions about adding context to commit messages, which would be useful to understanding.

Comment thread ci/check.py
Comment thread ci/check.py
Comment thread ci/check.py
Comment thread modules/ROOT/pages/storage.adoc
travier and others added 8 commits June 5, 2026 19:57
In [1], I replaced all hardcoded FCOS Butane spec versions by an
AsciiDoc document attribute that is dynamically replaced when generating
the docs.

This attribute is however not replaced when we run the script to check
the configurations snippets in the documentation as we process the
source documentation files. Thus we need to manually do the
substitution.

[1] coreos#612

Fixes: coreos#612
In [1], I replaced all hardcoded FCOS Butane spec versions by an
AsciiDoc document attribute that is dynamically replaced when generating
the docs. Attributes are not replaced by default in source snippets in
AsciiDoc so I had to set the `subs="attributes"` option on those
snippets.

The script that checks Butane config snippets in the docs relies on a
regexp to find the config snippets and extract them for validation. With
the change in [1], the regexp did not match anymore and no configuration
was thus checked anymore.

Thus update the regexp to match the added attribute to Butane config
source snippets.

[1] coreos#612
In [1], I realized that CI was silently broken since [2] as we
dynamically generate our test cases from config snippets in the docs
using a regular expression match that did not match anymore with the
changes in [2].

Thus count the number of configs checked by this script and fail if it's
under an arbitrary number, which the current number of config that we
test. We don't strictly need to increase this number as we add tests and
we can decrease it if we ever reduce the number of tests cases.

[1] coreos#809
[2] coreos#612

Fixes: coreos#612
Match how we recommend running Butane from a container in the documentation:
https://coreos.github.io/butane/getting-started/#getting-butane

Fixes the following errors:

```
Invalid Butane config at ./modules/ROOT/pages/authentication.adoc:55:
  error at $.passwd.users.0.ssh_authorized_keys_local.0, line 7 col 11: open /files-dir/users/core/id_rsa.pub: permission denied
  error at $.passwd.users.1.ssh_authorized_keys_local.0, line 10 col 11: open /files-dir/users/jlebon/id_rsa.pub: permission denied
  error at $.passwd.users.1.ssh_authorized_keys_local.1, line 11 col 11: open /files-dir/users/jlebon/id_ed25519.pub: permission denied
  error at $.passwd.users.2.ssh_authorized_keys_local.0, line 14 col 11: open /files-dir/users/miabbott/id_rsa.pub: permission denied
  Error translating config: source config is invalid

Invalid Butane config at ./modules/ROOT/pages/tutorial-containers.adoc:22:
  error at $.passwd.users.0.ssh_authorized_keys_local.0, line 7 col 11: open /files-dir/ssh-key.pub: permission denied
  Error translating config: source config is invalid

Invalid Butane config at ./modules/ROOT/pages/tutorial-services.adoc:59:
  error at $.storage.files.2.contents.local, line 33 col 16: open /files-dir/public-ipv4.sh: permission denied
  error at $.systemd.units.1.contents_local, line 16 col 23: open /files-dir/issuegen-public-ipv4.service: permission denied
  Error translating config: source config is invalid

Invalid Butane config at ./modules/ROOT/pages/tutorial-updates.adoc:53:
  error at $.passwd.users.0.ssh_authorized_keys_local.0, line 7 col 11: open /files-dir/ssh-key.pub: permission denied
  Error translating config: source config is invalid

Invalid Butane config at ./modules/ROOT/pages/tutorial-user-systemd-unit-on-boot.adoc:121:
  error at $.passwd.users.0.ssh_authorized_keys_local.0, line 7 col 11: open /files-dir/ssh-key.pub: permission denied
  Error translating config: source config is invalid
```
- Ignore missing docstrings
- Open files as UTF-8
- Split some long lines
- Make it explicit that we don't need the subprocess function to check
  the return code as we will do it ourselves right after
Those configuration snippets are not full Butane configs and they do not
include any AsciiDoc attribute to replace, thus this option is not
needed and we don't need to validate them.
Starting with Butane spec 1.7.0, boot_device.layout is required when
boot_device.mirror is specified (previously it was only a warning).
Since the examples use {butane-latest-stable-spec} which resolves to
1.7.0, they now fail with:

  error at $.boot_device.mirror: boot_device.layout should be
  specified when boot_device.mirror is specified

Add layout: x86_64 to both examples that use boot_device.mirror, with
a comment noting users should change this to match their target
architecture.

Fixes: coreos#808

Assisted-by: <anthropic/claude-opus-4.6>
Fixes:

```
Invalid Butane config at ./modules/ROOT/pages/storage.adoc:92:
  warning at $.storage.disks.0.partitions.0.number, line 8 col 7: partitions cannot be reused by label; number must be specified except on boot disk (/dev/disk/by-id/coreos-boot-disk) or when wipe_table is true
  Config produced warnings and --strict was specified
```

See: coreos/butane#711 (comment)
@travier

travier commented Jun 5, 2026

Copy link
Copy Markdown
Member Author

Thanks, updated.

@travier

travier commented Jun 5, 2026

Copy link
Copy Markdown
Member Author

We will need a Butane release to fix the last warning so I think we should merge this one over red CI to not regress more until we do a release for Butane.

@dustymabe dustymabe merged commit e01ef4a into coreos:main Jun 5, 2026
1 check failed
@travier travier deleted the main-ci-fix branch June 8, 2026 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[main] Doc issue in file modules/ROOT/pages/storage.adoc

2 participants