diff --git a/cmd/cmd.go b/cmd/cmd.go index 3412cb11..7cd2a5aa 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -32,6 +32,9 @@ func init() { Command.PersistentFlags().String("kubeconfig", kubeconfigDefault, "absolute path to the kubeconfig file") Command.PersistentFlags().StringP("namespace", "n", "", "the namespace scope for this CLI request") + Command.PersistentFlags().Bool("github-actions", false, "Enables GitHub Actions log output") + _ = Command.PersistentFlags().MarkHidden("github-actions") + Command.AddCommand( exec.Command, dump.Command, diff --git a/cmd/dump/dump.go b/cmd/dump/dump.go index 1751ca27..440c32c8 100644 --- a/cmd/dump/dump.go +++ b/cmd/dump/dump.go @@ -4,6 +4,7 @@ import ( "bufio" "bytes" "compress/gzip" + "fmt" "github.com/clevyr/kubedb/internal/database/sqlformat" "github.com/clevyr/kubedb/internal/kubernetes" "github.com/clevyr/kubedb/internal/postgres" @@ -111,6 +112,9 @@ func run(cmd *cobra.Command, args []string) (err error) { pr, pw := io.Pipe() log.Println("Dumping \"" + postgresPod.Name + "\" to \"" + filename + "\"") + if githubActions, _ := cmd.Flags().GetBool("github-actions"); githubActions { + fmt.Println("::set-output name=filename::" + filename) + } ch := make(chan error) go func() {