Commit bf02850d authored by SWE CI's avatar SWE CI

Merge branch 'release/v0.1.7'

parents fa684440 84901aec
Pipeline #29560 passed with stage
in 21 seconds
......@@ -15,6 +15,11 @@
package cmd
import (
"os"
"git.psu.edu/k8s/devtool/config"
"github.com/fatih/color"
"github.com/spf13/cobra"
)
......@@ -50,3 +55,17 @@ func init() {
// is called directly, e.g.:
// configCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}
func getCiConfiguration() config.Config {
conf, err := config.New(configFile)
if err != nil {
color.New(color.FgRed).Printf("WARN: configuration file: %s doesn't exist, using defaults\n", configFile)
conf.Name = os.Getenv("CI_PROJECT_NAME")
deployable := config.Deployable{
Name: os.Getenv("CI_PROJECT_NAME"),
}
conf.Deployables = []config.Deployable{deployable}
}
return conf
}
......@@ -32,13 +32,9 @@ var ciBuildCmd = &cobra.Command{
Use: "build",
Short: "build the application within the CI system",
RunE: func(cmd *cobra.Command, args []string) error {
conf, err := config.New(configFile)
if err != nil {
color.New(color.FgRed).Printf("Error reading configuration file: %s\n", configFile)
return err
}
conf := getCiConfiguration()
err = buildCiDocker(conf)
err := buildCiDocker(conf)
if err != nil {
color.Red("Failed to build docker image.")
return err
......
......@@ -28,13 +28,9 @@ var ciDeployCmd = &cobra.Command{
Use: "deploy",
Short: "deploy the application within the CI system",
RunE: func(cmd *cobra.Command, args []string) error {
conf, err := config.New(configFile)
if err != nil {
color.New(color.FgRed).Printf("Error reading configuration file: %s\n", configFile)
return err
}
conf := getCiConfiguration()
err = fluxDeployCi(conf)
err := fluxDeployCi(conf)
if err != nil {
color.Red("Failed to build docker image.")
return err
......
......@@ -175,7 +175,7 @@ var initCmd = &cobra.Command{
}
conf.LocalEnvVars = []string{"OAUTH_CLIENT_ID"}
conf.LocalEnvVars = []string{"OAUTH_CLIENT_SECRET", "OAUTH_JWK"}
conf.LocalSecrets = []string{"OAUTH_CLIENT_SECRET", "OAUTH_JWK"}
color.Yellow("Writing configuration")
......
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