From 2280935400c87b5784cdc95203ba6b4f34dc4b4c Mon Sep 17 00:00:00 2001 From: bwcx_jzy Date: Fri, 12 May 2023 19:52:06 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E9=95=9C=E5=83=8F=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E5=AE=B9=E5=99=A8=E6=94=AF=E6=8C=81=E9=85=8D=E7=BD=AE=20hostna?= =?UTF-8?q?me=E3=80=81=E9=9B=86=E7=BE=A4=E6=9C=8D=E5=8A=A1=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E9=85=8D=E7=BD=AE=20hostname?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG-BETA.md | 1 + modules/server/src/main/resources/sql-view/alter.all.v1.3.csv | 2 +- .../main/java/org/dromara/jpom/DefaultDockerPluginImpl.java | 3 ++- .../java/org/dromara/jpom/DefaultDockerSwarmPluginImpl.java | 4 +++- web-vue/src/pages/docker/images.vue | 4 ++++ web-vue/src/pages/docker/swarm/service.vue | 4 ++++ 6 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG-BETA.md b/CHANGELOG-BETA.md index a4f3cbc69..1a673282e 100644 --- a/CHANGELOG-BETA.md +++ b/CHANGELOG-BETA.md @@ -5,6 +5,7 @@ ### 🐣 新增功能 1. 【server】新增 仓库支持导入导出 +2. 【server】新增 镜像创建容器支持配置 hostname、集群服务支持配置 hostname(感谢@心光) ### 🐞 解决BUG、优化功能 diff --git a/modules/server/src/main/resources/sql-view/alter.all.v1.3.csv b/modules/server/src/main/resources/sql-view/alter.all.v1.3.csv index 1140902ea..b962a2437 100644 --- a/modules/server/src/main/resources/sql-view/alter.all.v1.3.csv +++ b/modules/server/src/main/resources/sql-view/alter.all.v1.3.csv @@ -55,4 +55,4 @@ ADD,SCRIPT_EXECUTE_LOG,nodeName,String,50,,节点名称,false ADD,SCRIPT_INFO,workspaceName,String,50,,工作空间名称,false ADD,PROJECT_INFO,workspaceName,String,50,,工作空间名称,false ADD,SCRIPT_EXECUTE_LOG,workspaceName,String,50,,工作空间名称,false -ALTER,REPOSITORY,password,String,255,,登录密码,true +ALTER,REPOSITORY,password,String,255,,登录密码,false diff --git a/modules/sub-plugin/docker-cli/src/main/java/org/dromara/jpom/DefaultDockerPluginImpl.java b/modules/sub-plugin/docker-cli/src/main/java/org/dromara/jpom/DefaultDockerPluginImpl.java index f2a0d26f2..177db32ce 100644 --- a/modules/sub-plugin/docker-cli/src/main/java/org/dromara/jpom/DefaultDockerPluginImpl.java +++ b/modules/sub-plugin/docker-cli/src/main/java/org/dromara/jpom/DefaultDockerPluginImpl.java @@ -273,7 +273,8 @@ public class DefaultDockerPluginImpl implements IDockerConfigPlugin { return labelMap; }) .ifPresent(containerCmd::withLabels); - + String hostname = (String) parameter.get("hostname"); + Opt.ofBlankAble(hostname).ifPresent(containerCmd::withHostName); HostConfig hostConfig = HostConfig.newHostConfig(); Opt.ofBlankAble(runtime).ifPresent(hostConfig::withRuntime); List exposedPortList = new ArrayList<>(); diff --git a/modules/sub-plugin/docker-cli/src/main/java/org/dromara/jpom/DefaultDockerSwarmPluginImpl.java b/modules/sub-plugin/docker-cli/src/main/java/org/dromara/jpom/DefaultDockerSwarmPluginImpl.java index e52906567..182aaa4e8 100644 --- a/modules/sub-plugin/docker-cli/src/main/java/org/dromara/jpom/DefaultDockerSwarmPluginImpl.java +++ b/modules/sub-plugin/docker-cli/src/main/java/org/dromara/jpom/DefaultDockerSwarmPluginImpl.java @@ -25,6 +25,7 @@ package org.dromara.jpom; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.convert.Convert; import cn.hutool.core.io.unit.DataSize; +import cn.hutool.core.lang.Opt; import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.EnumUtil; import cn.hutool.core.util.ObjectUtil; @@ -325,7 +326,8 @@ public class DefaultDockerSwarmPluginImpl implements IDefaultPlugin { private ContainerSpec buildContainerSpec(Map parameter, ContainerSpec oldContainerSpec) { String image = (String) parameter.get("image"); ContainerSpec containerSpec = ObjectUtil.defaultIfNull(oldContainerSpec, new ContainerSpec()); - //new ContainerSpec(); + String hostname = (String) parameter.get("hostname"); + Opt.ofBlankAble(hostname).ifPresent(containerSpec::withHostname); containerSpec.withImage(image); // Collection> args = (Collection) parameter.get("args"); diff --git a/web-vue/src/pages/docker/images.vue b/web-vue/src/pages/docker/images.vue index f78a8c305..ff2e4dc2b 100644 --- a/web-vue/src/pages/docker/images.vue +++ b/web-vue/src/pages/docker/images.vue @@ -229,6 +229,9 @@ + + +