-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Add artifact quadlet unit type support #26624
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ podman\-systemd.unit - systemd units using Podman Quadlet | |
|
||
## SYNOPSIS | ||
|
||
*name*.container, *name*.volume, *name*.network, *name*.kube *name*.image, *name*.build *name*.pod | ||
*name*.container, *name*.volume, *name*.network, *name*.kube *name*.image, *name*.build *name*.pod, *name*.artifact | ||
|
||
### Podman rootful unit search path | ||
|
||
|
@@ -48,7 +48,7 @@ the [Service] table and [Install] tables pass directly to systemd and are handle | |
See systemd.unit(5) man page for more information. | ||
|
||
The Podman generator reads the search paths above and reads files with the extensions `.container` | ||
`.volume`, `.network`, `.build`, `.pod` and `.kube`, and for each file generates a similarly named `.service` file. Be aware that | ||
`.volume`, `.network`, `.build`, `.pod`, `.kube`, and `.artifact`, and for each file generates a similarly named `.service` file. Be aware that | ||
existing vendor services (i.e., in `/usr/`) are replaced if they have the same name. The generated unit files can | ||
be started and managed with `systemctl` like any other systemd service. `systemctl {--user} list-unit-files` | ||
lists existing unit files on the system. | ||
|
@@ -104,7 +104,7 @@ Quadlet requires the use of cgroup v2, use `podman info --format {{.Host.Cgroups | |
|
||
By default, the `Type` field of the `Service` section of the Quadlet file does not need to be set. | ||
Quadlet will set it to `notify` for `.container` and `.kube` files, | ||
`forking` for `.pod` files, and `oneshot` for `.volume`, `.network`, `.build`, and `.image` files. | ||
`forking` for `.pod` files, and `oneshot` for `.volume`, `.network`, `.build`, `.image`, and `.artifact` files. | ||
|
||
However, `Type` may be explicitly set to `oneshot` for `.container` and `.kube` files when no containers are expected | ||
to run once `podman` exits. | ||
|
@@ -2075,6 +2075,133 @@ Override the default architecture variant of the container image. | |
|
||
This is equivalent to the Podman `--variant` option. | ||
|
||
## Artifact units [Artifact] | ||
|
||
### WARNING: Experimental Unit | ||
|
||
This unit is considered experimental and still in development. Inputs, options, and outputs are all subject to change. | ||
|
||
Artifact units are named with a `.artifact` extension and contain a `[Artifact]` section describing | ||
the container artifact pull command. The generated service is a one-time command that ensures that the artifact | ||
exists on the host, pulling it if needed. | ||
|
||
Using artifact units allows containers to depend on artifacts being automatically pulled. This is | ||
particularly useful for managing artifacts that containers need to mount or access. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should mention that the |
||
Valid options for `[Artifact]` are listed below: | ||
|
||
| **[Artifact] options** | **podman artifact equivalent** | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this be |
||
|---------------------------------------------|--------------------------------------------------------| | ||
| Arch=aarch64 | --arch=aarch64 | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking at the code for
|
||
| Artifact=quay\.io/foobar/artifact:special | podman artifact pull quay\.io/foobar/artifact:special | | ||
| AuthFile=/etc/registry/auth\.json | --authfile=/etc/registry/auth\.json | | ||
| CertDir=/etc/registry/certs | --cert-dir=/etc/registry/certs | | ||
| DecryptionKey=/etc/registry\.key | --decryption-key=/etc/registry\.key | | ||
| GlobalArgs=--log-level=debug | --log-level=debug | | ||
| OS=windows | --os=windows | | ||
| PodmanArgs=--os=linux | --os=linux | | ||
| Policy=always | --policy=always | | ||
| Quiet=true | --quiet | | ||
| Retry=5 | --retry=5 | | ||
| RetryDelay=10s | --retry-delay=10s | | ||
| TLSVerify=false | --tls-verify=false | | ||
| Variant=arm/v7 | --variant=arm/v7 | | ||
|
||
### `Arch=` | ||
|
||
Override the architecture, defaults to hosts, of the artifact to be pulled. | ||
|
||
This is equivalent to the Podman `--arch` option. | ||
|
||
### `Artifact=` | ||
|
||
The artifact to pull from a registry onto the local machine. This is the only required key for artifact units. | ||
|
||
It is recommended to use a fully qualified artifact name rather than a short name, both for | ||
performance and robustness reasons. | ||
|
||
### `AuthFile=` | ||
|
||
Path of the authentication file. | ||
|
||
This is equivalent to the Podman `--authfile` option. | ||
|
||
### `CertDir=` | ||
|
||
Use certificates at path (*.crt, *.cert, *.key) to connect to the registry. | ||
|
||
This is equivalent to the Podman `--cert-dir` option. | ||
|
||
### `DecryptionKey=` | ||
|
||
The `[key[:passphrase]]` to be used for decryption of artifacts. | ||
|
||
This is equivalent to the Podman `--decryption-key` option. | ||
|
||
### `GlobalArgs=` | ||
|
||
This key contains a list of arguments passed directly between `podman` and `artifact` | ||
in the generated file. It can be used to access Podman features otherwise unsupported by the generator. Since the generator is unaware | ||
of what unexpected interactions can be caused by these arguments, it is not recommended to use | ||
this option. | ||
|
||
The format of this is a space separated list of arguments, which can optionally be individually | ||
escaped to allow inclusion of whitespace and other control characters. | ||
|
||
This key can be listed multiple times. | ||
|
||
### `OS=` | ||
|
||
Override the OS, defaults to hosts, of the artifact to be pulled. | ||
|
||
This is equivalent to the Podman `--os` option. | ||
|
||
### `PodmanArgs=` | ||
|
||
This key contains a list of arguments passed directly to the end of the `podman artifact` command | ||
in the generated file (right before the artifact name in the command line). It can be used to | ||
access Podman features otherwise unsupported by the generator. Since the generator is unaware | ||
of what unexpected interactions can be caused by these arguments, it is not recommended to use | ||
this option. | ||
|
||
The format of this is a space separated list of arguments, which can optionally be individually | ||
escaped to allow inclusion of whitespace and other control characters. | ||
|
||
This key can be listed multiple times. | ||
|
||
### `Policy=` | ||
|
||
The pull policy to use when pulling the artifact. | ||
|
||
This is equivalent to the Podman `--policy` option. | ||
|
||
### `Quiet=` | ||
|
||
Suppress output information when pulling artifacts. | ||
|
||
This is equivalent to the Podman `--quiet` option. | ||
|
||
### `Retry=` | ||
|
||
Number of times to retry the artifact pull when a HTTP error occurs. Equivalent to the Podman `--retry` option. | ||
|
||
### `RetryDelay=` | ||
|
||
Delay between retries. Equivalent to the Podman `--retry-delay` option. | ||
|
||
### `TLSVerify=` | ||
|
||
Require HTTPS and verification of certificates when contacting registries. | ||
|
||
This is equivalent to the Podman `--tls-verify` option. | ||
|
||
### `Variant=` | ||
|
||
Override the default architecture variant of the container artifact. | ||
|
||
This is equivalent to the Podman `--variant` option. | ||
|
||
|
||
## Quadlet section [Quadlet] | ||
Some quadlet specific configuration is shared between different unit types. Those settings | ||
can be configured in the `[Quadlet]` section. | ||
|
@@ -2179,6 +2306,14 @@ IPRange=172.16.0.0/28 | |
Label=org.test.Key=value | ||
``` | ||
|
||
Example `test.artifact`: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please also add a usage example. Where would |
||
``` | ||
[Artifact] | ||
Artifact=quay.io/example/my-artifact:latest | ||
Arch=amd64 | ||
AuthFile=/etc/registry/auth.json | ||
``` | ||
|
||
Example for Container in a Pod: | ||
|
||
`test.pod` | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
## assert-podman-final-args localhost/imagename | ||
## assert-podman-args "--name" "systemd-%N" | ||
## assert-podman-args "--mount" | ||
## assert-podman-args "type=artifact,source=quay.io/libpod/testartifact:20250206-single,destination=/artifacts" | ||
## assert-podman-args "--rm" | ||
## assert-podman-args "--replace" | ||
## assert-podman-args "-d" | ||
## assert-podman-args "--cgroups=split" | ||
## assert-podman-args "--sdnotify=conmon" | ||
## assert-key-is "Unit" "RequiresMountsFor" "%t/containers" | ||
## assert-key-is "Service" "KillMode" "mixed" | ||
## assert-key-is "Service" "Delegate" "yes" | ||
## assert-key-is "Service" "Type" "notify" | ||
## assert-key-is "Service" "NotifyAccess" "all" | ||
## assert-key-is "Service" "SyslogIdentifier" "%N" | ||
## assert-key-is-regex "Service" "ExecStopPost" "-[/S].*/podman rm -v -f -i systemd-%N" | ||
## assert-key-is-regex "Service" "ExecStop" ".*/podman rm -v -f -i systemd-%N" | ||
## assert-key-is "Service" "Environment" "PODMAN_SYSTEMD_UNIT=%n" | ||
## assert-key-is-regex "Unit" "After" "network-online.target|podman-user-wait-network-online.service" | ||
## assert-key-is-regex "Unit" "Wants" "network-online.target|podman-user-wait-network-online.service" | ||
|
||
[Container] | ||
Image=localhost/imagename | ||
Mount=type=artifact,source=quay.io/libpod/testartifact:20250206-single,destination=/artifacts |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
## assert-podman-final-args quay.io/libpod/testartifact:20250206-single | ||
## assert-podman-args "artifact" | ||
## assert-podman-args "pull" | ||
## assert-key-is "Service" "Type" "oneshot" | ||
## assert-key-is "Service" "RemainAfterExit" "yes" | ||
## assert-key-is-regex "Unit" "After" "network-online.target|podman-user-wait-network-online.service" | ||
## assert-key-is-regex "Unit" "Wants" "network-online.target|podman-user-wait-network-online.service" | ||
|
||
[Artifact] | ||
Artifact=quay.io/libpod/testartifact:20250206-single |
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.
Why is that? Is it because
podman artifact
is at this state?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.
Yes, I just added the same text from the artifact section in podman