From fd5eb5ecbafb91863969f33cb505772de8f0ca43 Mon Sep 17 00:00:00 2001 From: Gabe Cook Date: Tue, 7 Dec 2021 17:04:40 -0600 Subject: [PATCH] :loud_sound: Add GitHub Actions logging support --- cmd/cmd.go | 3 +++ cmd/dump/dump.go | 4 ++++ 2 files changed, 7 insertions(+) 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() {