coreos / coreos-assembler

Tooling container to assemble CoreOS-like systems
https://coreos.github.io/coreos-assembler/
Apache License 2.0
333 stars 165 forks source link

Misc: add a small tool to graph manifest includes #3771

Closed jbtrystram closed 3 months ago

jbtrystram commented 4 months ago

Follow-up of https://github.com/coreos/fedora-coreos-config/pull/2940

Now that I think of it, i could add pip install anytree in the dockerfile so anyone could do

podman run -v .:/mnt/:z --rm quay.io/coreos-assembler/coreos-assembler /srv/src/manifest_graph /mnt/manifest.yaml

opinions ?

jbtrystram commented 3 months ago

I added support for conditional-include and arch-include :

manifest.yaml
└── manifests/fedora-coreos.yaml
    ├── (x86_64) manifests/include-dnf.yaml
    ├── (aarch64) manifests/grub2-removals.yaml
    │   └── manifests/kernel.yaml
    ├── (prod == false) manifests/disable-zincati.yaml
    ├── (basearch != "s390x") manifests/grub2-removals.yaml
    │   └── manifests/kernel.yaml
    ├── (releasever == 39) manifests/passwd.yaml
    ├── (releasever == 39) manifests/cni-plugins.yaml
    ├── (releasever == 39) manifests/podman-v5.yaml
    ├── (releasever >= 41) manifests/makedumpfile.yaml
    ├── (releasever < 41) manifests/exclude-dnf.yaml
    ├── (releasever >= 41) manifests/include-dnf.yaml
    └── manifests/fedora-coreos-base.yaml
        ├── manifests/kernel.yaml
        ├── manifests/system-configuration.yaml
        ├── manifests/ignition-and-ostree.yaml
        │   └── manifests/bootable-rpm-ostree.yaml
        ├── manifests/file-transfer.yaml
        ├── manifests/networking-tools.yaml
        ├── manifests/user-experience.yaml
        ├── manifests/shared-workarounds.yaml
        └── manifests/bootupd.yaml

Note that I had to make dumb changes to the manifest to showcase the features :)

dustymabe commented 3 months ago

I honestly think we should just change our code so that cosa build ostree will call this before it does the rpm-ostree compose so it will be in our logs.

jbtrystram commented 3 months ago

I honestly think we should just change our code so that cosa build ostree will call this before it does the rpm-ostree compose so it will be in our logs.

That would be cool, but to be nice it would need to resolve the conditionals IMO

dustymabe commented 3 months ago

That would be cool, but to be nice it would need to resolve the conditionals IMO

right. that would be more useful

dustymabe commented 3 months ago

another option is to just PR this (obviously not in python) to the rpm-ostree code base and have it print this output - but that's work and i'm not sure if it's worth it

jlebon commented 3 months ago

I don't think it'd be too hard to enhance rpm-ostree to print the manifest files as it traverses them.

That said, printing the full tree with conditionals as done here definitely provides value too. Let's just get this in? Can you fix the flake8 nits?