This is an automated email from the ASF dual-hosted git repository.

gallardot pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 4f693a5fa1 [Fix-17704][HttpTask] The output parameters of an HTTP task 
cannot be referenced in downstream tasks. (#17716)
4f693a5fa1 is described below

commit 4f693a5fa14a433b35d559c612e8e07382cc2910
Author: luxiaolong <[email protected]>
AuthorDate: Mon Dec 8 11:27:05 2025 +0800

    [Fix-17704][HttpTask] The output parameters of an HTTP task cannot be 
referenced in downstream tasks. (#17716)
    
    * fix #17637
    
    * Because workflow lineage only retains the current version, deleting 
historical versions in the workflow does not invoke lineage deletion. 
Therefore, logic for deleting lineages should be added when deleting workflows.
    
    * Optimize workflow deletion logic to ensure compatibility with historical 
library data.
    
    * spotless
    
    * fix #17637
    
    * Because workflow lineage only retains the current version, deleting 
historical versions in the workflow does not invoke lineage deletion. 
Therefore, logic for deleting lineages should be added when deleting workflows.
    
    * Optimize workflow deletion logic to ensure compatibility with historical 
library data.
    
    * spotless
    
    * add ut test
    
    * fix #17638
    
    * Simplify the logic of WorkflowDefinitionService.saveWorkflowLineage().
    
    * fix #17704
    
    * Update 
dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTask.java
    
    Co-authored-by: Copilot <[email protected]>
    
    ---------
    
    Co-authored-by: luxl <[email protected]>
    Co-authored-by: caishunfeng <[email protected]>
    Co-authored-by: xiangzihao <[email protected]>
    Co-authored-by: Wenjun Ruan <[email protected]>
    Co-authored-by: Copilot <[email protected]>
    Co-authored-by: Gallardot <[email protected]>
---
 .../plugin/task/http/HttpTask.java                 |  2 ++
 .../plugin/task/http/HttpTaskTest.java             | 33 ++++++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTask.java
 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTask.java
index 2f2cd4b2d3..2ad40adaa4 100644
--- 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTask.java
+++ 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTask.java
@@ -73,6 +73,8 @@ public class HttpTask extends AbstractTask {
 
         OkHttpResponse httpResponse = sendRequest();
 
+        taskExecutionContext.setVarPool(httpParameters.getVarPool());
+
         validateResponse(httpResponse.getBody(), httpResponse.getStatusCode());
     }
 
diff --git 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/test/java/org/apache/dolphinscheduler/plugin/task/http/HttpTaskTest.java
 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/test/java/org/apache/dolphinscheduler/plugin/task/http/HttpTaskTest.java
index ba211f6bd7..a48e6dd9be 100644
--- 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/test/java/org/apache/dolphinscheduler/plugin/task/http/HttpTaskTest.java
+++ 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/test/java/org/apache/dolphinscheduler/plugin/task/http/HttpTaskTest.java
@@ -181,6 +181,39 @@ public class HttpTaskTest {
         Assertions.assertEquals(response, property.getValue());
     }
 
+    @Test
+    public void testHandleSetsVarPoolToTaskExecutionContext() throws Exception 
{
+        String responseBody = "{\"status\": \"success\", \"data\": \"test\"}";
+        String taskName = "testHttpTask";
+
+        TaskExecutionContext taskExecutionContext = 
Mockito.mock(TaskExecutionContext.class);
+        Mockito.when(taskExecutionContext.getTaskName()).thenReturn(taskName);
+
+        String url = withMockWebServer(DEFAULT_MOCK_PATH, HttpStatus.SC_OK, 
responseBody);
+        String paramData = generateHttpParameters(url, HttpRequestMethod.GET, 
"",
+                new ArrayList<>(), HttpCheckCondition.STATUS_CODE_DEFAULT, "");
+        
Mockito.when(taskExecutionContext.getTaskParams()).thenReturn(paramData);
+
+        HttpTask httpTask = new HttpTask(taskExecutionContext);
+        httpTask.init();
+        httpTask.handle(null);
+
+        Mockito.verify(taskExecutionContext, 
Mockito.times(1)).setVarPool(Mockito.anyList());
+
+        
Mockito.verify(taskExecutionContext).setVarPool(Mockito.argThat(varPool -> {
+            if (varPool == null || varPool.isEmpty()) {
+                return false;
+            }
+            Property property = varPool.get(0);
+            return property.getProp().equals(taskName + ".response")
+                    && property.getDirect() == Direct.OUT
+                    && property.getType() == DataType.VARCHAR
+                    && property.getValue().contains("status");
+        }));
+
+        Assertions.assertEquals(EXIT_CODE_SUCCESS, 
httpTask.getExitStatusCode());
+    }
+
     private String withMockWebServer(String path, int actualResponseCode,
                                      String actualResponseBody) throws 
IOException {
         MockWebServer server = new MockWebServer();

Reply via email to