Skip to content

Commit

Permalink
Merge pull request #1399 from carvel-dev/break-release-package
Browse files Browse the repository at this point in the history
Splitting cli release package
  • Loading branch information
rohitagg2020 authored Nov 15, 2023
2 parents 934d244 + 1783efd commit b4886df
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
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

0 comments on commit b4886df

Please sign in to comment.