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

hello-stephen pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.1 by this push:
     new bfd67dd3c39 [branch-4.1](docker) pass env options through 
doris-compose up (#64623)
bfd67dd3c39 is described below

commit bfd67dd3c394256febb54509a090d5705acf86c7
Author: Selectdb Robot <[email protected]>
AuthorDate: Wed Jul 22 16:32:01 2026 +0800

    [branch-4.1](docker) pass env options through doris-compose up (#64623)
    
    ## Summary
    - Add the missing --env option to doris-compose up on branch-4.1.
    - Pass user-provided environment variables through Cluster.new and merge
    them into container envs.
    - Keep ENABLE_STORAGE_VAULT detection using the parsed env list.
    
    ## Testing
    - python3 -m py_compile docker/runtime/doris-compose/command.py
    docker/runtime/doris-compose/cluster.py
    - uv run --no-project ... python3
    docker/runtime/doris-compose/doris-compose.py up --help
    
    ## Links
    - Jira: DORIS-26336
    - Jira: DORIS-26392
    
    Co-authored-by: Dongyang Li <[email protected]>
---
 docker/runtime/doris-compose/cluster.py | 17 ++++++++++++++---
 docker/runtime/doris-compose/command.py | 14 ++++++++++++--
 2 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/docker/runtime/doris-compose/cluster.py 
b/docker/runtime/doris-compose/cluster.py
index 7013c710bea..f28ee157e71 100644
--- a/docker/runtime/doris-compose/cluster.py
+++ b/docker/runtime/doris-compose/cluster.py
@@ -453,6 +453,16 @@ class Node(object):
             elif self.node_type() == Node.TYPE_BE:
                 envs["LLVM_PROFILE_FILE_PREFIX"] = outfile
 
+        user_envs = getattr(self.cluster, "env", [])
+        if user_envs:
+            for env in user_envs:
+                pos = env.find('=')
+                if pos == -1:
+                    raise Exception(
+                        f"env '{env}' error format, should be like 
'name=value'"
+                    )
+                envs[env[:pos]] = env[pos + 1:]
+
         return envs
 
     def entrypoint(self):
@@ -885,7 +895,7 @@ class Cluster(object):
     def __init__(self, name, subnet, image, is_cloud, is_root_user, fe_config,
                  be_config, ms_config, recycle_config, remote_master_fe,
                  local_network_ip, fe_follower, be_disks, be_cluster, reg_be,
-                 extra_hosts, coverage_dir, cloud_store_config,
+                 extra_hosts, env, coverage_dir, cloud_store_config,
                  sql_mode_node_mgr, be_metaservice_endpoint, be_cluster_id, 
tde_ak, tde_sk,
                  tde_aws_ak, tde_aws_sk, tde_aliyun_ak, tde_aliyun_sk,
                  external_ms_cluster, instance_id, cluster_snapshot="",
@@ -906,6 +916,7 @@ class Cluster(object):
         self.be_cluster = be_cluster
         self.reg_be = reg_be
         self.extra_hosts = extra_hosts
+        self.env = env
         self.coverage_dir = coverage_dir
         self.cloud_store_config = cloud_store_config
         self.external_ms_cluster = external_ms_cluster
@@ -936,7 +947,7 @@ class Cluster(object):
     @staticmethod
     def new(name, image, is_cloud, is_root_user, fe_config, be_config,
             ms_config, recycle_config, remote_master_fe, local_network_ip,
-            fe_follower, be_disks, be_cluster, reg_be, extra_hosts,
+            fe_follower, be_disks, be_cluster, reg_be, extra_hosts, env,
             coverage_dir, cloud_store_config, sql_mode_node_mgr,
             be_metaservice_endpoint, be_cluster_id, tde_ak, tde_sk,
             tde_aws_ak, tde_aws_sk, tde_aliyun_ak, tde_aliyun_sk,
@@ -953,7 +964,7 @@ class Cluster(object):
             cluster = Cluster(name, subnet, image, is_cloud, is_root_user,
                               fe_config, be_config, ms_config, recycle_config,
                               remote_master_fe, local_network_ip, fe_follower,
-                              be_disks, be_cluster, reg_be, extra_hosts,
+                              be_disks, be_cluster, reg_be, extra_hosts, env,
                               coverage_dir, cloud_store_config,
                               sql_mode_node_mgr, be_metaservice_endpoint,
                               be_cluster_id, tde_ak, tde_sk, tde_aws_ak, 
tde_aws_sk,
diff --git a/docker/runtime/doris-compose/command.py 
b/docker/runtime/doris-compose/command.py
index a0181edec91..03bcc755246 100644
--- a/docker/runtime/doris-compose/command.py
+++ b/docker/runtime/doris-compose/command.py
@@ -438,6 +438,15 @@ class UpCommand(Command):
             "Add custom host-to-IP mappings (host:ip). For example: 
--extra-hosts myhost1:192.168.10.1 myhost2:192.168.10.2 . Only use when 
creating new cluster."
         )
 
+        parser.add_argument(
+            "--env",
+            nargs="*",
+            type=str,
+            default=[],
+            help=
+            "Add environment variables. For example: --env KEY1=VALUE1 
KEY2=VALUE2. Only use when creating new cluster."
+        )
+
         parser.add_argument(
             "--cloud-config",
             nargs="*",
@@ -679,15 +688,16 @@ class UpCommand(Command):
 
             instance_id = getattr(args, 'instance_id', None)
             cluster_snapshot = getattr(args, 'cluster_snapshot', '')
+            env = getattr(args, 'env', []) or []
             enable_storage_vault = CLUSTER.is_true(
-                CLUSTER.get_env_value(args.env, "ENABLE_STORAGE_VAULT"))
+                CLUSTER.get_env_value(env, "ENABLE_STORAGE_VAULT"))
 
             cluster = CLUSTER.Cluster.new(
                 args.NAME, args.IMAGE, args.cloud, args.root, args.fe_config,
                 args.be_config, args.ms_config, args.recycle_config,
                 args.remote_master_fe, args.local_network_ip, args.fe_follower,
                 args.be_disks if args.be_disks is not None else ["HDD=1"],
-                args.be_cluster, args.reg_be, args.extra_hosts,
+                args.be_cluster, args.reg_be, args.extra_hosts, env,
                 args.coverage_dir, cloud_store_config, args.sql_mode_node_mgr,
                 args.be_metaservice_endpoint, args.be_cluster_id, args.tde_ak, 
args.tde_sk,
                 args.tde_aws_ak, args.tde_aws_sk, args.tde_aliyun_ak, 
args.tde_aliyun_sk,


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to