Skip to content

Commit b4886df

Browse files
authored
Merge pull request #1399 from carvel-dev/break-release-package
Splitting cli release package
2 parents 934d244 + 1783efd commit b4886df

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

cli/pkg/kctrl/cmd/package/release/release.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
cmdapprelease "github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/cmd/app/release"
1515
cmdcore "github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/cmd/core"
1616
cmdpkg "github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/cmd/package"
17+
"github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/cmd/package/release/schemagenerator"
1718
"github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/local"
1819
buildconfigs "github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/local/buildconfigs"
1920
"github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/logger"
@@ -175,9 +176,9 @@ func generateValuesSchema(pkgBuild buildconfigs.PackageBuild) (*kcdatav1alpha1.V
175176
templateStage := pkgBuild.Spec.Template.Spec.App.Spec.Template[0]
176177
switch {
177178
case templateStage.HelmTemplate != nil:
178-
return NewHelmValuesSchemaGen(templateStage.HelmTemplate.Path).Schema()
179+
return schemagenerator.NewHelmValuesSchemaGen(templateStage.HelmTemplate.Path).Schema()
179180
case templateStage.Ytt != nil:
180-
return NewValuesSchemaGen(templateStage.Ytt.Paths).Schema()
181+
return schemagenerator.NewValuesSchemaGen(templateStage.Ytt.Paths).Schema()
181182
}
182183
}
183184
return nil, nil

cli/pkg/kctrl/cmd/package/release/helm_openapi_schema_gen.go renamed to cli/pkg/kctrl/cmd/package/release/schemagenerator/helm_openapi_schema_gen.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2022 VMware, Inc.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
package release
4+
package schemagenerator
55

66
import (
77
"fmt"

cli/pkg/kctrl/cmd/package/release/helm_openapi_schema_gen_test.go renamed to cli/pkg/kctrl/cmd/package/release/schemagenerator/helm_openapi_schema_gen_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2022 VMware, Inc.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
package release_test
4+
package schemagenerator_test
55

66
import (
77
"io/fs"
@@ -10,7 +10,7 @@ import (
1010
"testing"
1111

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

@@ -225,7 +225,7 @@ type: object
225225
fileName := "values.yaml"
226226
err = os.WriteFile(filepath.Join(dirName, fileName), []byte(test.input), fs.ModePerm)
227227
require.NoError(t, err)
228-
valuesSchema, err := release.NewHelmValuesSchemaGen("tmp").Schema()
228+
valuesSchema, err := schemagenerator.NewHelmValuesSchemaGen("tmp").Schema()
229229
output, err := yaml.JSONToYAML(valuesSchema.OpenAPIv3.Raw)
230230
require.NoError(t, err)
231231
require.Equal(t, test.want, string(output), "Expected valuesSchema to match")
@@ -242,7 +242,7 @@ func TestHelmValuesSchemaGen_Schema_EmptyFile(t *testing.T) {
242242
fileName := "values.yaml"
243243
err = os.WriteFile(filepath.Join(dirName, fileName), []byte(""), fs.ModePerm)
244244
require.NoError(t, err)
245-
valuesSchema, err := release.NewHelmValuesSchemaGen("tmp").Schema()
245+
valuesSchema, err := schemagenerator.NewHelmValuesSchemaGen("tmp").Schema()
246246
require.NoError(t, err)
247247
require.Equal(t, 0, len(valuesSchema.OpenAPIv3.Raw), "Expected valuesSchema.OpenAPIv3.Raw to be empty")
248248
}
@@ -254,7 +254,7 @@ func TestHelmValuesSchemaGen_Schema_File_Not_Present(t *testing.T) {
254254
dirName := "tmp"
255255
err := os.Mkdir(dirName, fs.ModePerm)
256256
require.NoError(t, err)
257-
valuesSchema, err := release.NewHelmValuesSchemaGen("tmp").Schema()
257+
valuesSchema, err := schemagenerator.NewHelmValuesSchemaGen("tmp").Schema()
258258
require.NoError(t, err)
259259
require.Equal(t, 0, len(valuesSchema.OpenAPIv3.Raw), "Expected valuesSchema.OpenAPIv3.Raw to be empty")
260260
}

cli/pkg/kctrl/cmd/package/release/openapi_schema_gen.go renamed to cli/pkg/kctrl/cmd/package/release/schemagenerator/openapi_schema_gen.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2022 VMware, Inc.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
package release
4+
package schemagenerator
55

66
import (
77
"bytes"

0 commit comments

Comments
 (0)