-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Quadlet: Add support for .build files #22694
Conversation
Ephemeral COPR build failed. @containers/packit-build please check. |
Cockpit tests failed for commit e53db304fc55545a388784e19b218f3dc19bc9e2. @martinpitt, @jelly, @mvollmer please check. |
As the person who started the discussion in #17043 I'd like to say thank you for working on this! |
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.
Thanks for working on this. Great job.
The dependency comment is obviously the tricky one
BTW the build is failing on trailing white spaces in the doc file |
I have fixed this in my latest push. |
Ephemeral COPR build failed. @containers/packit-build please check. |
Cockpit tests failed for commit 9011d457bb9bcb6338fc07cd189a863895fd92b8. @martinpitt, @jelly, @mvollmer please check. |
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.
Just these two small comments
Ephemeral COPR build failed. @containers/packit-build please check. |
I'm not sure if you have more tests you want to add. Please let me know once you're done. In addition, once you're done, please squash all commits into one |
Yes, I am still working on the tests, currently struggling with the ".volume requires .build/.image" tests. I am going to push 2 failing tests shortly, where I do not understand why they fail, as they work correctly when I am running quadlet on these files manually. And yeah, once I am done I am going to squash all commits into one. |
OK, I found the issue with the 2 testcases The two tests succeed when I patch Since My assumption is that this complication with
hasn't been tested before... |
After reading the changelog for Podman 5.1.0-rc1 I also added the Unless you have further remarks or suggestions @ygalblum , I consider the PR ready. Please let me know and then I will squash the commits into one. |
Please fix the man pages so the tests will run. |
The failing RPM builds seem to be due to infra issues unrelated to the changes in this PR IIUC? |
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.
Thanks for all your effort.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jmaibaum, ygalblum The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@ygalblum I have a local WIP commit for supporting URLs, and also for handling more corner cases in terms of relative or absolute file paths to Containerfiles (in both IIUC, this PR would be targeting a release with Podman 5.2.0 earliest, as the 5.1.0-rc period has already started. So, I would like to take more time to polish this. |
028da9c
to
2473219
Compare
@ygalblum Initial support for URLs pushed. I did this in a separate commit on purpose to be able to revisit it again in case you (or another maintainer) don't like it. I will squash again if this is acceptable. Also, I would be really glad if someone could give this a test spin. As noted above, I had not been using the URL features of |
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.
Looks good. Though I haven't tested it.
Maybe you should consider adding a system test as well (in test/system/252-quadlet.bats
)
I have to see if I can get the system tests to run on my machine. I was struggling quite a lot to get the e2e tests running on my machine at least. (For example, I only get them to run in rootful mode. I never managed to get rootless e2e working locally. Might be related that I am using toolbox on Fedora Silverblue, so it's effectively podman in podman. Never did that before so I don't know which screw I might have forgotten to tighten here.) |
I tried to get the system tests working locally, but failed both for The
Yet, AFAICT I have set up UID mapping correctly:
The
So, I'm afraid I can't add system tests, because I cannot meaningfully test them locally. If they are required before this PR can be merged, I will need help fixing any of the above errors. |
.build files allow to build an image via Quadlet. The keys from a .build file are translated to arguments of a `podman build` command by Quadlet. Minimal keys for .build files are `ImageTag=` and a context directory, see `SetWorkingDirectory=`, or a `File=` pointing to a Containerfile. After sorting .build files into the Quadlet dependency order, there remains a possible dependency cycle issue between .volume and .build files: A .volume can have `Image=some.build`, and a .build can have `Volume=some.volume:/some/volume`. We solve this dependency cycle by prefilling resourceNames with all image names from .build files before converting all the unit files. This results in an issue for the test suite though: For .volume's depending on *.image or *.build, we need to copy these additional dependencies to the test's quadletDir, otherwise the test will fail. This is necessary, because `handleImageSource()` actually needs to know the image name defined in the referenced *.{build,image} file. It cannot fall back on the default names, as it is done for networks or volumes, for example. Signed-off-by: Johannes Maibaum <[email protected]>
@jmaibaum I think we can do with the system tests for now. I've restarted the failed tests (which seem unrelated to this change) |
@containers/podman-maintainers PTAL |
/lgtm |
Does this PR introduce a user-facing change?
This adds support for
.build
Quadlet units, as per discussion in #17043 (reply in thread), basically by mapping Key/Value pairs inside a.build
file topodman build
command line arguments.You depend on a container image built by a
.build
file, by addingImage=name.build
to your.container
file, similar to how you can depend on an.image
file.Mandatory keys in a
.build
file under the[Build]
group are so far:Not every single
podman build
command line argument is being handled, yet. There might be more which would be nice to have before merging (please let me know if you think I missed an important one!), but since adding a new Key/Value pair is a rather cumbersome and boring process, I decided to stop after adding the following:KeyXYZ
I found already defined, and which I also found inpodman builds
supported arguments (notable exceptions from this rule are those I did never use before myself, or those where I found more complicated parsing code in the current quadlet code base)KeyFile
(podman build
's--file
, i.e. the Containerfile path), orKeyTarget
I have added e2e tests, and documentation for all currently supported keys/args, closely following what I found for the already existing Quadlet file types.
This is my first contribution to a Go project, so please let me know in case I did not follow best practice or used unidiomatic constructs. I used
go fmt
on all Go files I touched (except forquadlet_test.go
, as I only added single lines here, and wasn't sure ifgo fmt
would alter parts of the file I did not touch), and generally tried to follow naming conventions I found in surrounding code.I have tested this with a few toy projects locally, and there it did it's job. Apart from adding more command line args if deemed necessary, I consider the implementation ready functionality wise.
Happy to hear what the maintainers think about this!