Skip to content

Commit fc25a3a

Browse files
committed
Quadlet - prefer "param val" over "param=val" to allow env expansion
When possible use a generic function to add strings and booleans Adjust tests Signed-off-by: Ygal Blum <[email protected]>
1 parent 0c6be7a commit fc25a3a

File tree

107 files changed

+289
-417
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+289
-417
lines changed

pkg/systemd/quadlet/quadlet.go

+122-237
Large diffs are not rendered by default.

test/e2e/quadlet/annotation.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## assert-podman-args "--annotation" "org.foo.Arg1=arg1"
44
## assert-podman-args "--annotation" "org.foo.Arg2=arg 2"
55
## assert-podman-args "--annotation" "org.foo.Arg3=arg3"
6-
## assert-podman-args --tag=localhost/imagename
6+
## assert-podman-args "--tag" "localhost/imagename"
77

88
[Build]
99
ImageTag=localhost/imagename

test/e2e/quadlet/arch-os.image

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## assert-podman-final-args localhost/imagename
2-
## assert-podman-args --os=windows
3-
## assert-podman-args --arch=arm64
2+
## assert-podman-args "--os" "windows"
3+
## assert-podman-args "--arch" "arm64"
44

55
[Image]
66
Image=localhost/imagename

test/e2e/quadlet/arch.build

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## assert-podman-final-args-regex /.*/podman-e2e-.*/subtest-.*/quadlet
2-
## assert-podman-args --tag=localhost/imagename
3-
## assert-podman-args --arch=aarch64
2+
## assert-podman-args "--tag" "localhost/imagename"
3+
## assert-podman-args "--arch" "aarch64"
44

55
[Build]
66
ImageTag=localhost/imagename

test/e2e/quadlet/arch.image

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## assert-podman-final-args localhost/imagename
2-
## assert-podman-args --arch=aarch64
2+
## assert-podman-args "--arch" "aarch64"
33

44
[Image]
55
Image=localhost/imagename

test/e2e/quadlet/auth.image

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## assert-podman-final-args localhost/imagename
2-
## assert-podman-args --authfile=/etc/certs/auth.json
2+
## assert-podman-args "--authfile" "/etc/certs/auth.json"
33

44
[Image]
55
Image=localhost/imagename

test/e2e/quadlet/authfile.build

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## assert-podman-final-args-regex /.*/podman-e2e-.*/subtest-.*/quadlet
2-
## assert-podman-args --tag=localhost/imagename
3-
## assert-podman-args --authfile=/etc/certs/auth.json
2+
## assert-podman-args "--tag" "localhost/imagename"
3+
## assert-podman-args "--authfile" "/etc/certs/auth.json"
44

55
[Build]
66
ImageTag=localhost/imagename

test/e2e/quadlet/basepodman.container

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## assert-podman-final-args run --name=systemd-%N --cidfile=%t/%N.cid --replace --rm --cgroups=split --sdnotify=conmon -d localhost/imagename
1+
## assert-podman-final-args run --name systemd-%N --cidfile=%t/%N.cid --replace --rm --cgroups=split --sdnotify=conmon -d localhost/imagename
22

33
[Container]
44
Image=localhost/imagename

test/e2e/quadlet/basic.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## assert-podman-final-args-regex /.*/podman-e2e-.*/subtest-.*/quadlet
2-
## assert-podman-args --tag=localhost/imagename
2+
## assert-podman-args "--tag" "localhost/imagename"
33
## assert-key-is "Unit" "After" "network-online.target"
44
## assert-key-is "Unit" "Wants" "network-online.target"
55
## assert-key-is "Unit" "RequiresMountsFor" "%t/containers"

test/e2e/quadlet/basic.container

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## assert-podman-final-args localhost/imagename
2-
## assert-podman-args "--name=systemd-%N"
2+
## assert-podman-args "--name" "systemd-%N"
33
## assert-podman-args "--cidfile=%t/%N.cid"
44
## assert-podman-args "--rm"
55
## assert-podman-args "--replace"

test/e2e/quadlet/basic.pod

+1-1

test/e2e/quadlet/build.quadlet.servicename.volume

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## assert-podman-args --driver=image
1+
## assert-podman-args --driver image
22
## assert-podman-args --opt image=localhost/imagename
33
## assert-key-is "Unit" "Requires" "basic.service"
44
## assert-key-is "Unit" "After" "basic.service"

test/e2e/quadlet/build.quadlet.volume

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## assert-podman-args --driver=image
1+
## assert-podman-args --driver image
22
## assert-podman-args --opt image=localhost/imagename
33
## assert-key-is "Unit" "Requires" "basic-build.service"
44
## assert-key-is "Unit" "After" "basic-build.service"

test/e2e/quadlet/capabilities.container

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
## !assert-podman-args "--cap-drop=all"
2-
## assert-podman-args "--cap-add=cap_dac_override"
3-
## assert-podman-args "--cap-add=cap_audit_write"
4-
## assert-podman-args "--cap-add=cap_ipc_owner"
1+
## !assert-podman-args "--cap-drop" "all"
2+
## assert-podman-args "--cap-add" "cap_dac_override"
3+
## assert-podman-args "--cap-add" "cap_audit_write"
4+
## assert-podman-args "--cap-add" "cap_ipc_owner"
55

66
[Container]
77
Image=localhost/imagename

test/e2e/quadlet/capabilities2.container

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
## !assert-podman-args "--cap-drop=all"
2-
## assert-podman-args "--cap-drop=cap_dac_override"
3-
## assert-podman-args "--cap-drop=cap_audit_write"
4-
## assert-podman-args "--cap-drop=cap_ipc_owner"
1+
## !assert-podman-args "--cap-drop" "all"
2+
## assert-podman-args "--cap-drop" "cap_dac_override"
3+
## assert-podman-args "--cap-drop" "cap_audit_write"
4+
## assert-podman-args "--cap-drop" "cap_ipc_owner"
55

66
[Container]
77
Image=localhost/imagename

test/e2e/quadlet/certs.image

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## assert-podman-final-args localhost/imagename
2-
## assert-podman-args --cert-dir=/etc/certs/auth.json
2+
## assert-podman-args "--cert-dir" "/etc/certs/auth.json"
33

44
[Image]
55
Image=localhost/imagename

test/e2e/quadlet/cgroups-mode.container

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## assert-podman-args --cgroups=no-conmon
1+
## assert-podman-args "--cgroups" "no-conmon"
22

33
[Container]
44
Image=localhost/imagename

test/e2e/quadlet/comment-with-continuation.container

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## assert-podman-final-args localhost/imagename:latest
22
## assert-podman-args --publish 9091:9091
3-
## assert-podman-args "--name=greatName"
3+
## assert-podman-args "--name" "greatName"
44

55
[Unit]
66
Wants=network-online.target

test/e2e/quadlet/creds.image

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## assert-podman-final-args localhost/imagename
2-
## assert-podman-args --creds=myname:mypassword
2+
## assert-podman-args "--creds" "myname:mypassword"
33

44
[Image]
55
Image=localhost/imagename

test/e2e/quadlet/decrypt.image

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## assert-podman-final-args localhost/imagename
2-
## assert-podman-args --decryption-key=/etc/keys/decrypt:passphrase
2+
## assert-podman-args "--decryption-key" "/etc/keys/decrypt:passphrase"
33

44
[Image]
55
Image=localhost/imagename

test/e2e/quadlet/devices.container

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
## assert-podman-args --device=/dev/fuse
2-
## assert-podman-args --device=/dev/loop0:r
3-
## assert-podman-args --device=/dev/null:/dev/test
4-
## !assert-podman-args --device=/dev/bogus:r
5-
## !assert-podman-args --device=/dev/bogus
6-
## !assert-podman-args --device=/dev/bogus1
1+
## assert-podman-args --device /dev/fuse
2+
## assert-podman-args --device /dev/loop0:r
3+
## assert-podman-args --device /dev/null:/dev/test
4+
## !assert-podman-args --device /dev/bogus:r
5+
## !assert-podman-args --device /dev/bogus
6+
## !assert-podman-args --device /dev/bogus1
77

88
[Container]
99
Image=localhost/imagename

test/e2e/quadlet/dns-option.pod

+2-2

test/e2e/quadlet/dns-options.build

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## assert-podman-final-args-regex /.*/podman-e2e-.*/subtest-.*/quadlet
2-
## assert-podman-args --tag=localhost/imagename
3-
## assert-podman-args "--dns-option=ndots:1"
4-
## assert-podman-args "--dns-option=color:blue"
2+
## assert-podman-args "--tag" "localhost/imagename"
3+
## assert-podman-args "--dns-option" "ndots:1"
4+
## assert-podman-args "--dns-option" "color:blue"
55

66
[Build]
77
ImageTag=localhost/imagename

test/e2e/quadlet/dns-options.container

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## assert-podman-final-args localhost/imagename
2-
## assert-podman-args "--dns-option=ndots:1"
3-
## assert-podman-args "--dns-option=color:blue"
2+
## assert-podman-args "--dns-option" "ndots:1"
3+
## assert-podman-args "--dns-option" "color:blue"
44

55
[Container]
66
Image=localhost/imagename

test/e2e/quadlet/dns-search.build

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## assert-podman-final-args-regex /.*/podman-e2e-.*/subtest-.*/quadlet
2-
## assert-podman-args --tag=localhost/imagename
3-
## assert-podman-args "--dns-search=foo.com"
4-
## assert-podman-args "--dns-search=bar.com"
2+
## assert-podman-args "--tag" "localhost/imagename"
3+
## assert-podman-args "--dns-search" "foo.com"
4+
## assert-podman-args "--dns-search" "bar.com"
55

66
[Build]
77
ImageTag=localhost/imagename

test/e2e/quadlet/dns-search.container

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## assert-podman-final-args localhost/imagename
2-
## assert-podman-args "--dns-search=foo.com"
3-
## assert-podman-args "--dns-search=bar.com"
2+
## assert-podman-args "--dns-search" "foo.com"
3+
## assert-podman-args "--dns-search" "bar.com"
44

55
[Container]
66
Image=localhost/imagename

test/e2e/quadlet/dns-search.pod

+2-2

test/e2e/quadlet/dns.build

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## assert-podman-final-args-regex /.*/podman-e2e-.*/subtest-.*/quadlet
2-
## assert-podman-args --tag=localhost/imagename
3-
## assert-podman-args "--dns=8.7.7.7"
4-
## assert-podman-args "--dns=8.8.8.8"
2+
## assert-podman-args "--tag" "localhost/imagename"
3+
## assert-podman-args "--dns" "8.7.7.7"
4+
## assert-podman-args "--dns" "8.8.8.8"
55

66
[Build]
77
ImageTag=localhost/imagename

test/e2e/quadlet/dns.container

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## assert-podman-final-args localhost/imagename
2-
## assert-podman-args "--dns=8.7.7.7"
3-
## assert-podman-args "--dns=8.8.8.8"
2+
## assert-podman-args "--dns" "8.7.7.7"
3+
## assert-podman-args "--dns" "8.8.8.8"
44

55
[Container]
66
Image=localhost/imagename

test/e2e/quadlet/dns.network

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## assert-podman-final-args systemd-dns
2-
## assert-podman-args "--dns=8.7.7.7"
3-
## assert-podman-args "--dns=8.8.8.8"
2+
## assert-podman-args "--dns" "8.7.7.7"
3+
## assert-podman-args "--dns" "8.8.8.8"
44

55
[Network]
66
DNS=8.7.7.7

test/e2e/quadlet/dns.pod

+2-2

test/e2e/quadlet/driver.network

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## assert-podman-final-args systemd-driver
2-
## assert-podman-args "--driver=macvlan"
2+
## assert-podman-args "--driver" "macvlan"
33

44
[Network]
55
Driver=macvlan

test/e2e/quadlet/entrypoint.container

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## assert-podman-final-args localhost/imagename
2-
## assert-podman-args "--entrypoint=top"
2+
## assert-podman-args "--entrypoint" "top -b"
33

44
[Container]
55
Image=localhost/imagename
6-
Entrypoint=top
6+
Entrypoint=top -b

test/e2e/quadlet/env.build

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
## assert-podman-final-args-regex /.*/podman-e2e-.*/subtest-.*/quadlet
2-
## assert-podman-args --tag=localhost/imagename
3-
## assert-podman-args --env "FOO1=foo1"
4-
## assert-podman-args --env "FOO2=foo2 "
5-
## assert-podman-args --env "FOO3=foo3"
6-
## assert-podman-args --env "REPLACE=replaced"
7-
## assert-podman-args --env "FOO4=foo\\nfoo"
2+
## assert-podman-args "--tag" "localhost/imagename"
3+
## assert-podman-args "--env" "FOO1=foo1"
4+
## assert-podman-args "--env" "FOO2=foo2 "
5+
## assert-podman-args "--env" "FOO3=foo3"
6+
## assert-podman-args "--env" "REPLACE=replaced"
7+
## assert-podman-args "--env" "FOO4=foo\\nfoo"
88

99
[Build]
1010
ImageTag=localhost/imagename

test/e2e/quadlet/file-abs.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## assert-podman-final-args --file=/etc/containers/systemd/Containerfile
1+
## assert-podman-final-args "--file" "/etc/containers/systemd/Containerfile"
22

33
[Build]
44
File=/etc/containers/systemd/Containerfile

test/e2e/quadlet/file-https.build

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
## assert-podman-args --tag=localhost/podman-hello
2-
## assert-podman-args --file=https://raw.githubusercontent.com/containers/PodmanHello/main/Containerfile
1+
## assert-podman-args "--tag" "localhost/podman-hello"
2+
## assert-podman-args "--file" "https://raw.githubusercontent.com/containers/PodmanHello/main/Containerfile"
33

44
[Build]
55
File=https://raw.githubusercontent.com/containers/PodmanHello/main/Containerfile

test/e2e/quadlet/file-rel.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## assert-podman-final-args .
2-
## assert-podman-args-regex "--file=Containerfile"
2+
## assert-podman-args-regex "--file" "Containerfile"
33

44
[Build]
55
ImageTag=localhost/imagename

test/e2e/quadlet/force-rm.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## assert-podman-final-args-regex /.*/podman-e2e-.*/subtest-.*/quadlet
2-
## assert-podman-args --tag=localhost/imagename
2+
## assert-podman-args "--tag" "localhost/imagename"
33
## assert-podman-args --force-rm=false
44

55
[Build]

test/e2e/quadlet/gateway.network

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## assert-podman-final-args systemd-gateway
2-
## assert-podman-args "--subnet=192.168.1.0/24" "--gateway=192.168.1.1"
2+
## assert-podman-args "--subnet" "192.168.1.0/24" "--gateway" "192.168.1.1"
33

44
[Network]
55
Subnet=192.168.1.0/24

test/e2e/quadlet/group-add.build

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
## assert-podman-args "--group-add=keep-groups"
2-
## assert-podman-args "--group-add=users"
1+
## assert-podman-args "--group-add" "keep-groups"
2+
## assert-podman-args "--group-add" "users"
33

44
[Build]
55
ImageTag=localhost/imagename

test/e2e/quadlet/group-add.container

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
## assert-podman-args "--group-add=keep-groups"
2-
## assert-podman-args "--group-add=users"
1+
## assert-podman-args "--group-add" "keep-groups"
2+
## assert-podman-args "--group-add" "users"
33

44
[Container]
55
Image=localhost/imagename

test/e2e/quadlet/host.container

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[Container]
22
Image=localhost/imagename
3-
## assert-podman-args "--add-host=my-host-name:192.168.10.10"
3+
## assert-podman-args "--add-host" "my-host-name:192.168.10.10"
44
AddHost=my-host-name:192.168.10.10
5-
## assert-podman-args "--add-host=my-second-host-name:192.168.10.11"
5+
## assert-podman-args "--add-host" "my-second-host-name:192.168.10.11"
66
AddHost=my-second-host-name:192.168.10.11

test/e2e/quadlet/host.pod

+2-2

test/e2e/quadlet/idmapping.container

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
## assert-podman-args "--uidmap=0:10000:10"
2-
## assert-podman-args "--uidmap=10:20000:10"
3-
## assert-podman-args "--gidmap=0:10000:10"
4-
## assert-podman-args "--gidmap=10:20000:10"
1+
## assert-podman-args "--uidmap" "0:10000:10"
2+
## assert-podman-args "--uidmap" "10:20000:10"
3+
## assert-podman-args "--gidmap" "0:10000:10"
4+
## assert-podman-args "--gidmap" "10:20000:10"
55

66
[Container]
77
Image=localhost/imagename

test/e2e/quadlet/image.quadlet.servicename.volume

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## assert-podman-args --driver=image
1+
## assert-podman-args --driver image
22
## assert-podman-args --opt image=localhost/imagename
33
## assert-key-is "Unit" "Requires" "basic.service"
44
## assert-key-is "Unit" "After" "basic.service"

test/e2e/quadlet/image.quadlet.volume

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## assert-podman-args --driver=image
1+
## assert-podman-args --driver image
22
## assert-podman-args --opt image=localhost/imagename
33
## assert-key-is "Unit" "Requires" "basic-image.service"
44
## assert-key-is "Unit" "After" "basic-image.service"

test/e2e/quadlet/image.volume

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## assert-podman-args --driver=image
1+
## assert-podman-args --driver image
22
## assert-podman-args --opt image=localhost/imagename
33

44
[Volume]

test/e2e/quadlet/ip.pod

+2-2

0 commit comments

Comments
 (0)