2015-10-13 14 views
5

मेरे पास मेरे गिट रेपो में प्री-पुश स्क्रिप्ट है जो परीक्षण चलाती है। यदि परीक्षण पास होते हैं, तो पुश चालू होता है। यदि परीक्षण विफल हो जाते हैं, तो यह पुश को रोक देता है।गिट प्री-पुश: परीक्षण चलते समय रिमोट होस्ट द्वारा कनेक्शन बंद

स्क्रिप्ट थोड़ी देर के लिए बहुत अच्छा काम करती है जब तक परीक्षण 3 मिनट से अधिक नहीं हो जाता। stdout परीक्षण आउटपुट के बीच में "रिमोट होस्ट द्वारा बंद बिटबकेट के लिए कनेक्शन" दिखाएं। फिर सभी परीक्षण पास हो जाते हैं और धक्का वास्तव में नहीं जाता है।

यहाँ पूर्व धक्का स्क्रिप्ट

#!/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 पर कॉल करना समाप्त कर दिया। तो यह प्रभावी ढंग से दो बार धक्का देता है।

#!/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.execution या plugin.bitbucket-scm-git.backend.timeout.idle। शायद एक त्वरित जांच यह देखने के लिए होगी कि 180 सेकंड में कुछ टाइमआउट सेट हैं या नहीं। Here आप उपलब्ध संपत्तियों के बारे में अधिक जानकारी प्राप्त कर सकते हैं।

+0

मैं उन पैरामीटर कहां सेट कर सकता हूं? – saada

+0

@saada कृपया मेरा अपडेट किया गया जवाब देखें। – dan

+0

हम अपने स्वयं के बिटबकेट सर्वर को होस्ट नहीं कर रहे हैं, इसलिए मुझे नहीं लगता कि मेरे पास इन गुणों तक पहुंच है – saada

संबंधित मुद्दे