Skip to content

feat: add image volume archive function for use as mount - #5235

Open
a1994sc wants to merge 21 commits into
mainfrom
feature/image-volume-create
Open

feat: add image volume archive function for use as mount#5235
a1994sc wants to merge 21 commits into
mainfrom
feature/image-volume-create

Conversation

@a1994sc

@a1994sc a1994sc commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Description

Adds zarf dev image-volume-archive (alias iva), a dev command that packs a directory of files into a container image usable as a volume mount by containerd, cri-o, and docker.

Given a directory and an image reference, it:

  • tars and (optionally) compresses each regular file in the directory as an individual OCI image layer (gzip, zstd, or uncompressed)
  • caps the number of layers via --max-layers (default 127), batching files several-per-layer once the directory holds more files than the cap
  • builds an OCI image config/manifest and stages it in a local OCI store
  • writes the result as a Docker/OCI-compatible tar archive (docker load/ctr image import compatible) via -O/--output, defaulting to a filename derived from the image reference
  • registers shell tab completion for --layer-compression, --platform-os, --max-layers, and the root --architecture flag

New packages:

  • src/pkg/zoci/image: builds the layered OCI image (Volume, layer/diff ID/compression handling, platform validation)
  • src/pkg/zoci/archive: read-only content.Provider over an OCI store for tar export, plus ImageRefToTar/ValidateFileEndsWithTar helpers for deriving and validating the output path

Related Issue

Relates to #4124

Checklist before merging

Signed-off-by: Allen Conlon <software@conlon.dev>
@netlify

netlify Bot commented Aug 17, 2026

Copy link
Copy Markdown

Deploy Preview for zarf-docs canceled.

Name Link
🔨 Latest commit b54ac04
🔍 Latest deploy log https://app.netlify.com/projects/zarf-docs/deploys/6a8af2daf818f90008d41c6b

@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 69.05830% with 138 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pkg/zoci/image/volume.go 73.68% 44 Missing and 21 partials ⚠️
src/cmd/dev/iva.go 55.55% 26 Missing and 10 partials ⚠️
src/cmd/cobra/dev.go 0.00% 16 Missing ⚠️
src/pkg/zoci/image/builder.go 80.00% 4 Missing and 2 partials ⚠️
src/cmd/cobra/root.go 0.00% 5 Missing ⚠️
src/cmd/root.go 16.66% 4 Missing and 1 partial ⚠️
src/pkg/zoci/archive/store.go 79.16% 4 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
src/cmd/dev.go 36.81% <100.00%> (+0.06%) ⬆️
src/pkg/zoci/archive/helper.go 100.00% <100.00%> (ø)
src/pkg/zoci/image/platform.go 100.00% <100.00%> (ø)
src/cmd/cobra/root.go 0.00% <0.00%> (ø)
src/cmd/root.go 36.18% <16.66%> (-0.61%) ⬇️
src/pkg/zoci/archive/store.go 79.16% <79.16%> (ø)
src/pkg/zoci/image/builder.go 80.00% <80.00%> (ø)
src/cmd/cobra/dev.go 0.00% <0.00%> (ø)
src/cmd/dev/iva.go 55.55% <55.55%> (ø)
src/pkg/zoci/image/volume.go 73.68% <73.68%> (ø)

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: Allen Conlon <software@conlon.dev>
Signed-off-by: Allen Conlon <software@conlon.dev>
@a1994sc

a1994sc commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Some code was generated with Claude, Sonnet 5, though a human verified the code.

Signed-off-by: Allen Conlon <software@conlon.dev>
Signed-off-by: Allen Conlon <software@conlon.dev>
Signed-off-by: Allen Conlon <software@conlon.dev>
…create

Signed-off-by: Allen Conlon <software@conlon.dev>
Signed-off-by: Allen Conlon <software@conlon.dev>
Signed-off-by: Allen Conlon <software@conlon.dev>
Signed-off-by: Allen Conlon <software@conlon.dev>
Signed-off-by: Allen Conlon <software@conlon.dev>
@a1994sc
a1994sc force-pushed the feature/image-volume-create branch from 2c0320d to e1d8716 Compare August 20, 2026 22:11
@a1994sc
a1994sc marked this pull request as ready for review August 20, 2026 22:26
@a1994sc
a1994sc requested review from a team as code owners August 20, 2026 22:26
@a1994sc a1994sc changed the title feat: start working on adding file to image for ivm feat: add image volume archive for use as mount Aug 20, 2026
@a1994sc a1994sc changed the title feat: add image volume archive for use as mount feat: add image volume archive function for use as mount Aug 20, 2026
Signed-off-by: Allen Conlon <software@conlon.dev>
Signed-off-by: Allen Conlon <software@conlon.dev>
Signed-off-by: Allen Conlon <software@conlon.dev>
Signed-off-by: Allen Conlon <software@conlon.dev>
Signed-off-by: Allen Conlon <software@conlon.dev>
Signed-off-by: Allen Conlon <software@conlon.dev>
Signed-off-by: Allen Conlon <software@conlon.dev>
Signed-off-by: Allen Conlon <software@conlon.dev>
Comment thread src/cmd/cobra/root.go
// GetRootArchitectureCobraCompression returns the valid --architecture
// values as "value\tdescription" pairs, ready to return from a cobra
// RegisterFlagCompletionFunc callback for shell tab completion.
func GetRootArchitectureCobraCompression() []string {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Realized that this is a bad function name.... I will update it soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants