Skip to content

Commit

Permalink
fix: add support for jx boot --helmfile
Browse files Browse the repository at this point in the history
so folks can try out helmfile and helm 3

Signed-off-by: James Strachan <[email protected]>
  • Loading branch information
jstrachan committed Jan 31, 2020
1 parent f5f4863 commit bf1e2d8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
25 changes: 23 additions & 2 deletions pkg/cmd/boot/boot.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"path/filepath"

"github.com/google/uuid"
"github.com/jenkins-x/jx/pkg/cloud"

"github.com/jenkins-x/jx/pkg/versionstream"

Expand Down Expand Up @@ -50,8 +51,11 @@ type BootOptions struct {

AttemptRestore bool

// UpgradeGit if we want to automatically upgrade this boot clone if there have been changes since the current clone
// NoUpgradeGit if we want to automatically upgrade this boot clone if there have been changes since the current clone
NoUpgradeGit bool

// Helmfile to enable helmfile and helm 3 support
Helmfile bool
}

var (
Expand Down Expand Up @@ -105,6 +109,7 @@ func NewCmdBoot(commonOpts *opts.CommonOptions) *cobra.Command {
cmd.Flags().StringVarP(&options.RequirementsFile, "requirements", "r", "", "requirements file which will overwrite the default requirements file")
cmd.Flags().BoolVarP(&options.AttemptRestore, "attempt-restore", "a", false, "attempt to boot from an existing dev environment repository")
cmd.Flags().BoolVarP(&options.NoUpgradeGit, "no-update-git", "", false, "disables any attempt to update the local git clone if its old")
cmd.Flags().BoolVarP(&options.Helmfile, "helmfile", "", false, "enables helmfile and helm 3 support. Note this is currently experimental. See: https://github.com/jenkins-x/enhancements/tree/master/proposals/2/docs")

return cmd
}
Expand Down Expand Up @@ -141,6 +146,9 @@ func (o *BootOptions) Run() error {
if err != nil {
log.Logger().Info("Creating boot config with defaults, as not in an existing boot directory with a git repository.")
gitURL = config.DefaultBootRepository
if o.Helmfile {
gitURL = config.DefaultBootHelmfileRepository
}
gitRef = config.DefaultVersionsRef
}

Expand Down Expand Up @@ -560,7 +568,20 @@ func (o *BootOptions) defaultVersionStream(requirements *config.RequirementsConf
func (o *BootOptions) verifyRequirements(requirements *config.RequirementsConfig, requirementsFile string) error {
provider := requirements.Cluster.Provider
if provider == "" {
return config.MissingRequirement("provider", requirementsFile)
if o.BatchMode {
return config.MissingRequirement("provider", requirementsFile)
}

var err error
requirements.Cluster.Provider, err = util.PickNameWithDefault(cloud.KubernetesProviders, "Select Kubernetes provider", cloud.GKE, "the type of Kubernetes installation", o.GetIOFileHandles())
if err != nil {
return errors.Wrap(err, "selecting Kubernetes provider")
}
err = requirements.SaveConfig(requirementsFile)
if err != nil {
return err
}
log.Logger().Infof("saved requirements file %s", requirementsFile)
}
if requirements.Cluster.Namespace == "" {
return config.MissingRequirement("namespace", requirementsFile)
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/install_requirements.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ var (
DefaultVersionsRef = "master"
// DefaultBootRepository default git repo for boot
DefaultBootRepository = "https://github.com/jenkins-x/jenkins-x-boot-config.git"
// DefaultBootHelmfileRepository default git repo for boot with helmfile
DefaultBootHelmfileRepository = "https://github.com/jenkins-x/jenkins-x-boot-helmfile-config.git"
// LatestVersionStringsBucket optional bucket name to search in for latest version strings
LatestVersionStringsBucket = ""
// BinaryDownloadBaseURL the base URL for downloading the binary from - will always have "VERSION/jx-OS-ARCH.EXTENSION" appended to it when used
Expand Down

0 comments on commit bf1e2d8

Please sign in to comment.