From fa78c4275a532ec6b27d5ac7c5c72c9c4acaed0b Mon Sep 17 00:00:00 2001 From: aby913 Date: Tue, 28 May 2024 11:07:05 +0800 Subject: [PATCH 1/2] fix: curl download failure, as well as other errors --- build/installer/install_cmd.sh | 2 +- scripts/download-deps.sh | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build/installer/install_cmd.sh b/build/installer/install_cmd.sh index cd9a14a8..8e16372b 100644 --- a/build/installer/install_cmd.sh +++ b/build/installer/install_cmd.sh @@ -268,7 +268,7 @@ precheck_os() { # opy pre-installation dependency files if [ -d /opt/deps ]; then - ensure_success $sh_c "mv /opt/deps/* ${BASE_DIR}/install-wizard" + ensure_success $sh_c "mv /opt/deps/* ${BASE_DIR}" fi } diff --git a/scripts/download-deps.sh b/scripts/download-deps.sh index d52ec319..e89fd086 100644 --- a/scripts/download-deps.sh +++ b/scripts/download-deps.sh @@ -1,5 +1,6 @@ arch="amd64" part="" +CURL_TRY="--connect-timeout 30 --retry 5 --retry-delay 1 --retry-max-time 10 " cat ./dependencies.mf | while IFS= read -r line; do [[ -z "$line" ]] && continue @@ -31,9 +32,9 @@ cat ./dependencies.mf | while IFS= read -r line; do if [ "$part" == "components" ]; then if [ -z "$s2" ]; then - curl -L -o ./${part}/${file} ${s1} + curl ${CURL_TRY} -L -o ./${part}/${file} ${s1} else - curl -L -o ./${part}/${s2} ${s1} + curl ${CURL_TRY} -L -o ./${part}/${s2} ${s1} fi else s4=$(echo "$line" | cut -d',' -f4) @@ -43,7 +44,7 @@ cat ./dependencies.mf | while IFS= read -r line; do if [ ! -z ${s3} ]; then filename=${s3} fi - curl -L -o ${pkgpath}/${filename} ${s1} + curl ${CURL_TRY} -L -o ${pkgpath}/${filename} ${s1} if [ "$s4" == "helm" ]; then pushd ${pkgpath} From 0c8c64ea8761331ad12aa927a85160f1220c2096 Mon Sep 17 00:00:00 2001 From: aby913 Date: Tue, 28 May 2024 11:59:50 +0800 Subject: [PATCH 2/2] fix: fix some errors --- build/manifest/dependencies | 4 ++-- scripts/build-full.sh | 23 +++++++++++++---------- scripts/deps-manifest.sh | 7 +++---- scripts/upload-deps.sh | 6 +++--- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/build/manifest/dependencies b/build/manifest/dependencies index 9effea1b..6898e604 100644 --- a/build/manifest/dependencies +++ b/build/manifest/dependencies @@ -1,5 +1,5 @@ [components] format: url,filename -https://github.com/beclab/kubekey-ext/releases/download/${KKE_VERSION}/kubekey-ext-v0.1.20-linux-amd64.tar.gz, +https://github.com/beclab/kubekey-ext/releases/download/0.1.20/kubekey-ext-v0.1.20-linux-amd64.tar.gz, https://src.fedoraproject.org/lookaside/pkgs/socat/socat-1.7.3.2.tar.gz/sha512/540658b2a3d1b87673196282e5c62b97681bd0f1d1e4759ff9d72909d11060235ee9e9521a973603c1b00376436a9444248e5fbc0ffac65f8edb9c9bc28e7972/socat-1.7.3.2.tar.gz, https://github.com/fqrouter/conntrack-tools/archive/refs/tags/conntrack-tools-1.4.1.tar.gz, @@ -43,7 +43,7 @@ https://storage.googleapis.com/kubernetes-release/release/v1.22.10/bin/linux/amd https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-linux-x86_64,registry/compose/v2.2.2,docker-compose-linux-x86_64,, https://github.com/goharbor/harbor/releases/download/v2.5.3/harbor-offline-installer-v2.5.3.tgz,registry/harbor/v2.5.3,, -https://github.com/docker/distribution/releases/download/v2.7.1/registry-2.7.1.linux-amd64.tar.gz,registry/registry/2,, +https://github.com/kubesphere/kubekey/releases/download/v2.0.0-alpha.1/registry-2-linux-amd64.tar.gz,registry/registry/2,, https://github.com/opencontainers/runc/releases/download/v1.1.1/runc.amd64,runc/v1.1.1,, https://github.com/opencontainers/runc/releases/download/v1.1.4/runc.amd64,runc/v1.1.4,, \ No newline at end of file diff --git a/scripts/build-full.sh b/scripts/build-full.sh index e4f4b5c1..e9da4137 100644 --- a/scripts/build-full.sh +++ b/scripts/build-full.sh @@ -5,6 +5,7 @@ BASE_DIR=$(dirname $(realpath -s $0)) rm -rf ${BASE_DIR}/../.dist rm -rf ${BASE_DIR}/../.manifest +rm -rf ${BASE_DIR}/../.dependencies DIST_PATH="${BASE_DIR}/../.dist/install-wizard" VERSION=$1 @@ -19,9 +20,11 @@ bash ${BASE_DIR}/deps-manifest.sh pushd ${BASE_DIR}/../.manifest bash $BASE_DIR/save-images.sh images.mf -bash $BASE_DIR/save-deps.sh popd +pushd ${BASE_DIR}/../.dependencies +bash $BASE_DIR/save-deps.sh +popd pushd $DIST_PATH @@ -29,17 +32,17 @@ rm -rf images rm -rf components rm -rf pkg -if [ -d ${BASE_DIR}/../.manifest/images ]; then - mv ${BASE_DIR}/../.manifest/images images -fi -if [ -d ${BASE_DIR}/../.manifest/components ]; then - mv ${BASE_DIR}/../.manifest/components components +mv ${BASE_DIR}/../.manifest images + + +if [ -d ${BASE_DIR}/../.dependencies/components ]; then + mv ${BASE_DIR}/../.dependencies/components components fi -if [ -d ${BASE_DIR}/../.manifest/pkg ]; then - mv ${BASE_DIR}/../.manifest/pkg pkg +if [ -d ${BASE_DIR}/../.dependencies/pkg ]; then + mv ${BASE_DIR}/../.dependencies/pkg pkg fi -if [ -f ${BASE_DIR}/../.manifest/dependencies.mf ]; then - cp ${BASE_DIR}/../.manifest/dependencies.mf ./ +if [ -f ${BASE_DIR}/../.dependencies/dependencies.mf ]; then + cp ${BASE_DIR}/../.dependencies/dependencies.mf ./ fi if [[ "$OSTYPE" == "darwin"* ]]; then diff --git a/scripts/deps-manifest.sh b/scripts/deps-manifest.sh index f47f3576..f5ddc5e5 100644 --- a/scripts/deps-manifest.sh +++ b/scripts/deps-manifest.sh @@ -1,10 +1,9 @@ #!/usr/bin/env bash BASE_DIR=$(dirname $(realpath -s $0)) -DEPENDENCIES_MANIFEST=".manifest/dependencies.mf" +DEPENDENCIES_MANIFEST=".dependencies/dependencies.mf" -if [ ! -d .manifest ]; then - mkdir -p .manifest -fi +rm -rf .dependencies +mkdir -p .dependencies cp $BASE_DIR/../build/manifest/dependencies ${DEPENDENCIES_MANIFEST} diff --git a/scripts/upload-deps.sh b/scripts/upload-deps.sh index 01b14982..582d8da4 100644 --- a/scripts/upload-deps.sh +++ b/scripts/upload-deps.sh @@ -3,11 +3,11 @@ BASE_DIR=$(dirname $(realpath -s $0)) echo "Push Deps to S3 base_dir: ${BASE_DIR}" -if [ ! -d ".manifest" ]; then +if [ ! -d ".dependencies" ]; then exit 1 fi -pushd ${BASE_DIR}/../.manifest +pushd ${BASE_DIR}/../.dependencies fileprefix="deps" name=$(md5sum dependencies.mf |awk '{print $1}') echo "filename: ${fileprefix}-${name}.tar.gz" @@ -26,7 +26,7 @@ if [ $? -ne 0 ]; then echo "dependencies file ${fileprefix}-${name}.tar.gz not found, prepare to upload to S3" tar -czf ./$name.tar.gz ./components ./pkg ./dependencies.mf && cp ./$name.tar.gz ../ popd - rm -rf ./.manifest/ + rm -rf ./.dependencies/ aws s3 cp $name.tar.gz s3://terminus-os-install/${fileprefix}-$name.tar.gz --acl=public-read echo "upload $name completed" else