niveau0 2 days ago committed by GitHub
commit 7996e638b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -169,6 +169,12 @@ spec:
resultFile: "./testdata/build-kustomization/podinfo-with-my-app-result.yaml",
assertFunc: "assertGoldenTemplateFile",
},
{
name: "build with recursive in dry-run mode",
args: "build kustomization podinfo --kustomization-file " + tmpFile + " --path ./testdata/build-kustomization/podinfo-with-my-app --recursive --local-sources GitRepository/default/podinfo=./testdata/build-kustomization --dry-run",
resultFile: "./testdata/build-kustomization/podinfo-with-my-app-result.yaml",
assertFunc: "assertGoldenTemplateFile",
},
}
tmpl := map[string]string{

@ -258,7 +258,7 @@ func NewBuilder(name, resources string, opts ...BuilderOptionFunc) (*Builder, er
b.timeout = defaultTimeout
}
if b.dryRun && b.kustomizationFile == "" {
if b.dryRun && b.kustomizationFile == "" && b.kustomization == nil {
return nil, fmt.Errorf("kustomization file is required for dry-run")
}
@ -355,7 +355,9 @@ func (b *Builder) build() (m resmap.ResMap, err error) {
// Get the kustomization object
liveKus := &kustomizev1.Kustomization{}
if !b.dryRun {
if b.dryRun {
liveKus = b.kustomization
} else {
liveKus, err = b.getKustomization(ctx)
if err != nil {
if !apierrors.IsNotFound(err) || b.kustomization == nil {
@ -365,6 +367,7 @@ func (b *Builder) build() (m resmap.ResMap, err error) {
liveKus = b.kustomization
}
}
k, err := b.resolveKustomization(liveKus)
if err != nil {
err = fmt.Errorf("failed to get kustomization object: %w", err)
@ -432,6 +435,7 @@ func (b *Builder) kustomizationBuild(k *kustomizev1.Kustomization) ([]*unstructu
WithStrictSubstitute(b.strictSubst),
WithRecursive(b.recursive),
WithLocalSources(b.localSources),
WithDryRun(b.dryRun),
)
if err != nil {
return nil, err

Loading…
Cancel
Save