Feat cronjob #23

Merged
metal3d merged 28 commits from feat-cronjob into master 2022-06-10 14:15:18 +00:00
Showing only changes of commit e5d4ed1df5 - Show all commits

View File

@@ -5,6 +5,7 @@ import (
"katenary/generator/writers" "katenary/generator/writers"
"katenary/helm" "katenary/helm"
"katenary/update" "katenary/update"
"log"
"strconv" "strconv"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@@ -50,6 +51,7 @@ func main() {
} }
// convert command, need some flags // convert command, need some flags
var composeFiles *[]string
convertCmd := &cobra.Command{ convertCmd := &cobra.Command{
Use: "convert", Use: "convert",
Short: "Convert docker-compose to helm chart", Short: "Convert docker-compose to helm chart",
@@ -61,8 +63,6 @@ func main() {
"- if it's not defined, so the 0.0.1 version is used", "- if it's not defined, so the 0.0.1 version is used",
Run: func(c *cobra.Command, args []string) { Run: func(c *cobra.Command, args []string) {
force := c.Flag("force").Changed force := c.Flag("force").Changed
composeFile := c.Flags().StringArrayP("compose-file", "c", []string{}, "compose file to convert, can be use several times to override previous file (default: docker-compose.yml)")
// TODO: is there a way to get typed values from cobra?
appversion := c.Flag("app-version").Value.String() appversion := c.Flag("app-version").Value.String()
appName := c.Flag("app-name").Value.String() appName := c.Flag("app-name").Value.String()
chartVersion := c.Flag("chart-version").Value.String() chartVersion := c.Flag("chart-version").Value.String()
@@ -71,17 +71,18 @@ func main() {
if err != nil { if err != nil {
writers.IndentSize = indentation writers.IndentSize = indentation
} }
Convert(*composeFile, appversion, appName, chartDir, chartVersion, force) log.Println(composeFiles)
Convert(*composeFiles, appversion, appName, chartDir, chartVersion, force)
}, },
} }
composeFiles = convertCmd.Flags().StringArrayP(
"compose-file", "c", []string{ComposeFile}, "compose file to convert, can be use several times to override previous file. Order is important!")
convertCmd.Flags().BoolP( convertCmd.Flags().BoolP(
"force", "f", false, "force overwrite of existing output files") "force", "f", false, "force overwrite of existing output files")
convertCmd.Flags().StringP( convertCmd.Flags().StringP(
"app-version", "a", AppVersion, "app version") "app-version", "a", AppVersion, "app version")
convertCmd.Flags().StringP( convertCmd.Flags().StringP(
"chart-version", "v", ChartVersion, "chart version") "chart-version", "v", ChartVersion, "chart version")
convertCmd.Flags().StringP(
"compose-file", "c", ComposeFile, "docker compose file")
convertCmd.Flags().StringP( convertCmd.Flags().StringP(
"app-name", "n", AppName, "application name") "app-name", "n", AppName, "application name")
convertCmd.Flags().StringP( convertCmd.Flags().StringP(