You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by zh...@apache.org on 2026/04/21 08:57:03 UTC

(seatunnel) branch dev updated: [Improve][seatunnel core][seatunnel-flink-start] Improve the packaging of the Flink Yarn application and upload the 'runtime.tar.gz' file (#10419)

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

Carl-Zhou-CN pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/seatunnel.git


The following commit(s) were added to refs/heads/dev by this push:
     new 35840fd603 [Improve][seatunnel core][seatunnel-flink-start] Improve the packaging of the Flink Yarn application and upload the 'runtime.tar.gz' file (#10419)
35840fd603 is described below

commit 35840fd603abec963d78a5e7b83710828ebe8849
Author: LiJie20190102 <53...@users.noreply.github.com>
AuthorDate: Tue Apr 21 16:56:56 2026 +0800

    [Improve][seatunnel core][seatunnel-flink-start] Improve the packaging of the Flink Yarn application and upload the 'runtime.tar.gz' file (#10419)
    
    Co-authored-by: lijie <li...@cmss.chinamobile.com>
---
 .../bin/start-seatunnel-flink-13-connector-v2.sh     |  4 ++--
 .../bin/start-seatunnel-flink-15-connector-v2.sh     |  4 ++--
 .../bin/start-seatunnel-flink-20-connector-v2.sh     |  4 ++--
 .../core/starter/flink/AbstractFlinkStarter.java     |  6 +++++-
 .../core/starter/flink/TestFlinkParameter.java       | 20 ++++++++++++++++++++
 5 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/seatunnel-core/seatunnel-flink-starter/seatunnel-flink-13-starter/src/main/bin/start-seatunnel-flink-13-connector-v2.sh b/seatunnel-core/seatunnel-flink-starter/seatunnel-flink-13-starter/src/main/bin/start-seatunnel-flink-13-connector-v2.sh
index 4bd9905354..70e08d7def 100755
--- a/seatunnel-core/seatunnel-flink-starter/seatunnel-flink-13-starter/src/main/bin/start-seatunnel-flink-13-connector-v2.sh
+++ b/seatunnel-core/seatunnel-flink-starter/seatunnel-flink-13-starter/src/main/bin/start-seatunnel-flink-13-connector-v2.sh
@@ -50,7 +50,7 @@ if [ ! -f "${APP_DIR}/runtime.tar.gz" ];then
   existing_dirs=()
 
   for dir in "${directories[@]}"; do
-      if [ -d "$dir" ]; then
+      if [ -d "${APP_DIR}/${dir}" ]; then
           existing_dirs+=("$dir")
       fi
   done
@@ -58,7 +58,7 @@ if [ ! -f "${APP_DIR}/runtime.tar.gz" ];then
   if [ ${#existing_dirs[@]} -eq 0 ]; then
       echo "[connectors,lib,plugins] not existed, skip generate runtime.tar.gz"
   else
-      tar -zcvf runtime.tar.gz "${existing_dirs[@]}"
+      tar -zcvf "${APP_DIR}/runtime.tar.gz" -C "${APP_DIR}" "${existing_dirs[@]}"
   fi
 fi
 
diff --git a/seatunnel-core/seatunnel-flink-starter/seatunnel-flink-15-starter/src/main/bin/start-seatunnel-flink-15-connector-v2.sh b/seatunnel-core/seatunnel-flink-starter/seatunnel-flink-15-starter/src/main/bin/start-seatunnel-flink-15-connector-v2.sh
index 5698a340da..8ec36c20b5 100755
--- a/seatunnel-core/seatunnel-flink-starter/seatunnel-flink-15-starter/src/main/bin/start-seatunnel-flink-15-connector-v2.sh
+++ b/seatunnel-core/seatunnel-flink-starter/seatunnel-flink-15-starter/src/main/bin/start-seatunnel-flink-15-connector-v2.sh
@@ -50,7 +50,7 @@ if [ ! -f "${APP_DIR}/runtime.tar.gz" ];then
   existing_dirs=()
 
   for dir in "${directories[@]}"; do
-      if [ -d "$dir" ]; then
+      if [ -d "${APP_DIR}/${dir}" ]; then
           existing_dirs+=("$dir")
       fi
   done
@@ -58,7 +58,7 @@ if [ ! -f "${APP_DIR}/runtime.tar.gz" ];then
   if [ ${#existing_dirs[@]} -eq 0 ]; then
       echo "[connectors,lib,plugins] not existed, skip generate runtime.tar.gz"
   else
-      tar -zcvf runtime.tar.gz "${existing_dirs[@]}"
+      tar -zcvf "${APP_DIR}/runtime.tar.gz" -C "${APP_DIR}" "${existing_dirs[@]}"
   fi
 fi
 
diff --git a/seatunnel-core/seatunnel-flink-starter/seatunnel-flink-20-starter/src/main/bin/start-seatunnel-flink-20-connector-v2.sh b/seatunnel-core/seatunnel-flink-starter/seatunnel-flink-20-starter/src/main/bin/start-seatunnel-flink-20-connector-v2.sh
index 40b395bec7..a2ef35850c 100644
--- a/seatunnel-core/seatunnel-flink-starter/seatunnel-flink-20-starter/src/main/bin/start-seatunnel-flink-20-connector-v2.sh
+++ b/seatunnel-core/seatunnel-flink-starter/seatunnel-flink-20-starter/src/main/bin/start-seatunnel-flink-20-connector-v2.sh
@@ -50,7 +50,7 @@ if [ ! -f "${APP_DIR}/runtime.tar.gz" ];then
   existing_dirs=()
 
   for dir in "${directories[@]}"; do
-      if [ -d "$dir" ]; then
+      if [ -d "${APP_DIR}/${dir}" ]; then
           existing_dirs+=("$dir")
       fi
   done
@@ -58,7 +58,7 @@ if [ ! -f "${APP_DIR}/runtime.tar.gz" ];then
   if [ ${#existing_dirs[@]} -eq 0 ]; then
       echo "[connectors,lib,plugins] not existed, skip generate runtime.tar.gz"
   else
-      tar -zcvf runtime.tar.gz "${existing_dirs[@]}"
+      tar -zcvf "${APP_DIR}/runtime.tar.gz" -C "${APP_DIR}" "${existing_dirs[@]}"
   fi
 fi
 
diff --git a/seatunnel-core/seatunnel-flink-starter/seatunnel-flink-starter-common/src/main/java/org/apache/seatunnel/core/starter/flink/AbstractFlinkStarter.java b/seatunnel-core/seatunnel-flink-starter/seatunnel-flink-starter-common/src/main/java/org/apache/seatunnel/core/starter/flink/AbstractFlinkStarter.java
index bd2e29f026..803632ebc4 100644
--- a/seatunnel-core/seatunnel-flink-starter/seatunnel-flink-starter-common/src/main/java/org/apache/seatunnel/core/starter/flink/AbstractFlinkStarter.java
+++ b/seatunnel-core/seatunnel-flink-starter/seatunnel-flink-starter-common/src/main/java/org/apache/seatunnel/core/starter/flink/AbstractFlinkStarter.java
@@ -24,6 +24,7 @@ import org.apache.seatunnel.core.starter.enums.MasterType;
 import org.apache.seatunnel.core.starter.flink.args.FlinkCommandArgs;
 import org.apache.seatunnel.core.starter.utils.CommandLineUtils;
 
+import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
@@ -65,7 +66,10 @@ public abstract class AbstractFlinkStarter implements Starter {
         if (flinkCommandArgs.getMasterType() == MasterType.YARN_APPLICATION) {
             command.add(
                     String.format("-Dyarn.ship-files=\"%s\"", flinkCommandArgs.getConfigFile()));
-            command.add(String.format("-Dyarn.ship-archives=%s", RUNTIME_FILE));
+            command.add(
+                    String.format(
+                            "-Dyarn.ship-archives=\"%s\"",
+                            Paths.get(Common.getSeaTunnelHome(), RUNTIME_FILE)));
         }
         // set yarn application name
         if (flinkCommandArgs.getMasterType() == MasterType.YARN_APPLICATION
diff --git a/seatunnel-core/seatunnel-flink-starter/seatunnel-flink-starter-common/src/test/java/org/apache/seatunnel/core/starter/flink/TestFlinkParameter.java b/seatunnel-core/seatunnel-flink-starter/seatunnel-flink-starter-common/src/test/java/org/apache/seatunnel/core/starter/flink/TestFlinkParameter.java
index 6a30b86a8e..55b464a0cb 100644
--- a/seatunnel-core/seatunnel-flink-starter/seatunnel-flink-starter-common/src/test/java/org/apache/seatunnel/core/starter/flink/TestFlinkParameter.java
+++ b/seatunnel-core/seatunnel-flink-starter/seatunnel-flink-starter-common/src/test/java/org/apache/seatunnel/core/starter/flink/TestFlinkParameter.java
@@ -18,6 +18,7 @@ package org.apache.seatunnel.core.starter.flink;
 
 import org.apache.seatunnel.shade.com.typesafe.config.Config;
 
+import org.apache.seatunnel.common.config.Common;
 import org.apache.seatunnel.common.config.DeployMode;
 import org.apache.seatunnel.core.starter.flink.args.FlinkCommandArgs;
 import org.apache.seatunnel.core.starter.flink.utils.EnvironmentUtil;
@@ -31,9 +32,12 @@ import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
 import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.List;
 
+import static org.apache.seatunnel.core.starter.flink.AbstractFlinkStarter.RUNTIME_FILE;
+
 public class TestFlinkParameter {
 
     @Test
@@ -83,4 +87,20 @@ public class TestFlinkParameter {
         ExternalSettingLists.sort(null);
         Assertions.assertIterableEquals(checkList, ExternalSettingLists);
     }
+
+    /** Test the relevant configurations associated with the yarn application mode */
+    @Test
+    public void testBuildCommandsWithYarnApplicationMode() {
+        String[] args = {"--config", "/path/to/config.conf", "--target", "yarn-application"};
+        FlinkStarter starter = new FlinkStarter(args);
+
+        List<String> commands = starter.buildCommands();
+
+        // Assert
+        Assertions.assertTrue(
+                commands.contains(
+                        String.format(
+                                "-Dyarn.ship-archives=\"%s\"",
+                                Paths.get(Common.getSeaTunnelHome(), RUNTIME_FILE))));
+    }
 }