Files
podman/docs/source/markdown/podman-artifact-add.1.md.in
Daniel J Walsh b765c91580 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>
2025-10-06 12:22:40 -04:00

87 lines
2.2 KiB
Markdown

% podman-artifact-add 1
## NAME
podman\-artifact\-add - Add an OCI artifact to local artifact store
## SYNOPSIS
**podman artifact add** [*options*] *artifact-name* *file* [*file* ...]
## DESCRIPTION
Add an OCI artifact to the local store from the local filesystem. You must
provide at least one file to create the artifact, but several can also be
added.
Artifacts automatically include a creation timestamp in the
`org.opencontainers.image.created` annotation using RFC3339Nano format. When using
the `--append` option, the original creation timestamp is preserved.
## OPTIONS
@@option annotation.manifest
Note: Set annotations for each file being added.
#### **--append**, **-a**
Append files to an existing artifact. This option cannot be used with the **--type** option.
#### **--file-type**
Set the media type of the artifact file instead of allowing detection to determine the type
#### **--help**
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.
## EXAMPLES
Add a single file to an artifact
```
$ 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
```
Add files to an existing OCI artifact
```
$ podman artifact add --append quay.io/myimage/myartifact:latest /home/user/config.yaml
```
## SEE ALSO
**[podman(1)](podman.1.md)**, **[podman-artifact(1)](podman-artifact.1.md)**
## HISTORY
Jan 2025, Originally compiled by Brent Baude <bbaude@redhat.com>