2017-03-31 102 views

回答

0

當詹金斯從磁盤重新加載時,它會向所有http請求返回「等待重新加載」頁面。要等待Jenkins再次開始響應請求,請使用類似以下bash代碼的內容。 crumb請求被用作簡單的Jenkins請求。任何其他請求都可以。

curl -s -X POST -H ${CRUMB} -u user:token "http://jenkinsurl/reload" 

    #Give Jenkins time to reload 
    CRUMB=$(curl -s 'http://user:[email protected]/crumbIssuer/api/xml?\ 
    xpath=concat(//crumbRequestField,":",//crumb)') 
    while echo ${CRUMB} | grep reload; do 
     echo "Waiting for reload to complete" 
     sleep 10 
     CRUMB=$(curl -s 'http://user:[email protected]/crumbIssuer/api/xml?\ 
     xpath=concat(//crumbRequestField,":",//crumb)') 
    done