mirror of
https://github.com/containers/podman.git
synced 2025-11-29 01:28:22 +08:00
Add --replace option to podman artifact add command
This commit implements the --replace functionality for the artifact add command, allowing users to replace existing artifacts without having to manually remove them first. Changes made: - Add Replace field to ArtifactAddOptions entity types - Add --replace CLI flag with validation to prevent conflicts with --append - Implement replace logic in ABI backend to remove existing artifacts before adding - Update API handlers and tunnel implementation for podman-remote support - Add comprehensive documentation and examples to man page - Add e2e and system BATS tests for --replace functionality - Fix code formatting in pkg/bindings/artifacts/types_pull_options.go: * Reorder imports with proper spacing * Fix function declaration spacing * Convert spaces to proper tab indentation * Remove extraneous blank lines The --replace option follows the same pattern as other podman replace options like 'podman container create --replace' and 'podman pod create --replace'. It gracefully handles cases where no existing artifact exists (no error thrown). Usage examples: podman artifact add --replace quay.io/myimage/artifact:latest /path/to/file podman artifact add --replace localhost/test/artifact /tmp/newfile.txt Fixes: Implements requested --replace functionality for artifact add command Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
% podman-artifact-add 1
|
||||
|
||||
## NAME
|
||||
podman\-artifact\-add - Add an OCI artifact to the local store
|
||||
podman\-artifact\-add - Add an OCI artifact to local artifact store
|
||||
|
||||
## SYNOPSIS
|
||||
**podman artifact add** *name* *file* [*file*]...
|
||||
**podman artifact add** [*options*] *artifact-name* *file* [*file* ...]
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
@@ -35,6 +35,11 @@ Set the media type of the artifact file instead of allowing detection to determi
|
||||
|
||||
Print usage statement.
|
||||
|
||||
#### **--replace**
|
||||
|
||||
If an artifact with the same name already exists, replace and remove it. The default is **false**.
|
||||
This option cannot be used with the **--append** option.
|
||||
|
||||
#### **--type**
|
||||
|
||||
Set a type for the artifact being added.
|
||||
@@ -48,25 +53,29 @@ $ podman artifact add quay.io/myartifact/myml:latest /tmp/foobar.ml
|
||||
0fe1488ecdef8cc4093e11a55bc048d9fc3e13a4ba846efd24b5a715006c95b3
|
||||
```
|
||||
|
||||
Add OCI artifact to the store with type:
|
||||
|
||||
```
|
||||
$ podman artifact add --artifact-type application/com.example.ai --file-type application/vnd.gguf quay.io/myimage/myartifact:latest /home/user/model.gguf
|
||||
```
|
||||
|
||||
Replace an existing artifact with the same name
|
||||
|
||||
```
|
||||
$ podman artifact add quay.io/myartifact/myml:latest /tmp/foobar.ml
|
||||
0fe1488ecdef8cc4093e11a55bc048d9fc3e13a4ba846efd24b5a715006c95b3
|
||||
```
|
||||
|
||||
Add multiple files to an artifact
|
||||
```
|
||||
$ podman artifact add quay.io/myartifact/myml:latest /tmp/foobar1.ml /tmp/foobar2.ml
|
||||
1487acae11b5a30948c50762882036b41ac91a7b9514be8012d98015c95ddb78
|
||||
```
|
||||
|
||||
Set an annotation for an artifact
|
||||
```
|
||||
$ podman artifact add --annotation date=2025-01-30 quay.io/myartifact/myml:latest /tmp/foobar1.ml
|
||||
```
|
||||
Add files to an existing OCI artifact
|
||||
|
||||
Append a file to an existing artifact
|
||||
```
|
||||
$ podman artifact add --append quay.io/myartifact/tarballs:latest /tmp/foobar.tar.gz
|
||||
```
|
||||
|
||||
Override the media type of the artifact being added
|
||||
```
|
||||
$ podman artifact add --file-type text/yaml quay.io/myartifact/descriptors:latest /tmp/info.yaml
|
||||
$ podman artifact add --append quay.io/myimage/myartifact:latest /home/user/config.yaml
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ from its local "artifact store".
|
||||
|
||||
| Command | Man Page | Description |
|
||||
|---------|------------------------------------------------------------|--------------------------------------------------------------|
|
||||
| add | [podman-artifact-add(1)](podman-artifact-add.1.md) | Add an OCI artifact to the local store |
|
||||
| add | [podman-artifact-add(1)](podman-artifact-add.1.md) | Add an OCI artifact to local artifact store |
|
||||
| extract | [podman-artifact-extract(1)](podman-artifact-extract.1.md) | Extract an OCI artifact to a local path |
|
||||
| inspect | [podman-artifact-inspect(1)](podman-artifact-inspect.1.md) | Inspect an OCI artifact |
|
||||
| ls | [podman-artifact-ls(1)](podman-artifact-ls.1.md) | List OCI artifacts in local store |
|
||||
|
||||
Reference in New Issue
Block a user