Skip to content
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

Add new treefile-apply experimental command #5274

Merged
merged 1 commit into from
Feb 7, 2025

Conversation

jlebon
Copy link
Member

@jlebon jlebon commented Feb 3, 2025

We are working towards rebasing FCOS and RHCOS on top of fedora-bootc
and rhel-bootc. As one can imagine, we are quite heavily invested in
treefiles currently, so being able to keep using what we already have as
we transition into becoming a layered build is valuable.

Dockerfiles are great of course as the common language used to build
container images. But it's not great for implementing complex logic.

Add a new rpm-ostree experimental compose treefile-apply command
which takes a treefile, but applies its directives live in the running
environment.

So in this model, the business logic in the Dockerfile is kept to a
minimum and all the heavy lifting happens via
RUN rpm-ostree compose treefile-apply manifest.yaml.

A very small subset of the treefile spec is actually supported. The goal
is not to reimplement everything, but only what is needed and useful
in a derivation context.

This code actually started as a Python script in openshift/os, currently
used to build the OCP node image:

https://github.com/openshift/os/blob/master/scripts/apply-manifest

So in fact, the node image (which in turn is a layered build on top of
RHCOS) will also be using this code.

Copy link

openshift-ci bot commented Feb 3, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

jlebon added a commit to jlebon/fedora-coreos-config that referenced this pull request Feb 3, 2025
This uses coreos/rpm-ostree#5274 to build FCOS
as a derivation of fedora-bootc.
rust/src/treefile.rs Outdated Show resolved Hide resolved
rust/src/treefile.rs Outdated Show resolved Hide resolved
rust/src/treefile.rs Outdated Show resolved Hide resolved
rust/src/treefile.rs Show resolved Hide resolved
@cgwalters
Copy link
Member

I think we could use a test case for this, should be pretty easy right? test-container.sh could work, or just a new Dockerfile, etc.

Anything else keeping this in draft?

jlebon added a commit to jlebon/fedora-coreos-config that referenced this pull request Feb 7, 2025
This uses coreos/rpm-ostree#5274 to build FCOS
as a derivation of fedora-bootc.
@jlebon jlebon force-pushed the pr/treefile-apply branch from 26f9175 to b0edb06 Compare February 7, 2025 18:26
@jlebon jlebon force-pushed the pr/treefile-apply branch from b0edb06 to 1669f13 Compare February 7, 2025 18:29
@jlebon jlebon marked this pull request as ready for review February 7, 2025 18:29
@jlebon
Copy link
Member Author

jlebon commented Feb 7, 2025

Added test, rebased and moved out of draft! There's definitely more to add here, but it's enough for some success.

We are working towards rebasing FCOS and RHCOS on top of fedora-bootc
and rhel-bootc. As one can imagine, we are quite heavily invested in
treefiles currently, so being able to keep using what we already have as
we transition into becoming a layered build is valuable.

Dockerfiles are great of course as the common language used to build
container images. But it's not great for implementing complex logic.

Add a new `rpm-ostree experimental compose treefile-apply` command
which takes a treefile, but applies its directives _live_ in the running
environment.

So in this model, the business logic in the Dockerfile is kept to a
minimum and all the heavy lifting happens via
`RUN rpm-ostree compose treefile-apply manifest.yaml`.

A very small subset of the treefile spec is actually supported. The goal
is _not_ to reimplement everything, but only what is needed and useful
in a derivation context.

For now, only `packages`, `recommends`, and `postprocess` are supported.
More will be added in the future.

This code actually started as a Python script in openshift/os, currently
used to build the OCP node image:

https://github.com/openshift/os/blob/master/scripts/apply-manifest

So in fact, the node image (which in turn is a layered build on top of
RHCOS) will also be using this code.
@jlebon jlebon force-pushed the pr/treefile-apply branch from 1669f13 to 057ccd9 Compare February 7, 2025 18:30
Copy link
Member

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

LGTM!

@cgwalters cgwalters enabled auto-merge February 7, 2025 18:41
@cgwalters cgwalters merged commit c05e584 into coreos:main Feb 7, 2025
16 of 18 checks passed
@cgwalters
Copy link
Member

Looks like CI failed actually with

 + rpm-ostree experimental compose treefile-apply /tmp/treefile.yaml
error: No such file or directory (os error 2)
error: locking base packages with dnf: Failed to run dnf versionlock: ExitStatus(unix_wait_status(256))

@jlebon
Copy link
Member Author

jlebon commented Feb 8, 2025

CI fix in #5286. I guess let's make it required after that merges?

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.

3 participants