Skip to content

Commit

Permalink
refactor: normal creator
Browse files Browse the repository at this point in the history
Signed-off-by: Philip Laine <[email protected]>
  • Loading branch information
phillebaba committed Jan 9, 2025
1 parent 4cec60d commit 8df4a70
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/manifests/zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ components:
kustomizations:
# kustomizations can be specified relative to the `zarf.yaml` or as remoteBuild resources with the
# following syntax: https://github.com/kubernetes-sigs/kustomize/blob/master/examples/remoteBuild.md:
- https://github.com/stefanprodan/podinfo//kustomize?ref=6.4.0
- https://github.com/stefanprodan/podinfo/kustomize?ref=6.4.0
# while ?ref= is not a requirement, it is recommended to use a specific commit hash / git tag to
# ensure that the kustomization is not changed in a way that breaks your deployment.
# image discovery is supported in all manifests and charts using:
Expand Down
4 changes: 3 additions & 1 deletion src/internal/packager2/layout/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"
"errors"
"fmt"
"maps"
"os"
"path/filepath"
"slices"
Expand Down Expand Up @@ -48,8 +49,9 @@ func resolveImports(ctx context.Context, pkg v1alpha1.ZarfPackage, packagePath,
importPath := filepath.Join(packagePath, component.Import.Path)
importKey := fmt.Sprintf("%s-%s", component.Name, importPath)
if _, ok := seenImports[importKey]; ok {
return v1alpha1.ZarfPackage{}, fmt.Errorf("package %s imported in cycle by %s", filepath.ToSlash(importPath), filepath.ToSlash(packagePath))
return v1alpha1.ZarfPackage{}, fmt.Errorf("package %s imported in cycle by %s in component %s", filepath.ToSlash(importPath), filepath.ToSlash(packagePath), component.Name)
}
seenImports = maps.Clone(seenImports)
seenImports[importKey] = nil
b, err := os.ReadFile(filepath.Join(importPath, layout.ZarfYAML))
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion src/internal/packager2/layout/import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestResolveImportsCircular(t *testing.T) {
require.NoError(t, err)

_, err = resolveImports(ctx, pkg, "./testdata/import/first", "", "", map[string]interface{}{})
require.EqualError(t, err, "package testdata/import/second imported in cycle by testdata/import/third")
require.EqualError(t, err, "package testdata/import/second imported in cycle by testdata/import/third in component component")
}

func TestValidateComponentCompose(t *testing.T) {
Expand Down

0 comments on commit 8df4a70

Please sign in to comment.