Skip to content
Snippets Groups Projects
Commit bf02850d authored by SWE CI's avatar SWE CI
Browse files

Merge branch 'release/v0.1.7'

parents fa684440 84901aec
No related branches found
Tags v0.1.7
No related merge requests found
Pipeline #29560 passed
...@@ -15,6 +15,11 @@ ...@@ -15,6 +15,11 @@
package cmd package cmd
import ( import (
"os"
"git.psu.edu/k8s/devtool/config"
"github.com/fatih/color"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
...@@ -50,3 +55,17 @@ func init() { ...@@ -50,3 +55,17 @@ func init() {
// is called directly, e.g.: // is called directly, e.g.:
// configCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") // 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{ ...@@ -32,13 +32,9 @@ var ciBuildCmd = &cobra.Command{
Use: "build", Use: "build",
Short: "build the application within the CI system", Short: "build the application within the CI system",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
conf, err := config.New(configFile) conf := getCiConfiguration()
if err != nil {
color.New(color.FgRed).Printf("Error reading configuration file: %s\n", configFile)
return err
}
err = buildCiDocker(conf) err := buildCiDocker(conf)
if err != nil { if err != nil {
color.Red("Failed to build docker image.") color.Red("Failed to build docker image.")
return err return err
......
...@@ -28,13 +28,9 @@ var ciDeployCmd = &cobra.Command{ ...@@ -28,13 +28,9 @@ var ciDeployCmd = &cobra.Command{
Use: "deploy", Use: "deploy",
Short: "deploy the application within the CI system", Short: "deploy the application within the CI system",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
conf, err := config.New(configFile) conf := getCiConfiguration()
if err != nil {
color.New(color.FgRed).Printf("Error reading configuration file: %s\n", configFile)
return err
}
err = fluxDeployCi(conf) err := fluxDeployCi(conf)
if err != nil { if err != nil {
color.Red("Failed to build docker image.") color.Red("Failed to build docker image.")
return err return err
......
...@@ -175,7 +175,7 @@ var initCmd = &cobra.Command{ ...@@ -175,7 +175,7 @@ var initCmd = &cobra.Command{
} }
conf.LocalEnvVars = []string{"OAUTH_CLIENT_ID"} 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") color.Yellow("Writing configuration")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment