Commit 4ef73073 authored by CRAIG BENNER's avatar CRAIG BENNER

adding option to push helm config into local env vars

parent 15a0601d
Pipeline #82827 failed with stages
in 28 seconds
......@@ -146,10 +146,8 @@ func build(config config.Config) error {
environment.RunRequired(true, "make", "build")
case "angular":
environment.RunRequired(true, "yarn", "build:prod")
case "dotnetcoreapi":
case "dotnetcore":
environment.RunRequired(true, "dotnet", "publish", "--configuration", "Release")
case "dotnetcorepackage":
environment.RunRequired(true, "dotnet", "build", "--configuration", "Release")
color.New(color.FgRed).Printf("devtool doesn't support the '%s' language yet.\n", lang)
return errors.New("Language not supported")
// Copyright © 2019 NAME HERE <EMAIL ADDRESS>
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// See the License for the specific language governing permissions and
// limitations under the License.
package cmd
import (
// localEnvCmd represents the build command
var localEnvCmd = &cobra.Command{
Use: "localEnv",
Short: "localEnv setup/teardown the application",
Run: func(cmd *cobra.Command, args []string) {
conf, err := config.New(configFile)
if err != nil {
color.New(color.FgRed).Printf("Error reading configuration file: %s\n", configFile)
func init() {
// Here you will define your flags and configuration settings.
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// buildCmd.PersistentFlags().String("foo", "", "A help for foo")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// buildCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
localEnvCmd.Flags().Bool("setup", false, "Put all ConfigMaps Into local Environment variables")
viper.SetDefault("setup", false)
err := viper.BindPFlag("setup", buildCmd.Flags().Lookup("localEnv-setup"))
if err != nil {
panic("invalid arg")
localEnvCmd.Flags().Bool("teardown", false, "Remove all ConfigMaps Into local Environment variables")
viper.SetDefault("teardown", false)
err = viper.BindPFlag("teardown", buildCmd.Flags().Lookup("localEnv-teardown"))
if err != nil {
panic("invalid arg")
func localEnv(config config.Config) error {
dep, err := promptForLocalEnv(config)
if err != nil {
return err
if viper.GetBool("setup") {
color.Blue("LocalEnv Setup.")
} else if viper.GetBool("teardown") {
color.Blue("LocalEnv Teardown.")
} else {
color.Yellow("Missing Argument")
panic("invalid arg")
return nil
func promptForLocalEnv(conf config.Config) (*config.Deployable, error) {
var promptItems []string
for _, deployable := range conf.Deployables {
promptItems = append(promptItems, deployable.Name)
promptSelect := promptui.Select{
Label: "Which Deployable?",
Items: promptItems,
response, responseString, err := promptSelect.Run()
if err != nil {
return nil, err
color.Blue("You choose :: " + responseString)
return &conf.Deployables[response], nil
func setupEnvVars(*config.Deployable) {}
func teardownEnvVars(*config.Deployable) {}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment