Skip to content

Commit

Permalink
Ensure that default version is valid semver. Add error check in case …
Browse files Browse the repository at this point in the history
…of malformed package-build (#834)
  • Loading branch information
100mik authored Aug 18, 2022
1 parent 7354341 commit ae4bff9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cli/pkg/kctrl/cmd/package/release/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func NewReleaseCmd(o *ReleaseOptions) *cobra.Command {

func (o *ReleaseOptions) Run() error {
if o.pkgVersion == "" {
o.pkgVersion = fmt.Sprintf("build-%d", time.Now().Unix())
o.pkgVersion = fmt.Sprintf(defaultVersion, time.Now().Unix())
}

if o.chdir != "" {
Expand Down Expand Up @@ -99,9 +99,13 @@ func (o *ReleaseOptions) Run() error {
}
}

buildAppSpec := pkgBuild.GetAppSpec()
if buildAppSpec == nil {
return fmt.Errorf("Releasing package: `kctrl pkg init` was not run successfully. (hint: re-run the `init` command)")
}
builderOpts := cmdapprelease.AppSpecBuilderOpts{
BuildTemplate: pkgBuild.GetAppSpec().Template,
BuildDeploy: pkgBuild.GetAppSpec().Deploy,
BuildTemplate: buildAppSpec.Template,
BuildDeploy: buildAppSpec.Deploy,
BuildExport: *pkgBuild.GetExport(),
Debug: o.debug,
}
Expand Down

0 comments on commit ae4bff9

Please sign in to comment.