Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Splitting cli release package #1399

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 3 additions & 2 deletions cli/pkg/kctrl/cmd/package/release/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
cmdapprelease "github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/cmd/app/release"
cmdcore "github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/cmd/core"
cmdpkg "github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/cmd/package"
"github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/cmd/package/release/schemagenerator"
"github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/local"
buildconfigs "github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/local/buildconfigs"
"github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/logger"
Expand Down Expand Up @@ -175,9 +176,9 @@ func generateValuesSchema(pkgBuild buildconfigs.PackageBuild) (*kcdatav1alpha1.V
templateStage := pkgBuild.Spec.Template.Spec.App.Spec.Template[0]
switch {
case templateStage.HelmTemplate != nil:
return NewHelmValuesSchemaGen(templateStage.HelmTemplate.Path).Schema()
return schemagenerator.NewHelmValuesSchemaGen(templateStage.HelmTemplate.Path).Schema()
case templateStage.Ytt != nil:
return NewValuesSchemaGen(templateStage.Ytt.Paths).Schema()
return schemagenerator.NewValuesSchemaGen(templateStage.Ytt.Paths).Schema()
}
}
return nil, nil
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 VMware, Inc.
// SPDX-License-Identifier: Apache-2.0

package release
package schemagenerator

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 VMware, Inc.
// SPDX-License-Identifier: Apache-2.0

package release_test
package schemagenerator_test

import (
"io/fs"
Expand All @@ -10,7 +10,7 @@ import (
"testing"

"github.com/stretchr/testify/require"
"github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/cmd/package/release"
"github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/cmd/package/release/schemagenerator"
"sigs.k8s.io/yaml"
)

Expand Down Expand Up @@ -225,7 +225,7 @@ type: object
fileName := "values.yaml"
err = os.WriteFile(filepath.Join(dirName, fileName), []byte(test.input), fs.ModePerm)
require.NoError(t, err)
valuesSchema, err := release.NewHelmValuesSchemaGen("tmp").Schema()
valuesSchema, err := schemagenerator.NewHelmValuesSchemaGen("tmp").Schema()
output, err := yaml.JSONToYAML(valuesSchema.OpenAPIv3.Raw)
require.NoError(t, err)
require.Equal(t, test.want, string(output), "Expected valuesSchema to match")
Expand All @@ -242,7 +242,7 @@ func TestHelmValuesSchemaGen_Schema_EmptyFile(t *testing.T) {
fileName := "values.yaml"
err = os.WriteFile(filepath.Join(dirName, fileName), []byte(""), fs.ModePerm)
require.NoError(t, err)
valuesSchema, err := release.NewHelmValuesSchemaGen("tmp").Schema()
valuesSchema, err := schemagenerator.NewHelmValuesSchemaGen("tmp").Schema()
require.NoError(t, err)
require.Equal(t, 0, len(valuesSchema.OpenAPIv3.Raw), "Expected valuesSchema.OpenAPIv3.Raw to be empty")
}
Expand All @@ -254,7 +254,7 @@ func TestHelmValuesSchemaGen_Schema_File_Not_Present(t *testing.T) {
dirName := "tmp"
err := os.Mkdir(dirName, fs.ModePerm)
require.NoError(t, err)
valuesSchema, err := release.NewHelmValuesSchemaGen("tmp").Schema()
valuesSchema, err := schemagenerator.NewHelmValuesSchemaGen("tmp").Schema()
require.NoError(t, err)
require.Equal(t, 0, len(valuesSchema.OpenAPIv3.Raw), "Expected valuesSchema.OpenAPIv3.Raw to be empty")
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 VMware, Inc.
// SPDX-License-Identifier: Apache-2.0

package release
package schemagenerator

import (
"bytes"
Expand Down
Loading