Skip to content

lints: Add --fix, support with tmpfiles #1152

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

Closed
wants to merge 2 commits into from

Conversation

cgwalters
Copy link
Collaborator

This needs some docs and some container tests but yeah

$ cat Dockerfile
FROM localhost/bootc
RUN <<EORUN
set -xeuo pipefail
mkdir -p /var/lib/some-test-dir
bootc container lint --fix
EORUN
$ podman build ...
+ bootc container lint --fix
tmpfiles.d: Generated: usr/lib/tmpfiles.d/bootc-autogenerated-var-0.conf with entries: 1
Checks passed: 11
Checks skipped: 1

But the big thing I realized here that makes things WAY messier is that actually we need to support retaining some of the /var subdirs...like /var/tmp and /var/lib/rpm-state as one wants them in the container too. Tentatively thinking something like

cat /usr/lib/bootc/tmpfiles.d/foo.conf
# Temporary directories we ensure are always present in the container too
/var/tmp

So what'd be cool about this is that at the end of a build one could switch from

rm -rf /var/tmp/* /var/lib/{dnf,rhsm} /var/cache/*

to

rm /var/*
bootc container lint --fix

And that'd automatically regenerate everything in /var needed.

But, mmm, it may drive us really to have something like bootc container commit that is defined to do both of those things?

It's clearer if `increment` mutates self.

Signed-off-by: Colin Walters <walters@verbum.org>
Signed-off-by: Colin Walters <walters@verbum.org>
@jlebon
Copy link
Contributor

jlebon commented Apr 4, 2025

Definitely interested in this to clean up some of the stuff in https://github.com/openshift/os/blob/48a18918794f5418352c03a3415fac3fde28e1b6/packages-openshift.yaml#L143-L165.

rm /var/*
bootc container lint --fix

Hmm, not sure I follow. Wouldn't that delete the actual /var that you do want to translate to tmpfiles.d entries before you get to translate them? I guess it'd have to be something like

...
bootc container lint --generate-tmpfiles
rm -rf /var/*
bootc container lint --fix

?

Which yeah, at that point a bootc container commit would be much cleaner.

@cgwalters
Copy link
Collaborator Author

OK moved the minor commit to #1257 and closing this since it's clear it needs to be a separate verb.

@cgwalters cgwalters closed this Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants