Skip to content

Commit

Permalink
fix: check for trigger cloud mode
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Sukhin <[email protected]>
  • Loading branch information
vsukhin committed Oct 22, 2024
1 parent 9c841e4 commit 34ceae9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions cmd/api-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ func main() {
triggers.WithTestkubeNamespace(cfg.TestkubeNamespace),
triggers.WithWatcherNamespaces(cfg.TestkubeWatcherNamespaces),
triggers.WithDisableSecretCreation(!secretConfig.AutoCreate),
triggers.WithProContext(&proContext),
)
log.DefaultLogger.Info("starting trigger service")
g.Go(func() error {
Expand Down
7 changes: 5 additions & 2 deletions pkg/triggers/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,11 @@ func (s *Service) execute(ctx context.Context, e *watcherEvent, t *testtriggersv

request := testkube.TestWorkflowExecutionRequest{
Config: make(map[string]string, len(variables)),
// Pro edition only (tcl protected code)
RunningContext: triggerstcl.GetRunningContext(t.Name),
}

// Pro edition only (tcl protected code)
if s.proContext != nil && s.proContext.APIKey != "" {
request.RunningContext = triggerstcl.GetRunningContext(t.Name)
}

for _, variable := range variables {
Expand Down
8 changes: 8 additions & 0 deletions pkg/triggers/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
testkubeclientsetv1 "github.com/kubeshop/testkube-operator/pkg/clientset/versioned"
"github.com/kubeshop/testkube/cmd/api-server/commons"
"github.com/kubeshop/testkube/internal/app/api/metrics"
intconfig "github.com/kubeshop/testkube/internal/config"
"github.com/kubeshop/testkube/pkg/api/v1/testkube"
"github.com/kubeshop/testkube/pkg/event/bus"
"github.com/kubeshop/testkube/pkg/executor/client"
Expand Down Expand Up @@ -77,6 +78,7 @@ type Service struct {
testkubeNamespace string
watcherNamespaces []string
disableSecretCreation bool
proContext *intconfig.ProContext
}

type Option func(*Service)
Expand Down Expand Up @@ -210,6 +212,12 @@ func WithDisableSecretCreation(disableSecretCreation bool) Option {
}
}

func WithProContext(proContext *intconfig.ProContext) Option {
return func(s *Service) {
s.proContext = proContext
}
}

func (s *Service) Run(ctx context.Context) {
leaseChan := make(chan bool)

Expand Down

0 comments on commit 34ceae9

Please sign in to comment.