Skip to content
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
10 changes: 9 additions & 1 deletion docs/source/markdown/podman-artifact-add.1.md.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ the `--append` option, the original creation timestamp is preserved.

@@option annotation.manifest

Note: Set annotations for each file being added.
Note: Set annotations for each file being added. The annotation "org.opencontainers.image.title" is used
to name the layer when mounted into a container, this title must be unigue for each artifact layer.

#### **--append**, **-a**

Expand Down Expand Up @@ -78,6 +79,13 @@ Add files to an existing OCI artifact
$ podman artifact add --append quay.io/myimage/myartifact:latest /home/user/config.yaml
```

Create artifact with the layer title name being replaced, and then mount into a container.

```
podman artifact add --annotation org.opencontainers.image.title=smollm2 quay.io/myreg/smollm2:latest blobs/sha256-4d2396b16114669389d7555c15a1592aad584750310f648edad5ca8c4eccda17
podman run --mount type=artifact,source=quay.io/myreg/smollm2:latest,destination=/mnt fedora ls -l /mnt
smollm2
```

## SEE ALSO
**[podman(1)](podman.1.md)**, **[podman-artifact(1)](podman-artifact.1.md)**
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ require (
github.com/vbauerster/mpb/v8 v8.10.2
github.com/vishvananda/netlink v1.3.1
go.etcd.io/bbolt v1.4.3
go.podman.io/common v0.65.1-0.20251016133615-aa970d2c7532
go.podman.io/common v0.65.1-0.20251016162239-c4c5e00ad22d
go.podman.io/image/v5 v5.37.1-0.20251016133615-aa970d2c7532
go.podman.io/storage v1.60.1-0.20251016133615-aa970d2c7532
golang.org/x/crypto v0.43.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,8 @@ go.opentelemetry.io/otel/trace v1.36.0 h1:ahxWNuqZjpdiFAyrIoQ4GIiAIhxAunQR6MUoKr
go.opentelemetry.io/otel/trace v1.36.0/go.mod h1:gQ+OnDZzrybY4k4seLzPAWNwVBBVlF2szhehOBB/tGA=
go.opentelemetry.io/proto/otlp v1.5.0 h1:xJvq7gMzB31/d406fB8U5CBdyQGw4P399D1aQWU/3i4=
go.opentelemetry.io/proto/otlp v1.5.0/go.mod h1:keN8WnHxOy8PG0rQZjJJ5A2ebUoafqWp0eVQ4yIXvJ4=
go.podman.io/common v0.65.1-0.20251016133615-aa970d2c7532 h1:j83jJWTMND24j2fk0G+waJiKF3A/bMHcQxPkkJA9k4Q=
go.podman.io/common v0.65.1-0.20251016133615-aa970d2c7532/go.mod h1:kv0yXx/yrT60lUcVb86hezMGz/lXmyx3epvdFlM9du4=
go.podman.io/common v0.65.1-0.20251016162239-c4c5e00ad22d h1:xk2iM/F/6UTuPD3+MNOqZvju0xYQ14IpvegxQ1sC464=
go.podman.io/common v0.65.1-0.20251016162239-c4c5e00ad22d/go.mod h1:kv0yXx/yrT60lUcVb86hezMGz/lXmyx3epvdFlM9du4=
go.podman.io/image/v5 v5.37.1-0.20251016133615-aa970d2c7532 h1:J7qB0n2DLY9hLCS9z3eubDuBrl6GOiz1iVMufhTRs3k=
go.podman.io/image/v5 v5.37.1-0.20251016133615-aa970d2c7532/go.mod h1:rzI7vFUroTWKtAAVuYCoT2wy8LbcepZgEuhzzRzfui4=
go.podman.io/storage v1.60.1-0.20251016133615-aa970d2c7532 h1:3+RVXZET/LnyhXdQnpIVvjuNs04Jz3IJtC9T++pwqpI=
Expand Down
2 changes: 1 addition & 1 deletion pkg/machine/ocipull/ociartifact.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const (
artifactRegistry = "quay.io"
artifactRepo = "podman"
artifactImageName = "machine-os"
artifactOriginalName = "org.opencontainers.image.title"
artifactOriginalName = specV1.AnnotationTitle
machineOS = "linux"
)

Expand Down
30 changes: 26 additions & 4 deletions test/e2e/artifact_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/containers/podman/v5/utils"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
imgspec "github.com/opencontainers/image-spec/specs-go/v1"
)

const (
Expand Down Expand Up @@ -99,8 +100,12 @@ var _ = Describe("Podman artifact", func() {
It("podman artifact add with options", func() {
yamlType := "text/yaml"
artifact1Name := "localhost/test/artifact1"
artifact2Name := "localhost/test/artifact2"
artifact3Name := "localhost/test/artifact3"
artifact1File, err := createArtifactFile(1024)
Expect(err).ToNot(HaveOccurred())
artifact2File, err := createArtifactFile(1024)
Expect(err).ToNot(HaveOccurred())

artifactType := "octet/foobar"
annotation1 := "color=blue"
Expand All @@ -115,9 +120,26 @@ var _ = Describe("Podman artifact", func() {
Expect(a.Manifest.Layers[0].Annotations["flavor"]).To(Equal("lemon"))
Expect(a.Manifest.Layers[0].MediaType).To(Equal(yamlType))

failSession := podmanTest.Podman([]string{"artifact", "add", "--annotation", "org.opencontainers.image.title=foobar", "foobar", artifact1File})
title := RandomString(12)
annotation3 := fmt.Sprintf("%s=%s", imgspec.AnnotationTitle, title)
podmanTest.PodmanExitCleanly("artifact", "add", "--annotation", annotation3, artifact2Name, artifact1File)
a = podmanTest.InspectArtifact(artifact2Name)
Expect(a.Manifest.Layers[0].Annotations[imgspec.AnnotationTitle]).To(Equal(title))

failSession := podmanTest.Podman([]string{"artifact", "add", "--append", "--annotation", annotation3, artifact2Name, artifact2File})
failSession.WaitWithDefaultTimeout()
Expect(failSession).Should(ExitWithError(125, "Error: cannot override filename with org.opencontainers.image.title annotation"))
Expect(failSession).Should(ExitWithError(125, "Error: duplicate layers org.opencontainers.image.title labels within an artifact not allowed"))

title = RandomString(12)
annotation3 = fmt.Sprintf("%s=%s", imgspec.AnnotationTitle, title)
podmanTest.PodmanExitCleanly("artifact", "add", "--append", "--annotation", annotation3, artifact2Name, artifact2File)
a = podmanTest.InspectArtifact(artifact2Name)
Expect(a.Manifest.Layers[1].Annotations[imgspec.AnnotationTitle]).To(Equal(title))

failSession = podmanTest.Podman([]string{"artifact", "add", "--annotation", annotation3, artifact3Name, artifact1File, artifact2File})
failSession.WaitWithDefaultTimeout()
Expect(failSession).Should(ExitWithError(125, "Error: duplicate layers org.opencontainers.image.title labels within an artifact not allowed"))

})

It("podman artifact add multiple", func() {
Expand Down Expand Up @@ -480,9 +502,9 @@ var _ = Describe("Podman artifact", func() {
Expect(a.Manifest.Layers).To(HaveLen(3))

for _, l := range a.Manifest.Layers {
layersNames[l.Annotations["org.opencontainers.image.title"]] += 1
layersNames[l.Annotations[imgspec.AnnotationTitle]] += 1

if l.Annotations["org.opencontainers.image.title"] == filepath.Base(artifact3File) {
if l.Annotations[imgspec.AnnotationTitle] == filepath.Base(artifact3File) {
Expect(l.Annotations["color"]).To(Equal("blue"))
} else {
Expect(l.Annotations).To(HaveLen(1))
Expand Down
24 changes: 16 additions & 8 deletions vendor/go.podman.io/common/pkg/libartifact/store/store.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ go.opentelemetry.io/otel/trace
go.opentelemetry.io/otel/trace/embedded
go.opentelemetry.io/otel/trace/internal/telemetry
go.opentelemetry.io/otel/trace/noop
# go.podman.io/common v0.65.1-0.20251016133615-aa970d2c7532
# go.podman.io/common v0.65.1-0.20251016162239-c4c5e00ad22d
## explicit; go 1.24.2
go.podman.io/common/internal
go.podman.io/common/internal/attributedstring
Expand Down