-
Notifications
You must be signed in to change notification settings - Fork 62
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
feat: Improve Containerfile / enable workflow usage of containerized buildah (tag: v1) #604
Conversation
Thank you for this. One thing is that we don't build with a new enough version of podman to take advantage of heredoc. It's extremely sad and unfortunate. It looks like most of the changes are taking advantage of dockers latest syntax and things like caching. |
I absolutely agree.
It does run as expected on recent podman though. May I ask for the reason for such an "old" version of podman? |
The ubuntu builders are 22.04, we're waiting for 24.04 builders to go GA so we can get newer podman versions, which should be sometime soon. |
Sigh ... In that case, i could continue to test this stuff with gitea and ubuntu-latest runners. While familiarising myself with the ublue projects, I got the urge to refactor some parts of the build system/scripts. |
We need newer builders for zstd:chunked compression anyway, so welcome to the queue! We did opt in for a while into 24.04 but we had some builder failures so we rolled back to 22.04, but it's worth investigating again. Open an issue on what you'd like to refactor and slap an enhancement label on it. Then we can have the other maintainers take a look and work towards consensus. Looking forward to seeing what you have in mind! |
Looks like the version in 24.04 is also too old for heredoc support, we should perhaps consider running with the podman OBS repo so we're always on the newest version, I think someone's proposed that before? |
Not really too old - more like: broken. I don't know what they did to that poor thing, but it told me it's version 1.33.7.
Support for here-documents was added in 1.33.0:
|
While it might seem a little hacky, this worked well when i tested it with gitea actions and the 22.04 builder: 5ca8240 |
That's hacky, but we do have to workaround the limitations of the builders. Letting this start to run workflows |
6beaa7b
to
cfd6ee4
Compare
According to the [docs](https://github.com/containers/common/blob/main/docs/Containerfile.5.md#format), `ARG`s argument is the default value.
998b7a7
to
3624553
Compare
not exactly all that up to speed on heredocs but what does a build gain with using heredocs |
3624553
to
2f934b3
Compare
Now it successfully runs on GH. Maybe someone would like to trigger the workflow again? |
Ultimately, it's preference. Heredocs can be written like normal scripts do: multiple lines, But this isn't just about heredocs. |
I noticed that for the mount commands there is a difference between how docker and podman handle these. Docker appears to not like nested mounts. Also docker gets angry with it called context since that's a reserved word. While we use podman for building, keeping compatibility with docker is a plus. Overall I really like what this is doing and especially considering that we are copying in the kernel now, reducing the size of the image by removing those COPY layers is great. |
Interesting. A quick edit: |
docker buildx is v0.16 Wouldn't be surprised if it's some weird ordering |
I think the are neat. And they're widly supported nowadays. Much more readable than sequences of ` && \`.
f24de65
to
ef474ca
Compare
This latest version runs without complaints on recent docker/buildx and podman. I've already put in too many commits which are may be considered unrelated or personal preference, so please comment away. I could split out some of them if desired. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this a lot and gives us a good blueprint for improving containerfiles in the rest of the organization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm requesting a few small changes. My reasons are either to maintain readability of the code or to avoid changes which I don't see as needed.
Happy to discuss.
Thanks!
ef474ca
to
c5e8b54
Compare
One thing I'm also noticing in the build logs is that dracut no longer has access to /dev/kmsg and/or /dev/logger so dracuts output are hidden. The other change that is catching my eye is the change from a for loop to a while loop in github installer script. I know read is preferable when working with arrays, but just trying to understand why the change was made there. The xargs change is more readable now, bracket bash is something shellcheck indicates to use at times, but I think this is more readable. Again, I do think the vast majority of this is an excellent improvement, and just would like some clarification on style changes or rationale for using different techniques. |
f559aae
to
d0e1dbd
Compare
The additional intermediate target `context` is a workaround for directly mounting the context because selinux policies on podman machine denies access to the mounted directoy.
This adds a workflow task which installs a wrapper script for buildah. Buildah in ubuntu-22.04 builders is very dated and the buildah executable in the current beta builder 24.04 misbehaves when using heredocs.
The scripts uses bash style arrays and/or conditionals which *could* be unsupported by `/bin/sh`.
* streamline loading and installation of rpmfusion repo rpms * ro buildcontext is now located at `$BUILDCONTEXT_DIR` * ro rpms live under `$RPMS_DIR`
buildx complained about mismatched casing
d0e1dbd
to
034e548
Compare
These are the first bits of my suggestions to improve the buildprocess via Containerfile.
Before going any further, i'd like to hear some feedback whether these kind of refactorings are welcome or not.