Skip to content

Conversation

@flouthoc
Copy link
Collaborator

@flouthoc flouthoc commented Oct 27, 2025

Add ability to quadlet install to install multiple quadlets from a single file by separating
them with --- delimiters, similar to how multiple quadlets can be
installed from a directory. Each section requires # FileName=<name> comment for custom naming.

Example usage:

  # FileName=web-server
  [Container]
  Image=nginx:latest
  PublishPort=8080:80
  
  ---
  
  # FileName=app-storage
  [Volume]
  Label=app=webapp
$ podman quadlet install webapp.quadlets
/home/user/.config/containers/systemd/web-server.container
/home/user/.config/containers/systemd/app-storage.volume

Does this PR introduce a user-facing change?

quadlet install: add support for multiple quadlets in a single file

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 27, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: flouthoc
Once this PR has been reviewed and has the lgtm label, please assign mheon for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@packit-as-a-service
Copy link

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

@flouthoc flouthoc marked this pull request as draft October 27, 2025 14:11
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 27, 2025
@flouthoc flouthoc force-pushed the multi-file-quadlet branch 2 times, most recently from 6688c20 to 1ea3992 Compare October 27, 2025 15:29
@ygalblum
Copy link
Contributor

The title of the PR and the release notes comment are misleading. This PR does not add this capability to Quadlet, it adds it to quadlet install. It's important to make this distinction so that users that do not use quadlet install and instead manually manage their files, won't expect this capability

@flouthoc flouthoc changed the title quadlet: add support for multiple quadlets in a single file quadlet install: add support for multiple quadlets in a single file Oct 27, 2025
@flouthoc
Copy link
Collaborator Author

The title of the PR and the release notes comment are misleading. This PR does not add this capability to Quadlet, it adds it to quadlet install. It's important to make this distinction so that users that do not use quadlet install and instead manually manage their files, won't expect this capability

I agree this is only applicable for quadlet install, thanks @ygalblum for pointing this out.

@Luap99
Copy link
Member

Luap99 commented Oct 27, 2025

Please add the issue link with Fixes :###

The title of the PR and the release notes comment are misleading. This PR does not add this capability to Quadlet, it adds it to quadlet install. It's important to make this distinction so that users that do not use quadlet install and instead manually manage their files, won't expect this capability

Just to be clear I am still against doing this overall but I guess I was outvoted on that so that doesn't matter.
IMO that is the worst possible outcome of this. Not doing this in quadlet proper will make everything just so much more confusing for end users. It breaks the "declarative" nature of just copying file into the right place as you now force any users who has such a "multi" file to have to run that though podman quadlet install which just seems unnecessary.

@flouthoc flouthoc force-pushed the multi-file-quadlet branch 4 times, most recently from 3ceac95 to 3efc462 Compare October 27, 2025 18:25
// parseMultiQuadletFile parses a file that may contain multiple quadlets separated by "---"
// Returns a slice of quadletSection structs, each representing a separate quadlet
func parseMultiQuadletFile(filePath string) ([]quadletSection, error) {
content, err := os.ReadFile(filePath)
Copy link
Member

Choose a reason for hiding this comment

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

I think you have already read the file in isMultiQuadletFile(toInstall) prior. Would it make sense to load the file into an array or some other data structure in isMultiQuadletFile() to avoid another read here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This function is removed.

@ygalblum
Copy link
Contributor

@Luap99 I completely agree with you. But, I kinda disengaged from the podman quadlet work. So, as you, I assume this was decided somewhere and just want to make sure we keep the distinction.

@Luap99
Copy link
Member

Luap99 commented Oct 28, 2025

@ygalblum there was an internal design doc https://docs.google.com/document/d/1fVjmxVA6k_83iVztQ4j4ISGW7JMVb7yCBfO6vYk9SWs/edit?usp=sharing

If that wasn't shared to you then this is already a big issue as you as main quadlet maintainer should be able to look at these things and give your input. As I noted there design docs shouldn't be internal at all and be public in this repo so all maintainers and community people can actually give feedback https://github.com/containers/podman/tree/main/contrib/design-docs which was also not done here.

So, as you, I assume this was decided somewhere and just want to make sure we keep the distinction.

Well the way I see it decided "somewhere" doesn't count in general, we decide upstream on github what gets merged which includes all maintainers including you of course. So if you think this is a bad idea you can still speak up. I already objected that feature internally and on the issue (#26447) but it seemed like some other maintainers on the team were in favour and others abstained so I didn't push any further against this.

@eriksjolund
Copy link
Contributor

eriksjolund commented Oct 29, 2025

@ygalblum there was an internal design doc https://docs.google.com/document/d/1fVjmxVA6k_83iVztQ4j4ISGW7JMVb7yCBfO6vYk9SWs/edit?usp=sharing

I clicked the link and landed on a web page saying:

You need access
Request access, or switch to an account with access. Learn more

(*) Viewer

( ) Commenter

( ) Editor

There is also a text input field

Message (optional)

Is the document only for internal use?

There is button to click for Request access. I could click the button but I wanted to ask before I do that.

Copy link
Member

@Honny1 Honny1 left a comment

Choose a reason for hiding this comment

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

My only thought is that we could improve performance by reading the input file only once instead of multiple times.

@Luap99
Copy link
Member

Luap99 commented Oct 29, 2025

Is the document only for internal use?

There is no reason why this should be private IMO. I don't own the doc so I cannot share it. As I said for feedback and public knowledge this should have been posted here on github into the design-doc directory instead of being a private doc.

There have been a ton of design docs internally over the years. I am trying to push all to do these discussions in public here on github for transparency and to allow for feedback outside our team early on in the design phase.

@ygalblum
Copy link
Contributor

I don't have access to this doc either. I remember the discussion we had on Quadlet's support for single file and I agree that Quadlet should not support it.

Generally speaking about podman quadlet, my personal opinion is that I don't see its benefit in Linux systems where users can simply copy the files and use systemctl to manage the services. I can see it in MacOS or Windows where the details of where podman actually runs are hidden from the user and copying the files manually is not obvious.

To me, the podman quadlet command is more of a copy tool than actually Quadlet and that's how I try to differentiate between them. I don't mind having a tool that knows to read a single file and break it into many. But, it should have a distinct extension (one not supported by Quadlet), schema and proper documentation.

@eriksjolund
Copy link
Contributor

There is no reason why this should be private IMO. I don't own the doc so I cannot share it. As I said for feedback and public knowledge this should have been posted here on github into the design-doc directory instead of being a private doc.

There have been a ton of design docs internally over the years. I am trying to push all to do these discussions in public here on github for transparency and to allow for feedback outside our team early on in the design phase.

That is a good idea.

@flouthoc
Copy link
Collaborator Author

I don't have access to this doc either. I remember the discussion we had on Quadlet's support for single file and I agree that Quadlet should not support it.

Generally speaking about podman quadlet, my personal opinion is that I don't see its benefit in Linux systems where users can simply copy the files and use systemctl to manage the services. I can see it in MacOS or Windows where the details of where podman actually runs are hidden from the user and copying the files manually is not obvious.

To me, the podman quadlet command is more of a copy tool than actually Quadlet and that's how I try to differentiate between them. I don't mind having a tool that knows to read a single file and break it into many. But, it should have a distinct extension (one not supported by Quadlet), schema and proper documentation.

@ygalblum You should have access to design doc now.

But, it should have a distinct extension (one not supported by Quadlet), schema and proper documentation

I agree, I think we can limit this to one particular extension maybe like .quadlets. If everyone agrees I can make this change. WDYT ?

@flouthoc flouthoc marked this pull request as ready for review November 3, 2025 20:28
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 3, 2025
@flouthoc flouthoc force-pushed the multi-file-quadlet branch 4 times, most recently from e394f15 to 03e35a0 Compare November 6, 2025 16:56
@flouthoc
Copy link
Collaborator Author

flouthoc commented Nov 7, 2025

@ygalblum @Luap99 This is ready for review.

Comment on lines 224 to 231
isQuadletsFile := ext == ".quadlets"

// Only check for multi-quadlet content if it's a .quadlets file
var isMulti bool
if isQuadletsFile {
// For .quadlets files, always treat as multi-quadlet (even single quadlets)
isMulti = true
}
Copy link
Member

Choose a reason for hiding this comment

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

I think isMulti always has the same value as isQuadletsFile.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

Enable installing multiple quadlets from one file using '---' delimiters.
Each section requires '# FileName=<name>' comment for custom naming.
Single quadlet files remain unchanged for backward compatibility.

Assited by: claude-4-sonnet

Signed-off-by: flouthoc <[email protected]>
Quadlets installed from `.quadlet` file now belongs to a single
application, anyone file removed from this application removes all the
other files as well.

Assited by: claude-4-sonnet

Signed-off-by: flouthoc <[email protected]>
@flouthoc flouthoc requested a review from Honny1 November 10, 2025 16:27
@flouthoc
Copy link
Collaborator Author

@Honny1 PTAL

Copy link
Member

@Honny1 Honny1 left a comment

Choose a reason for hiding this comment

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

LGTM

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.

6 participants