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

feat: make local use tagged templates #714

Merged
merged 1 commit into from
Nov 11, 2022
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
10 changes: 7 additions & 3 deletions cmd/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ var (
useTelemetry bool
dryRun bool
silentMode bool
enableConsole bool
gitOpsBranch string
gitOpsRepo string
awsHostedZone string
metaphorBranch string
adminEmail string
enableConsole bool
templateTag string
)

func NewCommand() *cobra.Command {
Expand All @@ -56,13 +57,16 @@ func NewCommand() *cobra.Command {
localCmd.Flags().BoolVar(&useTelemetry, "use-telemetry", true, "installer will not send telemetry about this installation")
localCmd.Flags().BoolVar(&dryRun, "dry-run", false, "set to dry-run mode, no changes done on cloud provider selected")
localCmd.Flags().BoolVar(&silentMode, "silent", false, "enable silentMode mode will make the UI return less content to the screen")
localCmd.Flags().BoolVar(&enableConsole, "enable-console", true, "If hand-off screen will be presented on a browser UI")

// todo: get it from GH token , use it for console
localCmd.Flags().StringVar(&adminEmail, "admin-email", "", "the email address for the administrator as well as for lets-encrypt certificate emails")

localCmd.Flags().StringVar(&metaphorBranch, "metaphor-branch", "main", "metaphor application branch")
localCmd.Flags().StringVar(&gitOpsBranch, "gitops-branch", "main", "version/branch used on git clone")
localCmd.Flags().StringVar(&gitOpsRepo, "gitops-repo", "gitops", "")
localCmd.Flags().BoolVar(&enableConsole, "enable-console", true, "If hand-off screen will be presented on a browser UI")
localCmd.Flags().StringVar(&templateTag, "template-tag", "",
"when running a built version, and ldflag is set for the Kubefirst version, it will use this tag value to clone the templates (gitops and metaphor's)",
)

localCmd.AddCommand(NewCommandConnect())

Expand Down
13 changes: 13 additions & 0 deletions cmd/local/prerun.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,19 @@ func validateLocal(cmd *cobra.Command, args []string) error {
)
}

// if non-development/built/released version, set template tag version to clone tagged templates, in that way
// the current built version, uses the same template version.
// example: kubefirst version 1.10.3, has template repositories (gitops and metaphor's) tags set as 1.10.3
// when Kubefirst download the templates, it will download the tag version that matches Kubefirst version
if configs.K1Version != configs.DefaultK1Version {
log.Println("loading tag values for built version")
log.Printf("Kubefirst version %q, tags %q", configs.K1Version, config.K3dVersion)
// in order to make the fallback tags work, set gitops branch as empty
gitOpsBranch = ""
templateTag = configs.K1Version
viper.Set("template.tag", templateTag)
}

// set default values to kubefirst file
viper.Set("gitops.repo", gitOpsRepo)
viper.Set("gitops.owner", "kubefirst")
Expand Down
4 changes: 3 additions & 1 deletion configs/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ This is an initial implementation of Config. Please keep in mind we're still wor
environment variables and general config data.
*/

const DefaultK1Version = "development"

// K1Version is used on version command. The value is dynamically updated on build time via ldflag. Built Kubefirst
// versions will follow semver value like 1.9.0, when not using the built version, "development" is used.
var K1Version = "development"
var K1Version = DefaultK1Version

// Config host application configuration
// todo: some of these values can be moved to the .env
Expand Down