Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [TKC-2312] download artifacts for test workflow run #5698

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading