diff --git a/ee/orchestration/cmd/root.go b/ee/orchestration/cmd/root.go index 065474c4b1..434def2928 100644 --- a/ee/orchestration/cmd/root.go +++ b/ee/orchestration/cmd/root.go @@ -40,18 +40,19 @@ var ( ) const ( - stackFlag = "stack" - stackURLFlag = "stack-url" - stackClientIDFlag = "stack-client-id" - stackClientSecretFlag = "stack-client-secret" - temporalAddressFlag = "temporal-address" - temporalNamespaceFlag = "temporal-namespace" - temporalSSLClientKeyFlag = "temporal-ssl-client-key" - temporalSSLClientCertFlag = "temporal-ssl-client-cert" - temporalTaskQueueFlag = "temporal-task-queue" - topicsFlag = "topics" - listenFlag = "listen" - workerFlag = "worker" + stackFlag = "stack" + stackURLFlag = "stack-url" + stackClientIDFlag = "stack-client-id" + stackClientSecretFlag = "stack-client-secret" + temporalAddressFlag = "temporal-address" + temporalNamespaceFlag = "temporal-namespace" + temporalSSLClientKeyFlag = "temporal-ssl-client-key" + temporalSSLClientCertFlag = "temporal-ssl-client-cert" + temporalTaskQueueFlag = "temporal-task-queue" + temporalInitSearchAttributes = "temporal-init-search-attributes" + topicsFlag = "topics" + listenFlag = "listen" + workerFlag = "worker" ) func NewRootCommand() *cobra.Command { @@ -70,6 +71,7 @@ func NewRootCommand() *cobra.Command { cmd.PersistentFlags().String(temporalSSLClientKeyFlag, "", "Temporal client key") cmd.PersistentFlags().String(temporalSSLClientCertFlag, "", "Temporal client cert") cmd.PersistentFlags().String(temporalTaskQueueFlag, "default", "Temporal task queue name") + cmd.PersistentFlags().Bool(temporalInitSearchAttributes, false, "Init temporal search attributes") cmd.PersistentFlags().StringSlice(topicsFlag, []string{}, "Topics to listen") cmd.PersistentFlags().String(stackFlag, "", "Stack") cmd.AddCommand( @@ -112,6 +114,7 @@ func commonOptions(cmd *cobra.Command) (fx.Option, error) { viper.GetString(temporalNamespaceFlag), viper.GetString(temporalSSLClientCertFlag), viper.GetString(temporalSSLClientKeyFlag), + viper.GetBool(temporalInitSearchAttributes), ), bunconnect.Module(*connectionOptions), publish.CLIPublisherModule("orchestration"), diff --git a/ee/orchestration/internal/temporalclient/client_module.go b/ee/orchestration/internal/temporalclient/client_module.go index 2bae15141d..906da9cc6b 100644 --- a/ee/orchestration/internal/temporalclient/client_module.go +++ b/ee/orchestration/internal/temporalclient/client_module.go @@ -17,7 +17,7 @@ import ( "go.uber.org/fx" ) -func NewModule(address, namespace string, certStr string, key string) fx.Option { +func NewModule(address, namespace string, certStr string, key string, initSearchAttributes bool) fx.Option { return fx.Options( fx.Provide(func(logger logging.Logger) (client.Options, error) { @@ -54,7 +54,10 @@ func NewModule(address, namespace string, certStr string, key string) fx.Option fx.Invoke(func(lifecycle fx.Lifecycle, c client.Client) { lifecycle.Append(fx.Hook{ OnStart: func(ctx context.Context) error { - return createSearchAttributes(ctx, c, namespace) + if initSearchAttributes { + return createSearchAttributes(ctx, c, namespace) + } + return nil }, OnStop: func(ctx context.Context) error { c.Close() diff --git a/tests/integration/internal/modules/orchestration.go b/tests/integration/internal/modules/orchestration.go index 515f54e8d3..53f0596100 100644 --- a/tests/integration/internal/modules/orchestration.go +++ b/tests/integration/internal/modules/orchestration.go @@ -22,6 +22,7 @@ var Orchestration = internal.NewModule("orchestration"). "--stack-url=" + test.GatewayURL(), "--temporal-address=" + internal.GetTemporalAddress(), "--temporal-task-queue=" + test.ID(), + "--temporal-init-search-attributes", "--worker", "--publisher-nats-enabled", "--publisher-nats-client-id=orchestration",