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

Quadlet - prefer "param val" over "param=val" to allow env expansion #24128

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
359 changes: 122 additions & 237 deletions pkg/systemd/quadlet/quadlet.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/e2e/quadlet/annotation.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## assert-podman-args "--annotation" "org.foo.Arg1=arg1"
## assert-podman-args "--annotation" "org.foo.Arg2=arg 2"
## assert-podman-args "--annotation" "org.foo.Arg3=arg3"
## assert-podman-args --tag=localhost/imagename
## assert-podman-args "--tag" "localhost/imagename"

[Build]
ImageTag=localhost/imagename
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/quadlet/arch-os.image
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## assert-podman-final-args localhost/imagename
## assert-podman-args --os=windows
## assert-podman-args --arch=arm64
## assert-podman-args "--os" "windows"
## assert-podman-args "--arch" "arm64"

[Image]
Image=localhost/imagename
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/quadlet/arch.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## assert-podman-final-args-regex /.*/podman-e2e-.*/subtest-.*/quadlet
## assert-podman-args --tag=localhost/imagename
## assert-podman-args --arch=aarch64
## assert-podman-args "--tag" "localhost/imagename"
## assert-podman-args "--arch" "aarch64"

[Build]
ImageTag=localhost/imagename
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/quadlet/arch.image
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## assert-podman-final-args localhost/imagename
## assert-podman-args --arch=aarch64
## assert-podman-args "--arch" "aarch64"

[Image]
Image=localhost/imagename
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/quadlet/auth.image
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## assert-podman-final-args localhost/imagename
## assert-podman-args --authfile=/etc/certs/auth.json
## assert-podman-args "--authfile" "/etc/certs/auth.json"

[Image]
Image=localhost/imagename
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/quadlet/authfile.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## assert-podman-final-args-regex /.*/podman-e2e-.*/subtest-.*/quadlet
## assert-podman-args --tag=localhost/imagename
## assert-podman-args --authfile=/etc/certs/auth.json
## assert-podman-args "--tag" "localhost/imagename"
## assert-podman-args "--authfile" "/etc/certs/auth.json"

[Build]
ImageTag=localhost/imagename
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/quadlet/basepodman.container
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## assert-podman-final-args run --name=systemd-%N --cidfile=%t/%N.cid --replace --rm --cgroups=split --sdnotify=conmon -d localhost/imagename
## assert-podman-final-args run --name systemd-%N --cidfile=%t/%N.cid --replace --rm --cgroups=split --sdnotify=conmon -d localhost/imagename

[Container]
Image=localhost/imagename
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/quadlet/basic.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## assert-podman-final-args-regex /.*/podman-e2e-.*/subtest-.*/quadlet
## assert-podman-args --tag=localhost/imagename
## assert-podman-args "--tag" "localhost/imagename"
## assert-key-is "Unit" "After" "network-online.target"
## assert-key-is "Unit" "Wants" "network-online.target"
## assert-key-is "Unit" "RequiresMountsFor" "%t/containers"
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/quadlet/basic.container
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## assert-podman-final-args localhost/imagename
## assert-podman-args "--name=systemd-%N"
## assert-podman-args "--name" "systemd-%N"
## assert-podman-args "--cidfile=%t/%N.cid"
## assert-podman-args "--rm"
## assert-podman-args "--replace"
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/quadlet/basic.pod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## assert-key-is Unit RequiresMountsFor "%t/containers"
## assert-key-is Service Type forking
## assert-key-is Service SyslogIdentifier "%N"
## assert-key-is-regex Service ExecStartPre ".*/podman pod create --infra-conmon-pidfile=%t/%N.pid --pod-id-file=%t/%N.pod-id --exit-policy=stop --replace --infra-name=systemd-basic-infra --name=systemd-basic"
## assert-key-is-regex Service ExecStartPre ".*/podman pod create --infra-conmon-pidfile=%t/%N.pid --pod-id-file=%t/%N.pod-id --exit-policy=stop --replace --infra-name systemd-basic-infra --name systemd-basic"
## assert-key-is-regex Service ExecStart ".*/podman pod start --pod-id-file=%t/%N.pod-id"
## assert-key-is-regex Service ExecStop ".*/podman pod stop --pod-id-file=%t/%N.pod-id --ignore --time=10"
## assert-key-is-regex Service ExecStopPost ".*/podman pod rm --pod-id-file=%t/%N.pod-id --ignore --force"
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/quadlet/build.quadlet.servicename.volume
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## assert-podman-args --driver=image
## assert-podman-args --driver image
## assert-podman-args --opt image=localhost/imagename
## assert-key-is "Unit" "Requires" "basic.service"
## assert-key-is "Unit" "After" "basic.service"
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/quadlet/build.quadlet.volume
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## assert-podman-args --driver=image
## assert-podman-args --driver image
## assert-podman-args --opt image=localhost/imagename
## assert-key-is "Unit" "Requires" "basic-build.service"
## assert-key-is "Unit" "After" "basic-build.service"
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/quadlet/capabilities.container
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## !assert-podman-args "--cap-drop=all"
## assert-podman-args "--cap-add=cap_dac_override"
## assert-podman-args "--cap-add=cap_audit_write"
## assert-podman-args "--cap-add=cap_ipc_owner"
## !assert-podman-args "--cap-drop" "all"
## assert-podman-args "--cap-add" "cap_dac_override"
## assert-podman-args "--cap-add" "cap_audit_write"
## assert-podman-args "--cap-add" "cap_ipc_owner"

[Container]
Image=localhost/imagename
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/quadlet/capabilities2.container
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## !assert-podman-args "--cap-drop=all"
## assert-podman-args "--cap-drop=cap_dac_override"
## assert-podman-args "--cap-drop=cap_audit_write"
## assert-podman-args "--cap-drop=cap_ipc_owner"
## !assert-podman-args "--cap-drop" "all"
## assert-podman-args "--cap-drop" "cap_dac_override"
## assert-podman-args "--cap-drop" "cap_audit_write"
## assert-podman-args "--cap-drop" "cap_ipc_owner"

[Container]
Image=localhost/imagename
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/quadlet/certs.image
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## assert-podman-final-args localhost/imagename
## assert-podman-args --cert-dir=/etc/certs/auth.json
## assert-podman-args "--cert-dir" "/etc/certs/auth.json"

[Image]
Image=localhost/imagename
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/quadlet/cgroups-mode.container
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## assert-podman-args --cgroups=no-conmon
## assert-podman-args "--cgroups" "no-conmon"

[Container]
Image=localhost/imagename
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/quadlet/comment-with-continuation.container
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## assert-podman-final-args localhost/imagename:latest
## assert-podman-args --publish 9091:9091
## assert-podman-args "--name=greatName"
## assert-podman-args "--name" "greatName"

[Unit]
Wants=network-online.target
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/quadlet/creds.image
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## assert-podman-final-args localhost/imagename
## assert-podman-args --creds=myname:mypassword
## assert-podman-args "--creds" "myname:mypassword"

[Image]
Image=localhost/imagename
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/quadlet/decrypt.image
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## assert-podman-final-args localhost/imagename
## assert-podman-args --decryption-key=/etc/keys/decrypt:passphrase
## assert-podman-args "--decryption-key" "/etc/keys/decrypt:passphrase"

[Image]
Image=localhost/imagename
Expand Down
12 changes: 6 additions & 6 deletions test/e2e/quadlet/devices.container
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
## assert-podman-args --device=/dev/fuse
## assert-podman-args --device=/dev/loop0:r
## assert-podman-args --device=/dev/null:/dev/test
## !assert-podman-args --device=/dev/bogus:r
## !assert-podman-args --device=/dev/bogus
## !assert-podman-args --device=/dev/bogus1
## assert-podman-args --device /dev/fuse
## assert-podman-args --device /dev/loop0:r
## assert-podman-args --device /dev/null:/dev/test
## !assert-podman-args --device /dev/bogus:r
## !assert-podman-args --device /dev/bogus
## !assert-podman-args --device /dev/bogus1

[Container]
Image=localhost/imagename
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/quadlet/dns-option.pod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## assert-podman-pre-args "--dns-option=ndots:1"
## assert-podman-pre-args "--dns-option=color:blue"
## assert-podman-pre-args "--dns-option" "ndots:1"
## assert-podman-pre-args "--dns-option" "color:blue"

[Pod]
DNSOption=ndots:1
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/quadlet/dns-options.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## assert-podman-final-args-regex /.*/podman-e2e-.*/subtest-.*/quadlet
## assert-podman-args --tag=localhost/imagename
## assert-podman-args "--dns-option=ndots:1"
## assert-podman-args "--dns-option=color:blue"
## assert-podman-args "--tag" "localhost/imagename"
## assert-podman-args "--dns-option" "ndots:1"
## assert-podman-args "--dns-option" "color:blue"

[Build]
ImageTag=localhost/imagename
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/quadlet/dns-options.container
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## assert-podman-final-args localhost/imagename
## assert-podman-args "--dns-option=ndots:1"
## assert-podman-args "--dns-option=color:blue"
## assert-podman-args "--dns-option" "ndots:1"
## assert-podman-args "--dns-option" "color:blue"

[Container]
Image=localhost/imagename
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/quadlet/dns-search.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## assert-podman-final-args-regex /.*/podman-e2e-.*/subtest-.*/quadlet
## assert-podman-args --tag=localhost/imagename
## assert-podman-args "--dns-search=foo.com"
## assert-podman-args "--dns-search=bar.com"
## assert-podman-args "--tag" "localhost/imagename"
## assert-podman-args "--dns-search" "foo.com"
## assert-podman-args "--dns-search" "bar.com"

[Build]
ImageTag=localhost/imagename
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/quadlet/dns-search.container
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## assert-podman-final-args localhost/imagename
## assert-podman-args "--dns-search=foo.com"
## assert-podman-args "--dns-search=bar.com"
## assert-podman-args "--dns-search" "foo.com"
## assert-podman-args "--dns-search" "bar.com"

[Container]
Image=localhost/imagename
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/quadlet/dns-search.pod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## assert-podman-pre-args "--dns-search=foo.com"
## assert-podman-pre-args "--dns-search=bar.com"
## assert-podman-pre-args "--dns-search" "foo.com"
## assert-podman-pre-args "--dns-search" "bar.com"

[Pod]
DNSSearch=foo.com
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/quadlet/dns.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## assert-podman-final-args-regex /.*/podman-e2e-.*/subtest-.*/quadlet
## assert-podman-args --tag=localhost/imagename
## assert-podman-args "--dns=8.7.7.7"
## assert-podman-args "--dns=8.8.8.8"
## assert-podman-args "--tag" "localhost/imagename"
## assert-podman-args "--dns" "8.7.7.7"
## assert-podman-args "--dns" "8.8.8.8"

[Build]
ImageTag=localhost/imagename
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/quadlet/dns.container
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## assert-podman-final-args localhost/imagename
## assert-podman-args "--dns=8.7.7.7"
## assert-podman-args "--dns=8.8.8.8"
## assert-podman-args "--dns" "8.7.7.7"
## assert-podman-args "--dns" "8.8.8.8"

[Container]
Image=localhost/imagename
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/quadlet/dns.network
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## assert-podman-final-args systemd-dns
## assert-podman-args "--dns=8.7.7.7"
## assert-podman-args "--dns=8.8.8.8"
## assert-podman-args "--dns" "8.7.7.7"
## assert-podman-args "--dns" "8.8.8.8"

[Network]
DNS=8.7.7.7
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/quadlet/dns.pod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## assert-podman-pre-args "--dns=8.7.7.7"
## assert-podman-pre-args "--dns=8.8.8.8"
## assert-podman-pre-args "--dns" "8.7.7.7"
## assert-podman-pre-args "--dns" "8.8.8.8"

[Pod]
DNS=8.7.7.7
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/quadlet/driver.network
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## assert-podman-final-args systemd-driver
## assert-podman-args "--driver=macvlan"
## assert-podman-args "--driver" "macvlan"

[Network]
Driver=macvlan
4 changes: 2 additions & 2 deletions test/e2e/quadlet/entrypoint.container
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## assert-podman-final-args localhost/imagename
## assert-podman-args "--entrypoint=top"
## assert-podman-args "--entrypoint" "top -b"

[Container]
Image=localhost/imagename
Entrypoint=top
Entrypoint=top -b
12 changes: 6 additions & 6 deletions test/e2e/quadlet/env.build
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## assert-podman-final-args-regex /.*/podman-e2e-.*/subtest-.*/quadlet
## assert-podman-args --tag=localhost/imagename
## assert-podman-args --env "FOO1=foo1"
## assert-podman-args --env "FOO2=foo2 "
## assert-podman-args --env "FOO3=foo3"
## assert-podman-args --env "REPLACE=replaced"
## assert-podman-args --env "FOO4=foo\\nfoo"
## assert-podman-args "--tag" "localhost/imagename"
## assert-podman-args "--env" "FOO1=foo1"
## assert-podman-args "--env" "FOO2=foo2 "
## assert-podman-args "--env" "FOO3=foo3"
## assert-podman-args "--env" "REPLACE=replaced"
## assert-podman-args "--env" "FOO4=foo\\nfoo"

[Build]
ImageTag=localhost/imagename
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/quadlet/file-abs.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## assert-podman-final-args --file=/etc/containers/systemd/Containerfile
## assert-podman-final-args "--file" "/etc/containers/systemd/Containerfile"

[Build]
File=/etc/containers/systemd/Containerfile
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/quadlet/file-https.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## assert-podman-args --tag=localhost/podman-hello
## assert-podman-args --file=https://raw.githubusercontent.com/containers/PodmanHello/main/Containerfile
## assert-podman-args "--tag" "localhost/podman-hello"
## assert-podman-args "--file" "https://raw.githubusercontent.com/containers/PodmanHello/main/Containerfile"

[Build]
File=https://raw.githubusercontent.com/containers/PodmanHello/main/Containerfile
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/quadlet/file-rel.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## assert-podman-final-args .
## assert-podman-args-regex "--file=Containerfile"
## assert-podman-args-regex "--file" "Containerfile"

[Build]
ImageTag=localhost/imagename
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/quadlet/force-rm.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## assert-podman-final-args-regex /.*/podman-e2e-.*/subtest-.*/quadlet
## assert-podman-args --tag=localhost/imagename
## assert-podman-args "--tag" "localhost/imagename"
## assert-podman-args --force-rm=false

[Build]
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/quadlet/gateway.network
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## assert-podman-final-args systemd-gateway
## assert-podman-args "--subnet=192.168.1.0/24" "--gateway=192.168.1.1"
## assert-podman-args "--subnet" "192.168.1.0/24" "--gateway" "192.168.1.1"

[Network]
Subnet=192.168.1.0/24
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/quadlet/group-add.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## assert-podman-args "--group-add=keep-groups"
## assert-podman-args "--group-add=users"
## assert-podman-args "--group-add" "keep-groups"
## assert-podman-args "--group-add" "users"

[Build]
ImageTag=localhost/imagename
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/quadlet/group-add.container
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## assert-podman-args "--group-add=keep-groups"
## assert-podman-args "--group-add=users"
## assert-podman-args "--group-add" "keep-groups"
## assert-podman-args "--group-add" "users"

[Container]
Image=localhost/imagename
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/quadlet/host.container
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Container]
Image=localhost/imagename
## assert-podman-args "--add-host=my-host-name:192.168.10.10"
## assert-podman-args "--add-host" "my-host-name:192.168.10.10"
AddHost=my-host-name:192.168.10.10
## assert-podman-args "--add-host=my-second-host-name:192.168.10.11"
## assert-podman-args "--add-host" "my-second-host-name:192.168.10.11"
AddHost=my-second-host-name:192.168.10.11
4 changes: 2 additions & 2 deletions test/e2e/quadlet/host.pod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Pod]
## assert-podman-pre-args "--add-host=my-host-name:192.168.10.10"
## assert-podman-pre-args "--add-host" "my-host-name:192.168.10.10"
AddHost=my-host-name:192.168.10.10
## assert-podman-pre-args "--add-host=my-second-host-name:192.168.10.11"
## assert-podman-pre-args "--add-host" "my-second-host-name:192.168.10.11"
AddHost=my-second-host-name:192.168.10.11
8 changes: 4 additions & 4 deletions test/e2e/quadlet/idmapping.container
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## assert-podman-args "--uidmap=0:10000:10"
## assert-podman-args "--uidmap=10:20000:10"
## assert-podman-args "--gidmap=0:10000:10"
## assert-podman-args "--gidmap=10:20000:10"
## assert-podman-args "--uidmap" "0:10000:10"
## assert-podman-args "--uidmap" "10:20000:10"
## assert-podman-args "--gidmap" "0:10000:10"
## assert-podman-args "--gidmap" "10:20000:10"

[Container]
Image=localhost/imagename
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/quadlet/image.quadlet.servicename.volume
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## assert-podman-args --driver=image
## assert-podman-args --driver image
## assert-podman-args --opt image=localhost/imagename
## assert-key-is "Unit" "Requires" "basic.service"
## assert-key-is "Unit" "After" "basic.service"
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/quadlet/image.quadlet.volume
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## assert-podman-args --driver=image
## assert-podman-args --driver image
## assert-podman-args --opt image=localhost/imagename
## assert-key-is "Unit" "Requires" "basic-image.service"
## assert-key-is "Unit" "After" "basic-image.service"
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/quadlet/image.volume
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## assert-podman-args --driver=image
## assert-podman-args --driver image
## assert-podman-args --opt image=localhost/imagename

[Volume]
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/quadlet/ip.pod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## assert-podman-pre-args "--ip=10.88.64.128"
## assert-podman-pre-args "--ip6=fd46:db93:aa76:ac37::10"
## assert-podman-pre-args "--ip" "10.88.64.128"
## assert-podman-pre-args "--ip6" "fd46:db93:aa76:ac37::10"

[Pod]
IP=10.88.64.128
Expand Down
Loading