From 5613c4fe7c4d8b74a7f2a4c6eeed3466e033cd55 Mon Sep 17 00:00:00 2001 From: zhuxuetong <594754793@qq.com> Date: Fri, 7 Jun 2024 16:44:49 +0800 Subject: [PATCH 1/4] reduce the distribution file size --- dolphinscheduler-dist/pom.xml | 20 ++++++++++ .../src/main/assembly/create-symlinks.sh | 38 +++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 dolphinscheduler-dist/src/main/assembly/create-symlinks.sh diff --git a/dolphinscheduler-dist/pom.xml b/dolphinscheduler-dist/pom.xml index ee4c85589e..de259f3c2d 100644 --- a/dolphinscheduler-dist/pom.xml +++ b/dolphinscheduler-dist/pom.xml @@ -118,6 +118,26 @@ + + org.codehaus.mojo + exec-maven-plugin + 3.3.0 + + + create-symlinks + + exec + + package + + sh + + ${basedir}/../dolphinscheduler-dist/src/main/assembly/create-symlinks.sh + + + + + diff --git a/dolphinscheduler-dist/src/main/assembly/create-symlinks.sh b/dolphinscheduler-dist/src/main/assembly/create-symlinks.sh new file mode 100644 index 0000000000..e0069719c1 --- /dev/null +++ b/dolphinscheduler-dist/src/main/assembly/create-symlinks.sh @@ -0,0 +1,38 @@ +#!/bin/bash +script_dir=`dirname $0` +cd $script_dir/../../../target +package_file=`ls apache-dolphinscheduler-*-bin.tar.gz` +echo $package_file +decompress_dirname="${package_file%.tar.gz}" +rm -rf $decompress_dirname +#Decompress package file +tar -xf $package_file +cd $decompress_dirname + +SHARED_LIB_DIR="libs" +# create share lib directory +mkdir -p $SHARED_LIB_DIR + +echo 'iterate through the lib directory for all subprojects' +for module in api-server master-server worker-server alert-server tools; do + MODULE_LIB_DIR="$module/libs" + echo "handling $MODULE_LIB_DIR" + + if [ -d "$MODULE_LIB_DIR" ]; then + cd $MODULE_LIB_DIR + + for jar in `ls *.jar`; do + # Move jar file to share lib directory + mv $jar ../../$SHARED_LIB_DIR/ + + # Create a symbolic link in the subproject's lib directory + ln -s ../../$SHARED_LIB_DIR/$jar . + done + + cd - > /dev/null + fi +done +#Recompress the package +cd .. +tar -zcf $package_file $decompress_dirname +rm -rf $decompress_dirname \ No newline at end of file From 28ef735387f1e99e4a4b7663d4fe93bb045c946b Mon Sep 17 00:00:00 2001 From: zhuxuetong <594754793@qq.com> Date: Tue, 11 Jun 2024 16:32:40 +0800 Subject: [PATCH 2/4] add licence header --- .../src/main/assembly/create-symlinks.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/dolphinscheduler-dist/src/main/assembly/create-symlinks.sh b/dolphinscheduler-dist/src/main/assembly/create-symlinks.sh index e0069719c1..6287414fac 100644 --- a/dolphinscheduler-dist/src/main/assembly/create-symlinks.sh +++ b/dolphinscheduler-dist/src/main/assembly/create-symlinks.sh @@ -1,4 +1,21 @@ #!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + script_dir=`dirname $0` cd $script_dir/../../../target package_file=`ls apache-dolphinscheduler-*-bin.tar.gz` From 03265451e32d2fcd1fd91146eeb307ec29adfaea Mon Sep 17 00:00:00 2001 From: zhuxuetong <594754793@qq.com> Date: Tue, 11 Jun 2024 17:17:57 +0800 Subject: [PATCH 3/4] add set -xeuo pipefail --- dolphinscheduler-dist/src/main/assembly/create-symlinks.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/dolphinscheduler-dist/src/main/assembly/create-symlinks.sh b/dolphinscheduler-dist/src/main/assembly/create-symlinks.sh index 6287414fac..89f53eecc5 100644 --- a/dolphinscheduler-dist/src/main/assembly/create-symlinks.sh +++ b/dolphinscheduler-dist/src/main/assembly/create-symlinks.sh @@ -16,6 +16,7 @@ # limitations under the License. # +set -xeuo pipefail script_dir=`dirname $0` cd $script_dir/../../../target package_file=`ls apache-dolphinscheduler-*-bin.tar.gz` From a42a0adb476e889d341531bfd92b21f6cfec71b6 Mon Sep 17 00:00:00 2001 From: zhuxuetong <594754793@qq.com> Date: Tue, 11 Jun 2024 17:57:58 +0800 Subject: [PATCH 4/4] add set -eu --- dolphinscheduler-dist/src/main/assembly/create-symlinks.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dolphinscheduler-dist/src/main/assembly/create-symlinks.sh b/dolphinscheduler-dist/src/main/assembly/create-symlinks.sh index 89f53eecc5..ca0401f603 100644 --- a/dolphinscheduler-dist/src/main/assembly/create-symlinks.sh +++ b/dolphinscheduler-dist/src/main/assembly/create-symlinks.sh @@ -16,7 +16,7 @@ # limitations under the License. # -set -xeuo pipefail +set -eu script_dir=`dirname $0` cd $script_dir/../../../target package_file=`ls apache-dolphinscheduler-*-bin.tar.gz`