Skip to content

Commit

Permalink
fix: relative paths for bundle create (#453)
Browse files Browse the repository at this point in the history
Co-authored-by: UncleGedd <42304551+UncleGedd@users.noreply.github.com>
  • Loading branch information
decleaver and UncleGedd authored Feb 22, 2024
1 parent d764462 commit 1638bdc
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 9 deletions.
5 changes: 5 additions & 0 deletions src/pkg/bundle/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ func (b *Bundle) ValidateBundleResources(bundle *types.UDSBundle, spinner *messa

// validate access to packages as well as components referenced in the package
for idx, pkg := range bundle.Packages {
// if package path is set, make it relative to source directory
if pkg.Path != "" {
pkg.Path = filepath.Join(b.cfg.CreateOpts.SourceDirectory, pkg.Path)
}

spinner.Updatef("Validating Bundle Package: %s", pkg.Name)
if pkg.Name == "" {
return fmt.Errorf("%s is missing required field: name", pkg)
Expand Down
2 changes: 1 addition & 1 deletion src/test/bundles/03-local-and-remote/uds-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ packages:
repository: ghcr.io/defenseunicorns/uds-cli/nginx
ref: 0.0.1
- name: podinfo
path: "src/test/packages/podinfo"
path: "../../packages/podinfo"
ref: 0.0.1
2 changes: 1 addition & 1 deletion src/test/bundles/04-init/uds-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ metadata:
# cannot do uds remove on this pkg due to having the same name
packages:
- name: init
path: "src/test/packages"
path: "../../packages"
# renovate: datasource=github-tags depName=defenseunicorns/zarf
ref: v0.32.3
optionalComponents:
Expand Down
2 changes: 1 addition & 1 deletion src/test/bundles/05-gitrepo/uds-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ metadata:

packages:
- name: gitrepo
path: "src/test/packages/gitrepo"
path: "../../packages/gitrepo"
ref: 0.0.1
2 changes: 1 addition & 1 deletion src/test/bundles/07-helm-overrides/uds-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:

packages:
- name: helm-overrides
path: "src/test/packages/helm"
path: "../../packages/helm"
ref: 0.0.1

overrides:
Expand Down
4 changes: 2 additions & 2 deletions src/test/bundles/08-var-precedence/uds-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:

packages:
- name: helm-overrides
path: "src/test/packages/helm"
path: "../../packages/helm"
ref: 0.0.1
overrides:
podinfo-component:
Expand All @@ -22,5 +22,5 @@ packages:
default: "uds.dev"

- name: output-var
path: "src/test/packages/no-cluster/output-var"
path: "../../packages/no-cluster/output-var"
ref: 0.0.1
2 changes: 1 addition & 1 deletion src/test/bundles/09-uds-bundle-yml/uds-bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ metadata:

packages:
- name: nginx
path: "src/test/packages/nginx"
path: "../../packages/nginx"
ref: 0.0.1
2 changes: 1 addition & 1 deletion src/test/bundles/11-real-simple/uds-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ metadata:

packages:
- name: real-simple
path: "src/test/packages/no-cluster/real-simple"
path: "../../packages/no-cluster/real-simple"
ref: 0.0.1
2 changes: 1 addition & 1 deletion src/test/bundles/12-exported-pkg-vars/uds-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ packages:
- name: BOOL

- name: helm-overrides
path: "src/test/packages/helm"
path: "../../packages/helm"
ref: 0.0.1
imports:
- name: COLOR
Expand Down

0 comments on commit 1638bdc

Please sign in to comment.