2015-10-13 11 views
5

テストを実行する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 

答えて

1

私は成功ケースの中でgit push --no-verifyと呼んで終了しました。したがって、効果的に2回プッシュします。

#!/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 
     # workaround to guarantee my push goes through even if the first attempt times out 
     git push --no-verify 
     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 
0

あなたがbitbucket.propertiesを確認しましたか?たぶん、process.timeout.executionplugin.bitbucket-scm-git.backend.timeout.idleのようなタイムアウトが発生している可能性があります。おそらくクイックチェックは、180秒に設定されたタイムアウトがあるかどうかを確認することです。 Hereには、利用可能なプロパティの詳細があります。

+0

これらのパラメータはどこで設定できますか? – saada

+0

@saada最新の回答をご覧ください。 – dan

+0

私たち自身のbitbucketサーバをホストしていないので、私はこれらのプロパティにアクセスできないと思います – saada

関連する問題