Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
4b2e1cf
fix: issue 4148
ericwyles Oct 21, 2025
dfe19c7
feat!: allow Zarf registry deployment behind a proxy (#3956)
AustinAbro321 Oct 21, 2025
439ef09
fix: wait shell escaping (#4260)
vincent-onebrief Oct 21, 2025
6fa1ab9
chore(deps): bump github.com/anchore/syft from 1.34.2 to 1.36.0 (#4305)
dependabot[bot] Oct 23, 2025
eebcefb
docs: mark `zarf dev generate` as stable (#4310)
AustinAbro321 Oct 24, 2025
b4577cb
docs: mark `zarf dev deploy` as stable (#4311)
AustinAbro321 Oct 24, 2025
b2eec02
docs: differential packages (#4313)
AustinAbro321 Oct 24, 2025
9301c4d
docs: remove warnings that Flux and ArgoCD webhooks are not stable (#…
AustinAbro321 Oct 24, 2025
c2c71fa
chore(deps): bump the actions-organization group with 4 updates (#4315)
dependabot[bot] Oct 27, 2025
dd47be0
chore(deps): bump github/codeql-action from 4.30.9 to 4.31.0 (#4316)
dependabot[bot] Oct 27, 2025
fdd403f
fix: support remote valuesFiles (#4306)
michalszynkiewicz Oct 27, 2025
108b9f7
feat(helm): update FindAnnotatedImagesForChart to support dependencie…
brandtkeller Oct 27, 2025
2d11c7d
docs: mark differential as stable (#4312)
AustinAbro321 Oct 28, 2025
126ec7e
feat(values): package remove actions templating (#4267)
mkcp Oct 28, 2025
92c214d
chore(deps): bump github.com/fluxcd/source-controller/api from 1.7.2 …
dependabot[bot] Oct 29, 2025
f41393a
feat!: require opt into to include username and hostname in package …
robinlieb Oct 30, 2025
e719894
chore: allow backwards compatibility with empty chart version (#4314)
AustinAbro321 Oct 30, 2025
495b974
docs: encourage unit tests in contribute section (#4330)
AustinAbro321 Oct 30, 2025
e5ae7d5
fix(distribution): disable otel tracing by default (#4324)
brandtkeller Oct 30, 2025
1693cfb
feat(template): add pre-engine helm funcs (#4304)
mkcp Oct 30, 2025
c601815
fix: remove defaults prior to state check during re-init (#4333)
AustinAbro321 Oct 31, 2025
b6a6ec5
chore: expand the LogWriter implementation (#4318)
Racer159 Oct 31, 2025
a539919
chore(deps): bump github.com/fairwindsops/pluto/v5 from 5.22.5 to 5.2…
dependabot[bot] Nov 3, 2025
98e6e56
chore(deps): bump github.com/gabriel-vasile/mimetype from 1.4.10 to 1…
dependabot[bot] Nov 3, 2025
5cc4dee
fix(ci): switch to internal registry chart for external test (#4340)
brandtkeller Nov 3, 2025
d88ccab
chore(deps): bump github/codeql-action from 4.31.0 to 4.31.2 (#4336)
dependabot[bot] Nov 4, 2025
25c750b
feat: add support for kustomize plugins (#4285)
JeffResc Nov 4, 2025
3de9b22
chore(deps): bump sigs.k8s.io/controller-runtime from 0.22.3 to 0.22.…
dependabot[bot] Nov 4, 2025
60a8c92
chore(deps): bump github.com/anchore/stereoscope from 0.1.11 to 0.1.1…
dependabot[bot] Nov 4, 2025
5f2d892
chore(deps): bump github.com/anchore/syft from 1.36.0 to 1.37.0 (#4343)
dependabot[bot] Nov 4, 2025
42b558e
feat: add check version requirement (#4308)
AustinAbro321 Nov 5, 2025
8c80b10
feat!(sign): add package sign command (#4301)
brandtkeller Nov 5, 2025
e93e2bb
docs: update wordpress example and tutorial (#4326)
robinlieb Nov 6, 2025
7a5c43e
feat(verify): package verify command support (#4325)
brandtkeller Nov 6, 2025
03d12dc
fix(actions): make go-templates opt-in by default (#4344)
mkcp Nov 7, 2025
a5642d9
chore(deps): bump golangci/golangci-lint-action from 8.0.0 to 9.0.0 (…
dependabot[bot] Nov 11, 2025
efc3375
chore(deps): bump golang.org/x/sync from 0.17.0 to 0.18.0 in the gola…
dependabot[bot] Nov 11, 2025
4c3f76e
fix: publish unique images in the injector (#4349)
AustinAbro321 Nov 12, 2025
2a363df
chore(deps): bump the docker group across 1 directory with 2 updates …
dependabot[bot] Nov 12, 2025
944973b
docs: update custom init tutorial (#4358)
AustinAbro321 Nov 12, 2025
a5b99df
feat: add flag to update images in zarf.yaml (#4335)
robinlieb Nov 12, 2025
d8d66b1
chore(deps): bump the k8s group across 1 directory with 6 updates (#4…
dependabot[bot] Nov 13, 2025
5c4bd4b
chore(deps): replace containerd/selinux for vulnerabilities (#4363)
brandtkeller Nov 13, 2025
1bc75fe
refactor: remove init from src/cmd (#4365)
AustinAbro321 Nov 14, 2025
849896d
chore(deps): bump the golang group across 1 directory with 2 updates …
dependabot[bot] Nov 17, 2025
9357b32
chore(deps): bump github.com/docker/cli from 29.0.0+incompatible to 2…
dependabot[bot] Nov 17, 2025
cdd9429
ci: cleanup pre-installed tools more aggressively and always log clus…
AustinAbro321 Nov 17, 2025
ad97094
fix/docs(values/templating): fix and test values-templating example (…
mkcp Nov 18, 2025
09f5cba
chore(deps): update deps to remove replace directive (#4381)
brandtkeller Nov 18, 2025
fc0317e
feat!: allow setting static injector nodeport (#4382)
AustinAbro321 Nov 19, 2025
9523aa9
refactor: generate schema purely through go (#4385)
AustinAbro321 Nov 19, 2025
e1e3816
docs(examples): fix misleading comment in examples/values-templating …
mkcp Nov 19, 2025
d72f685
chore(deps): bump sigs.k8s.io/kustomize/api from 0.20.1 to 0.21.0 (#4…
dependabot[bot] Nov 20, 2025
546bf18
chore(deps): bump golang.org/x/crypto from 0.44.0 to 0.45.0 (#4389)
dependabot[bot] Nov 20, 2025
ad2a124
chore(deps): bump github.com/docker/cli from 29.0.1+incompatible to 2…
dependabot[bot] Nov 20, 2025
bbb4970
chore(deps): bump astro from 5.14.4 to 5.16.0 in /site (#4390)
dependabot[bot] Nov 20, 2025
2580e5f
fix: publish breaks when Zarf package name and existing directory nam…
ericwyles Nov 21, 2025
d50e629
Merge branch 'main' into main
ericwyles Nov 21, 2025
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
18 changes: 12 additions & 6 deletions src/pkg/zoci/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,16 @@ func (r *Remote) PushPackage(ctx context.Context, pkgLayout *layout.PackageLayou
opts.Retries = DefaultRetries
}

src, err := file.New("")
// Create a temporary directory for the OCI file store to avoid conflicts
// with directories in the current working directory that may have the same
// name as the package metadata (issue #4148)
tempDir, err := os.MkdirTemp("", "zarf-oci-push-*")
if err != nil {
return ocispec.Descriptor{}, fmt.Errorf("failed to create temp directory: %w", err)
}
defer os.RemoveAll(tempDir)

src, err := file.New(tempDir)
if err != nil {
return ocispec.Descriptor{}, err
}
Expand Down Expand Up @@ -105,11 +114,8 @@ func (r *Remote) PushPackage(ctx context.Context, pkgLayout *layout.PackageLayou
if packErr != nil {
return packErr
}
// Always remove the temp manifest file created by PackAndTagManifest
defer func() {
err2 := os.Remove(pkgLayout.Pkg.Metadata.Name)
err = errors.Join(err, err2)
}()
// Note: The manifest file created by PackAndTagManifest is in tempDir
// and will be cleaned up automatically when the function returns

// Update the total with manifest + config for better progress (optional)
attemptTotal := totalSize + root.Size + manifestConfigDesc.Size
Expand Down
93 changes: 93 additions & 0 deletions src/pkg/zoci/push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,20 @@
package zoci

import (
"os"
"path/filepath"
"testing"
"time"

"github.com/defenseunicorns/pkg/helpers/v2"
"github.com/defenseunicorns/pkg/oci"
"github.com/stretchr/testify/require"
"github.com/zarf-dev/zarf/src/api/v1alpha1"
"github.com/zarf-dev/zarf/src/pkg/lint"
"github.com/zarf-dev/zarf/src/pkg/packager/filters"
"github.com/zarf-dev/zarf/src/pkg/packager/layout"
"github.com/zarf-dev/zarf/src/test/testutil"
"oras.land/oras-go/v2/registry"
)

func TestAnnotationsFromMetadata(t *testing.T) {
Expand Down Expand Up @@ -39,3 +49,86 @@ func TestAnnotationsFromMetadata(t *testing.T) {
}
require.Equal(t, expectedAnnotations, annotations)
}

// TestPushPackageWithDirectoryNameCollision tests that publishing a package
// succeeds even when a directory with the same name as the package metadata
// exists in the current working directory (issue #4148).
func TestPushPackageWithDirectoryNameCollision(t *testing.T) {

lint.ZarfSchema = testutil.LoadSchema(t, "../../../zarf.schema.json")
ctx := testutil.TestContext(t)

// Setup destination registry
port, err := helpers.GetAvailablePort()
require.NoError(t, err)
registryURL := testutil.SetupInMemoryRegistry(ctx, t, port)
registryRef := registry.Reference{
Registry: registryURL,
Repository: "test-namespace",
}

// Create a minimal package layout in a temp directory
tmpdir := t.TempDir()
pkgDir := filepath.Join(tmpdir, "pkg")
err = os.MkdirAll(pkgDir, 0o755)
require.NoError(t, err)

// Create checksums.txt (empty is valid when there are no files to checksum)
err = os.WriteFile(filepath.Join(pkgDir, layout.Checksums), []byte(""), 0o644)
require.NoError(t, err)

// Calculate the SHA256 of the empty checksums.txt file
// Empty file SHA256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
emptyFileSHA256 := "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"

// Create a minimal zarf.yaml with the correct aggregateChecksum
zarfYAML := `kind: ZarfPackageConfig
metadata:
name: test-collision-pkg
version: 0.0.1
architecture: amd64
aggregateChecksum: "` + emptyFileSHA256 + `"
build:
timestamp: "` + time.Now().Format(v1alpha1.BuildTimestampFormat) + `"
components: []
`
err = os.WriteFile(filepath.Join(pkgDir, layout.ZarfYAML), []byte(zarfYAML), 0o644)
require.NoError(t, err)

// Load the package layout
pkgLayout, err := layout.LoadFromDir(ctx, pkgDir, layout.PackageLayoutOptions{
Filter: filters.Empty(),
})
require.NoError(t, err)

// Change to tmpdir to reproduce the issue
originalWd, err := os.Getwd()
require.NoError(t, err)
defer func() {
err := os.Chdir(originalWd)
require.NoError(t, err)
}()
err = os.Chdir(tmpdir)
require.NoError(t, err)

// Create a directory with the same name as the package metadata
// This is the condition that triggers issue #4148
collisionDirName := pkgLayout.Pkg.Metadata.Name
err = os.Mkdir(collisionDirName, 0o755)
require.NoError(t, err)

// Create a Remote instance
platform := oci.PlatformForArch(pkgLayout.Pkg.Build.Architecture)
remote, err := NewRemote(ctx, registryRef.String()+"/test-collision-pkg:0.0.1", platform, oci.WithPlainHTTP(true))
require.NoError(t, err)

// Try to push the package - this should succeed despite the directory name collision
opts := PublishOptions{
OCIConcurrency: 3,
Retries: 1,
}

// This should not fail with "failed to create file <pkg-name>: open <pkg-name>: is a directory"
_, err = remote.PushPackage(ctx, pkgLayout, opts)
require.NoError(t, err, "Publishing should succeed even when a directory with the package name exists")
}
1 change: 1 addition & 0 deletions src/pkg/zoci/testdata/simple-no-images/test-file.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is a test file for reproducing issue #4148
14 changes: 14 additions & 0 deletions src/pkg/zoci/testdata/simple-no-images/zarf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/zarf-dev/zarf/main/zarf.schema.json
kind: ZarfPackageConfig

metadata:
name: test-collision-pkg
version: 0.0.1
architecture: amd64

components:
- name: test-component
required: true
files:
- source: test-file.txt
target: /tmp/test-file.txt