fix:增加bundle install重试脚本
This commit is contained in:
parent
8e122e5a09
commit
e809adf98f
@ -76,8 +76,7 @@ variables:
|
|||||||
- bundle -v || gem install bundler --source https://gems.ruby-china.com/
|
- bundle -v || gem install bundler --source https://gems.ruby-china.com/
|
||||||
- ls -li
|
- ls -li
|
||||||
- export NEXT_VERSION="$(cat app_new.version)"
|
- export NEXT_VERSION="$(cat app_new.version)"
|
||||||
- bundle config set --local path 'vendor/bundle_android' # Android独立依赖目录
|
- bash scripts/bundle_install_retry.sh android/Gemfile vendor/bundle_android
|
||||||
- bundle install --gemfile android/Gemfile # 去掉--quiet,便于观察进度
|
|
||||||
- gem pristine --all || true # 修复所有未编译的gem扩展
|
- gem pristine --all || true # 修复所有未编译的gem扩展
|
||||||
script:
|
script:
|
||||||
# 输出调试信息,便于后续排查环境问题
|
# 输出调试信息,便于后续排查环境问题
|
||||||
@ -108,8 +107,7 @@ variables:
|
|||||||
- bundle -v || gem install bundler --source https://gems.ruby-china.com/
|
- bundle -v || gem install bundler --source https://gems.ruby-china.com/
|
||||||
- ls -li
|
- ls -li
|
||||||
- export NEXT_VERSION="$(cat app_new.version)"
|
- export NEXT_VERSION="$(cat app_new.version)"
|
||||||
- bundle config set --local path 'vendor/bundle_ios' # iOS独立依赖目录
|
- bash scripts/bundle_install_retry.sh ios/Gemfile vendor/bundle_ios
|
||||||
- bundle install --gemfile ios/Gemfile # 去掉--quiet,便于观察进度
|
|
||||||
- gem pristine --all || true # 修复所有未编译的gem扩展
|
- gem pristine --all || true # 修复所有未编译的gem扩展
|
||||||
script:
|
script:
|
||||||
# 输出调试信息,便于后续排查环境问题
|
# 输出调试信息,便于后续排查环境问题
|
||||||
|
|||||||
46
scripts/bundle_install_retry.sh
Normal file
46
scripts/bundle_install_retry.sh
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# 用法: ./scripts/bundle_install_retry.sh <gemfile_path> <bundle_path>
|
||||||
|
# 例如: ./scripts/bundle_install_retry.sh android/Gemfile vendor/bundle_android
|
||||||
|
|
||||||
|
GEMFILE_PATH="$1"
|
||||||
|
BUNDLE_PATH="$2"
|
||||||
|
|
||||||
|
if [ -z "$GEMFILE_PATH" ] || [ -z "$BUNDLE_PATH" ]; then
|
||||||
|
echo "用法: $0 <gemfile_path> <bundle_path>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
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 成功"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "[FATAL] 官方源 bundle install 依然失败,请检查网络或Gemfile配置。"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
Loading…
x
Reference in New Issue
Block a user