我在運行測試的git repo中有一個預推腳本。如果測試通過,推進繼續。如果測試失敗,它會中止推送。git pre-push:在運行測試時由遠程主機關閉連接
該腳本工作了一段時間,直到測試開始超過3分鐘。 stdout會在測試輸出中顯示「連接到由遠程主機關閉的bitbucket」。然後所有的測試都通過了,推送並沒有真正完成。
這裏的預推腳本
#!/bin/sh
DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# This script runs tests before any push to the MASTER branch and fails
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
echo "Current branch: "$current_branch
if [ $current_branch = "master" ]
then
echo "Pushing to MASTER branch requires tests to pass..."
./run.sh test
if [ $? = 0 ]
then
exit 0
else
echo "***ERROR> Failed to pass tests! Get tests to pass and then try again..."
exit 1
fi
else
echo "Skipping tests since we're not pushing to MASTER..."
fi
我可以在哪裏設置這些參數? – saada
@saada請參閱我的更新回答。 – dan
我們沒有託管我們自己的bitbucket服務器,所以我不認爲我有權訪問這些屬性 – saada