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

feat: Release/v2.0.11 #5677

Merged
merged 21 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
492446e
feat: [TKC-2194] improve workflow execution telemetry (#5648)
povilasv Jul 10, 2024
40e4ee9
TKC-2161: skip tls verification when saving logs if STORAGE_SKIP_VERI…
dejanzele Jul 10, 2024
b7f8118
build(deps): bump anchore/sbom-action from 0.16.0 to 0.16.1 (#5649)
dependabot[bot] Jul 10, 2024
1443737
feat(performance): improve Log Processing performance (#5647)
rangoo94 Jul 10, 2024
a15368d
Merge tag 'v2.0.7' into develop-v2.0.7
ed382 Jul 11, 2024
f44d150
fix(testworkflows): displaying events (#5652)
rangoo94 Jul 11, 2024
aa1326b
fix(testworkflows): storing logs for the services (#5656)
rangoo94 Jul 11, 2024
1db9d56
fix(testworkflows): storing logs for the services (#5656)
rangoo94 Jul 11, 2024
3b1a4b9
Merge pull request #5655 from kubeshop/release-v2.0.8
ed382 Jul 11, 2024
4665fbd
feat: [TKC-2194] fix workflow execution telemetry (#5659)
povilasv Jul 12, 2024
6e72f45
Merge pull request #5663 from kubeshop/release-2.0.9-v2
ed382 Jul 12, 2024
bb5f7bd
feat: [TKC-2208] refactor webhook disabling (#5658)
vsukhin Jul 16, 2024
4e3477f
add support for defining TTL for image credentials cache (#5660)
dejanzele Jul 17, 2024
565b4e7
add dispatch (#5667)
ypoplavs Jul 19, 2024
1d1cbbe
add dispatch (#5667)
ypoplavs Jul 19, 2024
e214d9e
Merge pull request #5670 from kubeshop/release/2.0.11
ypoplavs Jul 19, 2024
ab73b19
fix a typo in CI for sandbox (#5671)
ypoplavs Jul 19, 2024
b614f25
add sandbox deletion (#5674)
ypoplavs Jul 19, 2024
af6ac02
fix: [TKC-2209] add webhooks events (#5666)
vsukhin Jul 19, 2024
22b4eca
Merge branch 'main' into develop
vsukhin Jul 22, 2024
31ad168
fix: read correctly parallel template (#5678)
rangoo94 Jul 23, 2024
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
25 changes: 25 additions & 0 deletions .github/workflows/sandbox-deletion.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Remove sandbox environment

Check failure

Code scanning / Scorecard

Token-Permissions High

score is 0: no topLevel permission defined
Remediation tip: Visit https://app.stepsecurity.io/secureworkflow.
Tick the 'Restrict permissions for GITHUB_TOKEN'
Untick other options
NOTE: If you want to resolve multiple issues at once, you can visit https://app.stepsecurity.io/securerepo instead.
Click Remediation section below for further remediation help

on:
pull_request:
types: [closed]

jobs:
delete:
if: startsWith(github.event.pull_request.head.ref, 'sandbox/')
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1

Check warning

Code scanning / Scorecard

Pinned-Dependencies Medium

score is 0: GitHub-owned GitHubAction not pinned by hash
Remediation tip: update your workflow using https://app.stepsecurity.io
Click Remediation section below for further remediation help
id: app-token
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}
owner: ${{ github.repository_owner }}

- name: Repository dispatch
uses: peter-evans/repository-dispatch@v2

Check warning

Code scanning / Scorecard

Pinned-Dependencies Medium

score is 0: third-party GitHubAction not pinned by hash
Remediation tip: update your workflow using https://app.stepsecurity.io
Click Remediation section below for further remediation help
with:
token: ${{ steps.app-token.outputs.token }}
repository: kubeshop/testkube-deployment
event-type: sandbox_env_delete
client-payload: '{"ref_name": "${{ github.event.pull_request.head.ref }}"}'
44 changes: 18 additions & 26 deletions api/v1/testkube.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6595,7 +6595,7 @@ components:
description: running context for the test execution
disableWebhooks:
type: boolean
description: whether webhooks on the executions of this step are disabled
description: whether webhooks on the execution of this step are disabled
default: false
example:
- true
Expand Down Expand Up @@ -6703,7 +6703,7 @@ components:
description: test suite execution name started the test suite execution
disableWebhooks:
type: boolean
description: whether webhooks on the executions of this test suite are disabled
description: whether webhooks on the execution of this test suite are disabled
default: false
example:
- true
Expand Down Expand Up @@ -7096,13 +7096,6 @@ components:
example:
- true
- false
onStateChange:
type: boolean
description: whether webhook is triggered on state change only
default: false
example:
- true
- false

Event:
description: Event data
Expand Down Expand Up @@ -7165,16 +7158,30 @@ components:
- end-test-failed
- end-test-aborted
- end-test-timeout
- become-test-up
- become-test-down
- become-test-failed
- become-test-aborted
- become-test-timeout
- start-testsuite
- end-testsuite-success
- end-testsuite-failed
- end-testsuite-aborted
- end-testsuite-timeout
- become-testsuite-up
- become-testsuite-down
- become-testsuite-failed
- become-testsuite-aborted
- become-testsuite-timeout
- queue-testworkflow
- start-testworkflow
- end-testworkflow-success
- end-testworkflow-failed
- end-testworkflow-aborted
- become-testworkflow-up
- become-testworkflow-down
- become-testworkflow-failed
- become-testworkflow-aborted
- created
- updated
- deleted
Expand Down Expand Up @@ -7872,7 +7879,7 @@ components:
description: test workflow execution name started the test workflow execution
disableWebhooks:
type: boolean
description: whether webhooks on the executions of this test workflow are disabled
description: whether webhooks on the execution of this test workflow are disabled
default: false

TestWorkflowWithExecution:
Expand Down Expand Up @@ -7960,7 +7967,7 @@ components:
description: test workflow execution name started the test workflow execution
disableWebhooks:
type: boolean
description: whether webhooks on the executions of this test workflow are disabled
description: whether webhooks on the execution of this test workflow are disabled
default: false
example:
- true
Expand Down Expand Up @@ -8500,9 +8507,6 @@ components:
type: array
items:
$ref: "#/components/schemas/TestWorkflowEvent"
notifications:
$ref: "#/components/schemas/TestWorkflowNotificationsConfig"


TestWorkflowTemplateSpec:
type: object
Expand Down Expand Up @@ -9175,14 +9179,6 @@ components:
items:
$ref: "#/components/schemas/VolumeMount"

TestWorkflowNotificationsConfig:
type: object
properties:
disableWebhooks:
type: boolean
description: disable webhooks for this test workflow
default: false

TestWorkflowStepRun:
type: object
properties:
Expand Down Expand Up @@ -9350,10 +9346,6 @@ components:
status:
$ref: "#/components/schemas/TestWorkflowExecutionStatusCR"
description: test workflow execution status
disableWebhooks:
type: boolean
description: disable webhooks for this execution
default: false

TestWorkflowExecutionStatusCR:
type: object
Expand Down
7 changes: 6 additions & 1 deletion cmd/api-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import (
"syscall"
"time"

corev1 "k8s.io/api/core/v1"

"github.com/kubeshop/testkube/pkg/cache"

"github.com/nats-io/nats.go"
"google.golang.org/grpc/metadata"
"google.golang.org/protobuf/types/known/emptypb"
Expand Down Expand Up @@ -487,7 +491,7 @@ func main() {
inspector := imageinspector.NewInspector(
cfg.TestkubeRegistry,
imageinspector.NewSkopeoFetcher(),
imageinspector.NewSecretFetcher(secretClient),
imageinspector.NewSecretFetcher(secretClient, cache.NewInMemoryCache[*corev1.Secret](), imageinspector.WithSecretCacheTTL(cfg.TestkubeImageCredentialsCacheTTL)),
inspectorStorages...,
)

Expand Down Expand Up @@ -515,6 +519,7 @@ func main() {
features,
cfg.TestkubeDefaultStorageClassName,
cfg.WhitelistedContainers,
cfg.TestkubeImageCredentialsCacheTTL,
)
if err != nil {
exitOnError("Creating container executor", err)
Expand Down
4 changes: 0 additions & 4 deletions cmd/kubectl-testkube/commands/common/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,6 @@ func ProcessMasterFlags(cmd *cobra.Command, opts *HelmOptions, cfg *config.Data)

}

func IsBothEnabledAndDisabledSet(cmd *cobra.Command) bool {
return cmd.Flag("enable-webhooks").Changed && cmd.Flag("disable-webhooks").Changed
}

// CommaList is a custom flag type for features
type CommaList []string

Expand Down
18 changes: 0 additions & 18 deletions cmd/kubectl-testkube/commands/tests/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,13 +671,6 @@ func newExecutionRequestFromFlags(cmd *cobra.Command) (request *testkube.Executi
return nil, err
}

if cmd.Flag("enable-webhooks").Changed {
request.DisableWebhooks = false
}
if cmd.Flag("disable-webhooks").Changed {
request.DisableWebhooks = true
}

return request, nil
}

Expand Down Expand Up @@ -1255,17 +1248,6 @@ func newExecutionUpdateRequestFromFlags(cmd *cobra.Command) (request *testkube.E
request.SlavePodRequest = &emptyPodRequest
}

disableWebhooks := false
if cmd.Flag("enable-webhooks").Changed {
request.DisableWebhooks = &disableWebhooks
nonEmpty = true
}
if cmd.Flag("disable-webhooks").Changed {
disableWebhooks = true
request.DisableWebhooks = &disableWebhooks
nonEmpty = true
}

if nonEmpty {
return request, nil
}
Expand Down
8 changes: 2 additions & 6 deletions cmd/kubectl-testkube/commands/tests/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@ func NewCreateTestsCmd() *cobra.Command {
ui.Failf("pass valid test name (in '--name' flag)")
}

if common.IsBothEnabledAndDisabledSet(cmd) {
ui.Failf("both --enable-webhooks and --disable-webhooks flags are set, please use only one")
}

namespace := cmd.Flag("namespace").Value.String()
var client client.Client
if !crdOnly {
Expand Down Expand Up @@ -288,8 +284,8 @@ func AddCreateFlags(cmd *cobra.Command, flags *CreateCommonFlags) {
cmd.Flags().StringVar(&flags.SlavePodTemplate, "slave-pod-template", "", "slave pod template file path for extensions to slave pod template")
cmd.Flags().StringVar(&flags.SlavePodTemplateReference, "slave-pod-template-reference", "", "reference to slave pod template to use for the test")
cmd.Flags().StringVar(&flags.ExecutionNamespace, "execution-namespace", "", "namespace for test execution (Pro edition only)")
cmd.Flags().Bool("disable-webhooks", false, "disable webhooks")
cmd.Flags().Bool("enable-webhooks", false, "enable webhooks")
cmd.Flags().MarkDeprecated("disable-webhooks", "disable-webhooks is deprecated")
cmd.Flags().MarkDeprecated("enable-webhooks", "enable-webhooks is deprecated")
}

func validateExecutorTypeAndContent(executorType, contentType string, executors testkube.ExecutorsDetails) error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func ExecutionRenderer(client client.Client, ui *ui.UI, obj interface{}) error {
ui.Warn(" Auth type: ", execution.Content.Repository.AuthType)
}

ui.Warn("Disabled webhooks:", fmt.Sprint(execution.DisableWebhooks))
if err := render.RenderExecutionResult(client, &execution, false, true); err != nil {
return err
}
Expand Down
2 changes: 0 additions & 2 deletions cmd/kubectl-testkube/commands/tests/renderer/test_obj.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,6 @@ func TestRenderer(client client.Client, ui *ui.UI, obj interface{}) error {
ui.NL()
ui.Warn(" Variable secrets: ", variableSecrets...)
}

ui.Warn(" Disable webhooks: ", fmt.Sprint(test.ExecutionRequest.DisableWebhooks))
}

return nil
Expand Down
17 changes: 4 additions & 13 deletions cmd/kubectl-testkube/commands/tests/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ func NewRunTestCmd() *cobra.Command {
executionNamespace string
attachDebugger bool
debugFile string
disableWebhooks bool
)

cmd := &cobra.Command{
Expand All @@ -95,10 +96,6 @@ func NewRunTestCmd() *cobra.Command {
watchEnabled = true
}

if common.IsBothEnabledAndDisabledSet(cmd) {
ui.Failf("both --enable-webhooks and --disable-webhooks flags are set, please use only one")
}

outputFlag := cmd.Flag("output")
outputType := render.OutputPretty
if outputFlag != nil {
Expand Down Expand Up @@ -150,13 +147,7 @@ func NewRunTestCmd() *cobra.Command {
ExecutePostRunScriptBeforeScraping: executePostRunScriptBeforeScraping,
SourceScripts: sourceScripts,
ExecutionNamespace: executionNamespace,
}

if cmd.Flag("enable-webhooks").Changed {
options.DisableWebhooks = false
}
if cmd.Flag("disable-webhooks").Changed {
options.DisableWebhooks = true
DisableWebhooks: disableWebhooks,
}

var fields = []struct {
Expand Down Expand Up @@ -480,8 +471,8 @@ func NewRunTestCmd() *cobra.Command {
cmd.Flags().StringVar(&executionNamespace, "execution-namespace", "", "namespace for test execution (Pro edition only)")
cmd.Flags().StringVar(&debugFile, "debugger-file", "", "store debug info into file, stdout by default")
cmd.Flags().BoolVar(&attachDebugger, "attach-debugger", false, "attach simple debugger for job, need KUBECONFIG for the agent to be active")
cmd.Flags().Bool("disable-webhooks", false, "disable webhooks")
cmd.Flags().Bool("enable-webhooks", false, "enable webhooks")
cmd.Flags().BoolVar(&disableWebhooks, "disable-webhooks", false, "disable webhooks")
cmd.Flags().MarkDeprecated("enable-webhooks", "enable-webhooks is deprecated")

return cmd
}
Expand Down
4 changes: 0 additions & 4 deletions cmd/kubectl-testkube/commands/tests/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ func NewUpdateTestsCmd() *cobra.Command {
ui.Failf("pass valid test name (in '--name' flag)")
}

if common.IsBothEnabledAndDisabledSet(cmd) {
ui.Failf("both --enable-webhooks and --disable-webhooks flags are set, please use only one")
}

client, namespace, err := common.GetClient(cmd)
ui.ExitOnError("getting client", err)

Expand Down
27 changes: 0 additions & 27 deletions cmd/kubectl-testkube/commands/testsuites/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,6 @@ func uiShellTestSuiteWatchCommandBlock(id string) {

// NewTestSuiteUpsertOptionsFromFlags creates test suite upsert options from command flags
func NewTestSuiteUpsertOptionsFromFlags(cmd *cobra.Command) (options apiclientv1.UpsertTestSuiteOptions, err error) {
if common.IsBothEnabledAndDisabledSet(cmd) {
ui.Failf("both --enable-webhooks and --disable-webhooks flags are set, please use only one")
}

data, err := common.NewDataFromFlags(cmd)
if err != nil {
return options, err
Expand Down Expand Up @@ -260,22 +256,11 @@ func NewTestSuiteUpsertOptionsFromFlags(cmd *cobra.Command) (options apiclientv1
}
}

if cmd.Flag("enable-webhooks").Changed {
options.ExecutionRequest.DisableWebhooks = false
}
if cmd.Flag("disable-webhooks").Changed {
options.ExecutionRequest.DisableWebhooks = true
}

return options, nil
}

// NewTestSuiteUpdateOptionsFromFlags creates test suite update options from command flags
func NewTestSuiteUpdateOptionsFromFlags(cmd *cobra.Command) (options apiclientv1.UpdateTestSuiteOptions, err error) {
if common.IsBothEnabledAndDisabledSet(cmd) {
ui.Failf("both --enable-webhooks and --disable-webhooks flags are set, please use only one")
}

data, err := common.NewDataFromFlags(cmd)
if err != nil {
return options, err
Expand Down Expand Up @@ -379,18 +364,6 @@ func NewTestSuiteUpdateOptionsFromFlags(cmd *cobra.Command) (options apiclientv1
nonEmpty = true
}

var disableWebhook bool
if cmd.Flag("enable-webhooks").Changed {
nonEmpty = true
disableWebhook = false
executionRequest.DisableWebhooks = &disableWebhook
}
if cmd.Flag("disable-webhooks").Changed {
nonEmpty = true
disableWebhook = true
executionRequest.DisableWebhooks = &disableWebhook
}

var values = []struct {
source string
destination **string
Expand Down
4 changes: 2 additions & 2 deletions cmd/kubectl-testkube/commands/testsuites/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ func NewCreateTestSuitesCmd() *cobra.Command {
cmd.Flags().StringVar(&scraperTemplateReference, "scraper-template-reference", "", "reference to scraper template to use for the test")
cmd.Flags().StringVar(&pvcTemplateReference, "pvc-template-reference", "", "reference to pvc template to use for the test")
cmd.Flags().BoolVar(&update, "update", false, "update, if test suite already exists")
cmd.Flags().Bool("disable-webhooks", false, "disable webhooks")
cmd.Flags().Bool("enable-webhooks", false, "enable webhooks")
cmd.Flags().MarkDeprecated("disable-webhooks", "disable-webhooks is deprecated")
cmd.Flags().MarkDeprecated("enable-webhooks", "enable-webhooks is deprecated")

return cmd
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func TestSuiteExecutionRenderer(client client.Client, ui *ui.UI, obj interface{}
ui.Warn("Context:", execution.RunningContext.Context)
}

ui.Warn("Disabled webhooks:", fmt.Sprint(execution.DisableWebhooks))
info, err := client.GetServerInfo()
ui.ExitOnError("getting server info", err)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ func TestSuiteRenderer(client client.Client, ui *ui.UI, obj interface{}) error {
if ts.ExecutionRequest.PvcTemplateReference != "" {
ui.Warn(" PVC template reference: ", ts.ExecutionRequest.PvcTemplateReference)
}
ui.Warn(" Disable webhooks: ", fmt.Sprint(ts.ExecutionRequest.DisableWebhooks))
}

batches := append(ts.Before, ts.Steps...)
Expand Down
Loading
Loading