码迷,mamicode.com
首页 > 其他好文 > 详细

sos-ci start-ci.sh脚本分析

时间:2019-07-24 18:00:42      阅读:128      评论:0      收藏:0      [点我收藏+]

标签:count   bash   contain   while   gerrit   rpo   tac   purpose   change   

从第3行到第6行,看出此脚本的执行目录是在上一层目录。

sos-ci git:(master) cat -n start-ci.sh
     1    #!/bin/bash
     2    
     3    mkdir sos-data
     4    
     5    cd sos-ci
     6    ./set-env-to-vars.sh
     7    
     8    COUNTER=0
     9    
    10    # Loop until ps aux | grep -> exit code 0 """sendmail: MTA: accepting connections"""
    11    # sleep every 2 seconds, after 50 counts, re-execute /etc/init.d/sendmail start &
    12    # after 300 counts, exit with 1 if grep still returns null
    13    
    14    command="/etc/init.d/sendmail start &"
    15    grep_command="ps aux | grep ‘sendmail: MTA: accepting connections‘"
    16    
    17    while [ $COUNTER -lt 300 ]   //调用sendmail,每100秒执行一次,共600秒。
    18    do
    19        if [ $COUNTER -eq 0 ] || [ $(($COUNTER % 50)) -eq 0 ]; then
    20            $command
    21        fi
    22        eval $grep_command
    23        if [ $? -eq 0 ]; then
    24            break
    25        else
    26            COUNTER=$((COUNTER+1))
    27            echo "Waiting for sendmail to start - Counter: $COUNTER"
    28            sleep 2
    29        fi
    30        if [ $COUNTER -eq 299 ]; then
    31            echo "FATAL ERROR: SENDMAIL FAILED TO START"
    32            exit 1
    33        fi
    34    done
    35    
    36    # os_ci is the main sos-ci code which will run the entire pipeline
    37    # this will listen to gerrit event stream and put the patchsets to the queue and perform tempest testing on them
    38    
    39    if [ ${#test_it_patch_num} -gt 1 ]
    40    then
    41        python sos-ci/testit.py  $test_it_patch_num /sos-data
    42    else
    43        python sos-ci/os_ci.py
    44    fi
    45    
    46    
    47    # testit.py is for testing purpose
    48    # this will run the entire process(install devstack, run tempest, publish logs) with one patchset that has been pushed to gerrit
    49    # patchset is of the form ‘refs/changes/26/111226/3‘
    50    # results_dir is of the form ‘/home/user/test-dir‘
    51    # python sos-ci/testit.py  <ref-patchset-num> <result-dir-location>
    52    
    53    
    54    #python sos-ci/testit.py  refs/changes/03/617503/11 /sos-data
    55    
    56    # Use in debug mode to keep container alive after any failure for RCA
    57    if [ -n "$STAGE" ]
    58    then tail -f /dev/null
    59    fi#                        

sos-ci start-ci.sh脚本分析

标签:count   bash   contain   while   gerrit   rpo   tac   purpose   change   

原文地址:https://www.cnblogs.com/longchang/p/11239647.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!