From 9382cd8f66ccfcef5551a4ba004310e7499672a2 Mon Sep 17 00:00:00 2001 From: Jacob Weinstock Date: Tue, 12 Apr 2022 09:00:20 -0600 Subject: [PATCH] Remove Tink worker global timeout cli flag: The Tink worker global timeout cli flag doesn't implement the global timeout defined in a Tink server template correctly. A single template can have multiple workers. So a single Tink worker defining a global timeout for all task is erroneous. It doesn't take the multiple workers idea into account. A long term solution will need to be implemented. Something that takes into account multiple workers. Signed-off-by: Jacob Weinstock --- cmd/tink-worker/cmd/root.go | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/cmd/tink-worker/cmd/root.go b/cmd/tink-worker/cmd/root.go index ab3ac8667..0be94d04e 100644 --- a/cmd/tink-worker/cmd/root.go +++ b/cmd/tink-worker/cmd/root.go @@ -1,7 +1,6 @@ package cmd import ( - "context" "fmt" "os" "strings" @@ -42,11 +41,8 @@ func NewRootCommand(version string, logger log.Logger) *cobra.Command { RunE: func(cmd *cobra.Command, args []string) error { retryInterval, _ := cmd.Flags().GetDuration("retry-interval") retries, _ := cmd.Flags().GetInt("max-retry") - // TODO(displague) is log-level no longer useful? - // logLevel, _ := cmd.Flags().GetString("log-level") workerID, _ := cmd.Flags().GetString("id") maxFileSize, _ := cmd.Flags().GetInt64("max-file-size") - timeOut, _ := cmd.Flags().GetDuration("timeout") user, _ := cmd.Flags().GetString("registry-username") pwd, _ := cmd.Flags().GetString("registry-password") registry, _ := cmd.Flags().GetString("docker-registry") @@ -57,13 +53,6 @@ func NewRootCommand(version string, logger log.Logger) *cobra.Command { return setupErr } - ctx := context.Background() - if timeOut > 0 { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, timeOut) - defer cancel() - } - conn, err := tryClientConnection(logger, retryInterval, retries) if err != nil { return err @@ -96,7 +85,7 @@ func NewRootCommand(version string, logger log.Logger) *cobra.Command { worker.WithLogCapture(captureActionLogs), worker.WithPrivileged(true)) - err = w.ProcessWorkflowActions(ctx) + err = w.ProcessWorkflowActions(cmd.Context()) if err != nil { return errors.Wrap(err, "worker Finished with error") } @@ -114,8 +103,6 @@ func NewRootCommand(version string, logger log.Logger) *cobra.Command { rootCmd.Flags().Bool("capture-action-logs", true, "Capture action container output as part of worker logs") - // rootCmd.Flags().String("log-level", "info", "Sets the worker log level (panic, fatal, error, warn, info, debug, trace)") - must := func(err error) { if err != nil { logger.Fatal(err)