From 804cdba152d9c77d480d000a2998c908a8136ca8 Mon Sep 17 00:00:00 2001 From: liyi Date: Sat, 17 May 2025 10:42:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=B0=83=E6=95=B4ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 2 ++ scripts/bundle_install_and_auto_add.sh | 39 ++++++-------------------- 2 files changed, 11 insertions(+), 30 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e0452619..f6716abe 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -81,6 +81,7 @@ variables: - export NEXT_VERSION="$(cat app_new.version)" - bash scripts/bundle_install_and_auto_add.sh android/Gemfile vendor/bundle_android "bundle exec fastlane -v" - gem pristine --all || true # 修复所有未编译的gem扩展 + - echo -e "---\n:backtrace: false\n:bulk_threshold: 1000\n:sources:\n- https://rubygems.org\n:update_sources: true\n:verbose: true" > ~/.gemrc script: # 输出调试信息,便于后续排查环境问题 - echo "=== DEBUG INFO (android) ===" @@ -115,6 +116,7 @@ variables: - export NEXT_VERSION="$(cat app_new.version)" - bash scripts/bundle_install_and_auto_add.sh ios/Gemfile vendor/bundle_ios "bundle exec fastlane -v" - gem pristine --all || true # 修复所有未编译的gem扩展 + - echo -e "---\n:backtrace: false\n:bulk_threshold: 1000\n:sources:\n- https://rubygems.org\n:update_sources: true\n:verbose: true" > ~/.gemrc script: # 输出调试信息,便于后续排查环境问题 - echo "=== DEBUG INFO (ios) ===" diff --git a/scripts/bundle_install_and_auto_add.sh b/scripts/bundle_install_and_auto_add.sh index 61fce330..84fd6d2d 100644 --- a/scripts/bundle_install_and_auto_add.sh +++ b/scripts/bundle_install_and_auto_add.sh @@ -46,36 +46,15 @@ if [ $success -eq 1 ]; then exit 0 fi -# 2. 统一执行镜像切换和重试的bundle install -try_count=0 -max_try=3 -success=0 -bundle config mirror.https://rubygems.org https://mirrors.aliyun.com/rubygems/ -while [ $try_count -lt $max_try ]; do - echo "[INFO] 第$((try_count+1))次尝试使用阿里云镜像 bundle install..." - bundle config set --local path "$BUNDLE_PATH" - bundle install --gemfile "$GEMFILE_PATH" - if [ $? -eq 0 ]; then - echo "[SUCCESS] 使用阿里云镜像 bundle install 成功" - success=1 - break - fi - try_count=$((try_count+1)) - sleep 2 - echo "[WARN] 阿里云镜像 bundle install 第$try_count 次失败,准备重试..." -done - -if [ $success -eq 0 ]; then - echo "[ERROR] 阿里云镜像 bundle install 失败$max_try次,切换为官方源重试..." - bundle config mirror.https://rubygems.org https://rubygems.org - bundle config set --local path "$BUNDLE_PATH" - bundle install --gemfile "$GEMFILE_PATH" - if [ $? -eq 0 ]; then - echo "[SUCCESS] 官方源 bundle install 成功" - else - echo "[FATAL] 官方源 bundle install 依然失败,请检查网络或Gemfile配置。" - exit 2 - fi +# 2. 只用 rubygems.org 官方源进行 bundle install +bundle config mirror.https://rubygems.org https://rubygems.org +bundle config set --local path "$BUNDLE_PATH" +bundle install --gemfile "$GEMFILE_PATH" +if [ $? -eq 0 ]; then + echo "[SUCCESS] 官方源 bundle install 成功" +else + echo "[FATAL] 官方源 bundle install 失败,请检查网络或Gemfile配置。" + exit 2 fi # 3. 最后再执行一次主命令校验