Commit e1b89d94 by Ivan

feat: update entrypoint

parent 997e9915
......@@ -93,23 +93,33 @@ else
git config --global --add safe.directory /rails/code
# 清空目录以确保没有隐藏文件干扰
rm -rf /rails/code/* /rails/code/.[!.]* 2>/dev/null || true
rm -rf /rails/code/* /rails/code/.[!.]* 2>/dev/null || { echo "Error removing files: $?"; }
# 检查是否安装了 git 命令
if ! command -v git &> /dev/null; then
echo "⚠️ Git command not found. Skipping Git operations."
else
# 检查是否能访问 Git 仓库
if git ls-remote --quiet ${GIT_REPOSITORY} &> /dev/null; then
if ! git ls-remote --quiet ${GIT_REPOSITORY} &> /tmp/git_error; then
echo "⚠️ Cannot access Git repository. Error details:"
cat /tmp/git_error
echo "Skipping Git operations."
else
# 尝试克隆仓库
echo "Cloning repository..."
if [ -n "${GIT_BRANCH}" ]; then
git clone --branch ${GIT_BRANCH} ${GIT_REPOSITORY} /rails/code || echo "Git clone failed, but continuing anyway"
else
git clone ${GIT_REPOSITORY} /rails/code || echo "Git clone failed, but continuing anyway"
if ! git clone --branch ${GIT_BRANCH} ${GIT_REPOSITORY} /rails/code 2> /tmp/git_clone_error; then
echo "Git clone failed with error:"
cat /tmp/git_clone_error
echo "Continuing anyway, but deployment may fail."
fi
else
echo "⚠️ Cannot access Git repository. Skipping Git operations."
if ! git clone ${GIT_REPOSITORY} /rails/code 2> /tmp/git_clone_error; then
echo "Git clone failed with error:"
cat /tmp/git_clone_error
echo "Continuing anyway, but deployment may fail."
fi
fi
fi
fi
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment