Skip to content

Commit

Permalink
fix: download artifacts for test workflow run (#5698)
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Sukhin <[email protected]>
  • Loading branch information
vsukhin authored and rangoo94 committed Aug 14, 2024
1 parent 7c90dfc commit de70edb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
20 changes: 16 additions & 4 deletions cmd/kubectl-testkube/commands/testworkflows/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/kubeshop/testkube/cmd/kubectl-testkube/commands/common"
"github.com/kubeshop/testkube/cmd/kubectl-testkube/commands/common/render"
"github.com/kubeshop/testkube/cmd/kubectl-testkube/commands/tests"
"github.com/kubeshop/testkube/cmd/kubectl-testkube/commands/testworkflows/renderer"
"github.com/kubeshop/testkube/cmd/testworkflow-init/instructions"
apiclientv1 "github.com/kubeshop/testkube/pkg/api/v1/client"
Expand All @@ -31,10 +32,14 @@ var (

func NewRunTestWorkflowCmd() *cobra.Command {
var (
executionName string
config map[string]string
watchEnabled bool
disableWebhooks bool
executionName string
config map[string]string
watchEnabled bool
disableWebhooks bool
downloadArtifactsEnabled bool
downloadDir string
format string
masks []string
)

cmd := &cobra.Command{
Expand Down Expand Up @@ -89,6 +94,9 @@ func NewRunTestWorkflowCmd() *cobra.Command {
if watchEnabled {
exitCode = uiWatch(execution, client)
ui.NL()
if downloadArtifactsEnabled {
tests.DownloadTestWorkflowArtifacts(execution.Id, downloadDir, format, masks, client, outputPretty)
}
} else {
uiShellWatchExecution(execution.Id)
}
Expand All @@ -105,6 +113,10 @@ func NewRunTestWorkflowCmd() *cobra.Command {
cmd.Flags().BoolVarP(&watchEnabled, "watch", "f", false, "watch for changes after start")
cmd.Flags().BoolVar(&disableWebhooks, "disable-webhooks", false, "disable webhooks for this execution")
cmd.Flags().MarkDeprecated("enable-webhooks", "enable-webhooks is deprecated")
cmd.Flags().StringVar(&downloadDir, "download-dir", "artifacts", "download dir")
cmd.Flags().BoolVarP(&downloadArtifactsEnabled, "download-artifacts", "d", false, "download artifacts automatically")
cmd.Flags().StringVar(&format, "format", "folder", "data format for storing files, one of folder|archive")
cmd.Flags().StringArrayVarP(&masks, "mask", "", []string{}, "regexp to filter downloaded files, single or comma separated, like report/.* or .*\\.json,.*\\.js$")

return cmd
}
Expand Down
4 changes: 4 additions & 0 deletions docs/docs/cli/testkube_run_testworkflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ testkube run testworkflow [name] [flags]
```
--config stringToString configuration variables in a form of name1=val1 passed to executor (default [])
--disable-webhooks disable webhooks for this execution
-d, --download-artifacts download artifacts automatically
--download-dir string download dir (default "artifacts")
--format string data format for storing files, one of folder|archive (default "folder")
-h, --help help for testworkflow
--mask stringArray regexp to filter downloaded files, single or comma separated, like report/.* or .*\.json,.*\.js$
-n, --name string execution name, if empty will be autogenerated
-f, --watch watch for changes after start
```
Expand Down

0 comments on commit de70edb

Please sign in to comment.