Repository: kestra-io/kestra (java)

Issue:
Ensure that timeout set on a Script task is propagated to a timeout of a Cloud container (AWS/Azure/Google Batch Script Runners)
### Feature description

When a user sets a timeout, we should ensure that the configured timeout will be _roughly_ respected. 

We say _roughly_ because there can be some significant latency for starting a container (on Fargate, even in a range of minutes), so _ideally_ the timeout should start once the container starts.  However, the main use case is matching kestra timeout with Cloud container service timeout (even if not 100% accurate) to avoid unexpected costs caused by not respecting timeout and having a zombie container running for weeks. 

```yaml
id: timeout
namespace: dev

tasks:
  - id: failed
    type: io.kestra.plugin.scripts.shell.Commands
    scriptRunner: ...
    timeout: PT2H
```

Pull request description:
feat(core): pass task timeout to the task runner
Fixes #3461

Patch:
diff --git a/core/src/main/java/io/kestra/core/models/tasks/runners/TaskCommands.java b/core/src/main/java/io/kestra/core/models/tasks/runners/TaskCommands.java
index 2ad1632c5..076797940 100644
--- a/core/src/main/java/io/kestra/core/models/tasks/runners/TaskCommands.java
+++ b/core/src/main/java/io/kestra/core/models/tasks/runners/TaskCommands.java
@@ -1,6 +1,7 @@
 package io.kestra.core.models.tasks.runners;
 
 import java.nio.file.Path;
+import java.time.Duration;
 import java.util.List;
 import java.util.Map;
 
@@ -27,4 +28,6 @@ public interface TaskCommands {
     default boolean outputDirectoryEnabled() {
         return Boolean.TRUE.equals(this.getEnableOutputDirectory());
     }
+
+    Duration getTimeout();
 }


Test patch:
diff --git a/core/src/test/java/io/kestra/core/models/tasks/runners/TaskRunnerTest.java b/core/src/test/java/io/kestra/core/models/tasks/runners/TaskRunnerTest.java
index 4b0f92248..8be40850c 100644
--- a/core/src/test/java/io/kestra/core/models/tasks/runners/TaskRunnerTest.java
+++ b/core/src/test/java/io/kestra/core/models/tasks/runners/TaskRunnerTest.java
@@ -1,7 +1,6 @@
 package io.kestra.core.models.tasks.runners;
 
 import io.kestra.core.exceptions.IllegalVariableEvaluationException;
-import io.kestra.core.models.tasks.runners.*;
 import io.kestra.core.runners.RunContext;
 import io.micronaut.context.ApplicationContext;
 import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
@@ -9,6 +8,7 @@ import jakarta.inject.Inject;
 import org.junit.jupiter.api.Test;
 
 import java.nio.file.Path;
+import java.time.Duration;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -180,5 +180,10 @@ public class TaskRunnerTest {
         public Boolean getEnableOutputDirectory() {
             return true;
         }
+
+        @Override
+        public Duration getTimeout() {
+            return null;
+        }
     }
 }