Compare commits
4 commits
537e780188
...
8424fecce3
Author | SHA1 | Date | |
---|---|---|---|
8424fecce3 | |||
f9018dd392 | |||
0c7af69087 | |||
066f8d764e |
4 changed files with 24 additions and 2 deletions
|
@ -8,6 +8,9 @@ steps:
|
||||||
password:
|
password:
|
||||||
from_secret: REGISTRY_PASS
|
from_secret: REGISTRY_PASS
|
||||||
repo: git.ar21.de/yolokube/grafana-backuper
|
repo: git.ar21.de/yolokube/grafana-backuper
|
||||||
|
platforms:
|
||||||
|
- linux/amd64
|
||||||
|
- linux/arm64
|
||||||
tags:
|
tags:
|
||||||
- latest
|
- latest
|
||||||
- ${CI_PIPELINE_NUMBER}
|
- ${CI_PIPELINE_NUMBER}
|
||||||
|
@ -23,6 +26,9 @@ steps:
|
||||||
password:
|
password:
|
||||||
from_secret: REGISTRY_PASS
|
from_secret: REGISTRY_PASS
|
||||||
repo: git.ar21.de/yolokube/grafana-backuper
|
repo: git.ar21.de/yolokube/grafana-backuper
|
||||||
|
platforms:
|
||||||
|
- linux/amd64
|
||||||
|
- linux/arm64
|
||||||
tags:
|
tags:
|
||||||
- staging
|
- staging
|
||||||
- staging-${CI_PIPELINE_NUMBER}
|
- staging-${CI_PIPELINE_NUMBER}
|
||||||
|
|
|
@ -36,8 +36,6 @@ func NewBackupCommand(c *config.Config) *cobra.Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
backupCmd.PersistentFlags().BoolVar(&c.ForceCommits, "force", false, "Force git commits / ignore existence check")
|
backupCmd.PersistentFlags().BoolVar(&c.ForceCommits, "force", false, "Force git commits / ignore existence check")
|
||||||
backupCmd.PersistentFlags().StringVar(&c.GitEmail, "git-email", "", "Git email address")
|
|
||||||
backupCmd.PersistentFlags().StringVar(&c.GPGKey, "signing-key", "", "Path to the GPG signing key")
|
|
||||||
|
|
||||||
return backupCmd
|
return backupCmd
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,20 @@ func NewRootCommand(c *config.Config) *cobra.Command {
|
||||||
Short: "Grafana Backuper CLI",
|
Short: "Grafana Backuper CLI",
|
||||||
Long: "A command-line tool to back up and restore Grafana dashboards",
|
Long: "A command-line tool to back up and restore Grafana dashboards",
|
||||||
Version: version.Version(),
|
Version: version.Version(),
|
||||||
|
RunE: func(cmd *cobra.Command, _ []string) error {
|
||||||
|
if len(c.Sequence) == 0 {
|
||||||
|
return cmd.Help()
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, command := range c.Sequence {
|
||||||
|
cmd.SetArgs([]string{command})
|
||||||
|
if err := cmd.Execute(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
PersistentPreRun: func(cmd *cobra.Command, _ []string) {
|
PersistentPreRun: func(cmd *cobra.Command, _ []string) {
|
||||||
initializeConfig(cmd)
|
initializeConfig(cmd)
|
||||||
|
|
||||||
|
@ -56,6 +70,9 @@ func NewRootCommand(c *config.Config) *cobra.Command {
|
||||||
rootCmd.PersistentFlags().StringVar(&c.GitRepo, "git-repo", "", "Complete Git repository URL")
|
rootCmd.PersistentFlags().StringVar(&c.GitRepo, "git-repo", "", "Complete Git repository URL")
|
||||||
rootCmd.PersistentFlags().StringVar(&c.GitUser, "git-user", "", "Git user name")
|
rootCmd.PersistentFlags().StringVar(&c.GitUser, "git-user", "", "Git user name")
|
||||||
rootCmd.PersistentFlags().StringVar(&c.GitPass, "git-pass", "", "Git user password")
|
rootCmd.PersistentFlags().StringVar(&c.GitPass, "git-pass", "", "Git user password")
|
||||||
|
rootCmd.PersistentFlags().StringVar(&c.GitEmail, "git-email", "", "Git email address")
|
||||||
|
rootCmd.PersistentFlags().StringVar(&c.GPGKey, "signing-key", "", "Path to the GPG signing key")
|
||||||
|
rootCmd.Flags().StringArrayVar(&c.Sequence, "sequence", nil, "Command sequence to execute multiple functions")
|
||||||
|
|
||||||
return rootCmd
|
return rootCmd
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ type Config struct {
|
||||||
GitPass string
|
GitPass string
|
||||||
GPGKey string
|
GPGKey string
|
||||||
Quiet bool
|
Quiet bool
|
||||||
|
Sequence []string
|
||||||
|
|
||||||
Output io.Writer
|
Output io.Writer
|
||||||
Logger zerolog.Logger
|
Logger zerolog.Logger
|
||||||
|
|
Loading…
Add table
Reference in a new issue