diff options
-rw-r--r-- | jjb/armband/armband-ci-jobs.yml | 66 | ||||
-rw-r--r-- | jjb/compass4nfv/compass-ci-jobs.yml | 76 | ||||
-rwxr-xr-x | jjb/dovetail/dovetail-run.sh | 33 | ||||
-rw-r--r-- | jjb/fuel/fuel-daily-jobs.yml | 67 | ||||
-rw-r--r-- | jjb/functest/functest-daily-jobs.yml | 256 | ||||
-rw-r--r-- | jjb/global/releng-macros.yml | 1 | ||||
-rw-r--r-- | jjb/qtip/qtip-experimental-jobs.yml | 18 | ||||
-rw-r--r-- | jjb/qtip/qtip-validate-jobs.yml | 22 | ||||
-rw-r--r-- | jjb/releng/functest-docker.yml | 13 | ||||
-rw-r--r-- | jjb/releng/opnfv-utils.yml | 15 | ||||
-rwxr-xr-x | jjb/xci/xci-run-functest.sh | 12 | ||||
-rwxr-xr-x | jjb/xci/xci-set-scenario.sh | 80 | ||||
-rwxr-xr-x | jjb/xci/xci-start-deployment.sh | 12 | ||||
-rwxr-xr-x | jjb/xci/xci-start-new-vm.sh | 13 | ||||
-rw-r--r-- | jjb/xci/xci-verify-jobs.yml | 46 | ||||
-rwxr-xr-x | jjb/yardstick/yardstick-daily.sh | 2 | ||||
-rw-r--r-- | utils/build-server-ansible/vars/docker-compose-CentOS.yml (renamed from utils/build-server-ansible/vars/docker-compose-Centos.yml) | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | utils/slave-monitor-0.1.sh | 101 |
18 files changed, 482 insertions, 351 deletions
diff --git a/jjb/armband/armband-ci-jobs.yml b/jjb/armband/armband-ci-jobs.yml index da3992ea8..80445019a 100644 --- a/jjb/armband/armband-ci-jobs.yml +++ b/jjb/armband/armband-ci-jobs.yml @@ -159,20 +159,60 @@ failure-threshold: 'never' unstable-threshold: 'FAILURE' # 1.here the stream means the SUT stream, dovetail stream is defined in its own job - # 2.only debug testsuite here(refstack, ha, vping, ipv6, tempest, bgpvpn) - # 3.not used for release criteria or compliance, + # 2.testsuite proposed_tests here is for new test cases planning to add into OVP + # 3.run proposed_tests on Monday, Wednesday and Friday against ha scenario + # 4.testsuite default here is for the test cases already added into OVP + # 5.run default testsuite on Tuesday against ha scenario + # 6.not used for release criteria or compliance, # only to debug the dovetail tool bugs with arm pods - - trigger-builds: - - project: 'dovetail-{installer}-{pod}-proposed_tests-{stream}' - current-parameters: false - predefined-parameters: - DEPLOY_SCENARIO={scenario} - block: true - same-node: true - block-thresholds: - build-step-failure-threshold: 'never' - failure-threshold: 'never' - unstable-threshold: 'FAILURE' + - conditional-step: + condition-kind: and + condition-operands: + - condition-kind: regex-match + regex: '*-ha' + label: '{scenario}' + - condition-kind: day-of-week + day-selector: select-days + days: + MON: true + WED: true + FRI: true + use-build-time: true + steps: + - trigger-builds: + - project: 'dovetail-{installer}-{pod}-proposed_tests-{stream}' + current-parameters: false + predefined-parameters: + DEPLOY_SCENARIO={scenario} + block: true + same-node: true + block-thresholds: + build-step-failure-threshold: 'never' + failure-threshold: 'never' + unstable-threshold: 'FAILURE' + - conditional-step: + condition-kind: and + condition-operands: + - condition-kind: regex-match + regex: '*-ha' + label: '{scenario}' + - condition-kind: day-of-week + day-selector: select-days + days: + TUES: true + use-build-time: true + steps: + - trigger-builds: + - project: 'dovetail-{installer}-{pod}-default-{stream}' + current-parameters: false + predefined-parameters: + DEPLOY_SCENARIO={scenario} + block: true + same-node: true + block-thresholds: + build-step-failure-threshold: 'never' + failure-threshold: 'never' + unstable-threshold: 'FAILURE' # Armband uses Fuel's log collection project job, no need to duplicate - conditional-step: condition-kind: not diff --git a/jjb/compass4nfv/compass-ci-jobs.yml b/jjb/compass4nfv/compass-ci-jobs.yml index 81d76d559..7ce9e3a60 100644 --- a/jjb/compass4nfv/compass-ci-jobs.yml +++ b/jjb/compass4nfv/compass-ci-jobs.yml @@ -123,6 +123,12 @@ - 'os-nosdn-bar-ha': disabled: false auto-trigger-name: 'compass-{scenario}-{pod}-{stream}-trigger' + - 'k8-nosdn-stor4nfv-ha': + disabled: false + auto-trigger-name: 'compass-{scenario}-{pod}-{stream}-trigger' + - 'k8-nosdn-stor4nfv-noha': + disabled: false + auto-trigger-name: 'compass-{scenario}-{pod}-{stream}-trigger' jobs: - 'compass-{scenario}-{pod}-daily-{stream}' @@ -168,9 +174,7 @@ installer: '{installer}' gs-pathname: '{gs-pathname}' ppa-pathname: '{ppa-pathname}' - - string: - name: DEPLOY_SCENARIO - default: '{scenario}' + scenario: '{scenario}' - '{slave-label}-defaults' - '{installer}-defaults' @@ -338,6 +342,7 @@ installer: '{installer}' gs-pathname: '{gs-pathname}' ppa-pathname: '{ppa-pathname}' + scenario: '{scenario}' - '{slave-label}-defaults' - '{installer}-defaults' @@ -384,6 +389,7 @@ installer: '{installer}' gs-pathname: '{gs-pathname}' ppa-pathname: '{ppa-pathname}' + scenario: '{scenario}' - '{slave-label}-defaults' - '{installer}-defaults' @@ -429,6 +435,17 @@ name: LOG_DIRECTORY default: $WORKSPACE/log_output description: "Directory where the logs will be located upon the completion of the collection." + - string: + name: DEPLOY_SCENARIO + default: '{scenario}' + description: "Scenario to deploy with." + - string: + name: COMPASS_OS_VERSION + default: '' + - string: + name: COMPASS_OPENSTACK_VERSION + default: '' + ######################## # trigger macros @@ -484,11 +501,15 @@ - trigger: name: 'compass-k8-nosdn-nofeature-ha-baremetal-centos-master-trigger' triggers: - - timed: '' + - timed: '0 6 * * *' - trigger: name: 'compass-os-nosdn-bar-ha-baremetal-centos-master-trigger' triggers: - timed: '' # '0 19 * * *' +- trigger: + name: 'compass-k8-nosdn-stor4nfv-ha-baremetal-centos-master-trigger' + triggers: + - timed: '' # ---------------------------- # noha-baremetal-centos-master @@ -517,6 +538,11 @@ name: 'compass-os-nosdn-ovs_dpdk-noha-baremetal-centos-master-trigger' triggers: - timed: '' +- trigger: + name: 'compass-k8-nosdn-stor4nfv-noha-baremetal-centos-master-trigger' + triggers: + - timed: '' + # -------------------------- # ha-huawei-pod7-danube @@ -573,6 +599,10 @@ name: 'compass-os-nosdn-bar-ha-huawei-pod7-danube-trigger' triggers: - timed: '' # '0 19 * * *' +- trigger: + name: 'compass-k8-nosdn-stor4nfv-ha-huawei-pod7-danube-trigger' + triggers: + - timed: '' # ---------------------------- # noha-huawei-pod7-danube @@ -601,6 +631,10 @@ name: 'compass-os-nosdn-ovs_dpdk-noha-huawei-pod7-danube-trigger' triggers: - timed: '' +- trigger: + name: 'compass-k8-nosdn-stor4nfv-noha-huawei-pod7-danube-trigger' + triggers: + - timed: '' # ------------------- # ha-baremetal-master @@ -648,7 +682,7 @@ - trigger: name: 'compass-k8-nosdn-nofeature-ha-baremetal-master-trigger' triggers: - - timed: '' + - timed: '0 10 2-30/2 * *' - trigger: name: 'compass-os-odl-sfc-ha-baremetal-master-trigger' triggers: @@ -657,6 +691,10 @@ name: 'compass-os-nosdn-bar-ha-baremetal-master-trigger' triggers: - timed: '0 2 2-30/2 * *' +- trigger: + name: 'compass-k8-nosdn-stor4nfv-ha-baremetal-master-trigger' + triggers: + - timed: '0 16 1-29/2 * *' # --------------------- # noha-baremetal-master @@ -685,6 +723,10 @@ name: 'compass-os-nosdn-ovs_dpdk-noha-baremetal-master-trigger' triggers: - timed: '' +- trigger: + name: 'compass-k8-nosdn-stor4nfv-noha-baremetal-master-trigger' + triggers: + - timed: '' # ------------------- # ha-baremetal-euphrates @@ -741,6 +783,10 @@ name: 'compass-os-nosdn-bar-ha-baremetal-euphrates-trigger' triggers: - timed: '0 21 1-29/2 * *' +- trigger: + name: 'compass-k8-nosdn-stor4nfv-ha-baremetal-euphrates-trigger' + triggers: + - timed: '' # --------------------- # noha-baremetal-euphrates @@ -769,6 +815,10 @@ name: 'compass-os-nosdn-ovs_dpdk-noha-baremetal-euphrates-trigger' triggers: - timed: '' +- trigger: + name: 'compass-k8-nosdn-stor4nfv-noha-baremetal-euphrates-trigger' + triggers: + - timed: '' # ----------------- # ha-virtual-master @@ -825,6 +875,10 @@ name: 'compass-os-nosdn-bar-ha-virtual-master-trigger' triggers: - timed: '0 17 1-29/2 * *' +- trigger: + name: 'compass-k8-nosdn-stor4nfv-ha-virtual-master-trigger' + triggers: + - timed: '0 15 2-30/2 * *' # ------------------- # noha-virtual-master @@ -853,6 +907,10 @@ name: 'compass-os-nosdn-ovs_dpdk-noha-virtual-master-trigger' triggers: - timed: '0 11 2-30/2 * *' +- trigger: + name: 'compass-k8-nosdn-stor4nfv-noha-virtual-master-trigger' + triggers: + - timed: '0 10 2-30/2 * *' # ----------------- # ha-virtual-euphrates @@ -909,6 +967,10 @@ name: 'compass-os-nosdn-bar-ha-virtual-euphrates-trigger' triggers: - timed: '0 19 1-29/2 * *' +- trigger: + name: 'compass-k8-nosdn-stor4nfv-ha-virtual-euphrates-trigger' + triggers: + - timed: '' # '0 14 1-29/2 * *' # ------------------- # noha-virtual-euphrates @@ -937,3 +999,7 @@ name: 'compass-os-nosdn-ovs_dpdk-noha-virtual-euphrates-trigger' triggers: - timed: '0 12 2-30/2 * *' +- trigger: + name: 'compass-k8-nosdn-stor4nfv-noha-virtual-euphrates-trigger' + triggers: + - timed: '' # '0 12 2-30/2 * *' diff --git a/jjb/dovetail/dovetail-run.sh b/jjb/dovetail/dovetail-run.sh index 451662abe..ec879e325 100755 --- a/jjb/dovetail/dovetail-run.sh +++ b/jjb/dovetail/dovetail-run.sh @@ -199,6 +199,27 @@ if [[ ! -f ${cirros_image} ]]; then fi sudo cp ${cirros_image} ${DOVETAIL_CONFIG} +# snaps_smoke test case needs to download this image first before running +ubuntu14_image=${image_path}/ubuntu-14.04-server-cloudimg-amd64-disk1.img +if [[ ! -f ${ubuntu14_image} ]]; then + echo "Download image ubuntu-14.04-server-cloudimg-amd64-disk1.img ..." + wget -q -nc https://cloud-images.ubuntu.com/releases/14.04/release/ubuntu-14.04-server-cloudimg-amd64-disk1.img -P ${image_path} +fi +sudo cp ${ubuntu14_image} ${DOVETAIL_CONFIG} + +# cloudify_ims test case needs to download these 2 images first before running +cloudify_image=${image_path}/cloudify-manager-premium-4.0.1.qcow2 +if [[ ! -f ${cloudify_image} ]]; then + echo "Download image cloudify-manager-premium-4.0.1.qcow2 ..." + wget -q -nc http://repository.cloudifysource.org/cloudify/4.0.1/sp-release/cloudify-manager-premium-4.0.1.qcow2 -P ${image_path} +fi +sudo cp ${cloudify_image} ${DOVETAIL_CONFIG} +trusty_image=${image_path}/trusty-server-cloudimg-amd64-disk1.img +if [[ ! -f ${trusty_image} ]]; then + echo "Download image trusty-server-cloudimg-amd64-disk1.img ..." + wget -q -nc http://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img -P ${image_path} +fi +sudo cp ${trusty_image} ${DOVETAIL_CONFIG} opts="--privileged=true -id" @@ -238,18 +259,6 @@ if [ $(docker ps | grep "${DOCKER_REPO}:${DOCKER_TAG}" | wc -l) == 0 ]; then exit 1 fi -if [[ ! "${SUT_BRANCH}" =~ "danube" && ${INSTALLER_TYPE} == 'fuel' && ${DEPLOY_TYPE} == 'baremetal' ]]; then - source_cmd="source ${OPENRC}" - get_public_url_cmd="openstack --insecure endpoint list --service keystone --interface public | sed -n 4p | awk '{print \$14}'" - public_url=$(sudo docker exec "$container_id" /bin/bash -c "${source_cmd} && ${get_public_url_cmd}") - sed -i 's#OS_AUTH_URL=.*#OS_AUTH_URL='"${public_url}"'#g' ${OPENRC} - sed -i 's/internal/public/g' ${OPENRC} - if [[ ${public_url} =~ 'v2' ]]; then - sed -i "s/OS_IDENTITY_API_VERSION=3/OS_IDENTITY_API_VERSION=2.0/g" ${OPENRC} - fi - cat ${OPENRC} -fi - # Modify tempest_conf.yaml file tempest_conf_file=${DOVETAIL_CONFIG}/tempest_conf.yaml if [[ ${INSTALLER_TYPE} == 'compass' || ${INSTALLER_TYPE} == 'apex' ]]; then diff --git a/jjb/fuel/fuel-daily-jobs.yml b/jjb/fuel/fuel-daily-jobs.yml index bbc8a8493..26f892d97 100644 --- a/jjb/fuel/fuel-daily-jobs.yml +++ b/jjb/fuel/fuel-daily-jobs.yml @@ -198,20 +198,59 @@ failure-threshold: 'never' unstable-threshold: 'FAILURE' # 1.here the stream means the SUT stream, dovetail stream is defined in its own job - # 2.only debug testsuite here(refstack, ha, vping, ipv6, tempest, bgpvpn) - # 3.not used for release criteria or compliance, only to debug the dovetail tool bugs - # 4.ZTE pod1, os-nosdn-nofeature-ha and os-odl-bgpvpn-ha, run against danube - - trigger-builds: - - project: 'dovetail-fuel-{pod}-proposed_tests-{stream}' - current-parameters: false - predefined-parameters: - DEPLOY_SCENARIO={scenario} - block: true - same-node: true - block-thresholds: - build-step-failure-threshold: 'never' - failure-threshold: 'never' - unstable-threshold: 'FAILURE' + # 2.testsuite proposed_tests here is for new test cases planning to add into OVP + # 3.run proposed_tests on Monday, Wednesday and Friday against ha scenario + # 4.testsuite default here is for the test cases already added into OVP + # 5.run default testsuite on Tuesday against ha scenario + # 6.not used for release criteria or compliance, only to debug the dovetail tool bugs + - conditional-step: + condition-kind: and + condition-operands: + - condition-kind: regex-match + regex: '*-ha' + label: '{scenario}' + - condition-kind: day-of-week + day-selector: select-days + days: + MON: true + WED: true + FRI: true + use-build-time: true + steps: + - trigger-builds: + - project: 'dovetail-fuel-{pod}-proposed_tests-{stream}' + current-parameters: false + predefined-parameters: + DEPLOY_SCENARIO={scenario} + block: true + same-node: true + block-thresholds: + build-step-failure-threshold: 'never' + failure-threshold: 'never' + unstable-threshold: 'FAILURE' + - conditional-step: + condition-kind: and + condition-operands: + - condition-kind: regex-match + regex: '*-ha' + label: '{scenario}' + - condition-kind: day-of-week + day-selector: select-days + days: + TUES: true + use-build-time: true + steps: + - trigger-builds: + - project: 'dovetail-fuel-{pod}-default-{stream}' + current-parameters: false + predefined-parameters: + DEPLOY_SCENARIO={scenario} + block: true + same-node: true + block-thresholds: + build-step-failure-threshold: 'never' + failure-threshold: 'never' + unstable-threshold: 'FAILURE' - conditional-step: condition-kind: not condition-operand: diff --git a/jjb/functest/functest-daily-jobs.yml b/jjb/functest/functest-daily-jobs.yml index 0f1ac351d..099d01a59 100644 --- a/jjb/functest/functest-daily-jobs.yml +++ b/jjb/functest/functest-daily-jobs.yml @@ -193,107 +193,22 @@ # <<: *master # ------------------------------- - functest-tier: - - 'healthcheck': - job-timeout: 20 - - 'smoke': - job-timeout: 180 - - 'components': - job-timeout: 240 - - 'vnf': - job-timeout: 240 - - features-suite: - - 'doctor-notification' - - 'promise' - - 'bgpvpn' - - 'functest-odl-sfc' - - 'domino-multinode' - - 'fds' - - 'barometercollectd' - - exclude: - - features-suite: 'promise' - stream: 'master' - - features-suite: 'domino-multinode' - stream: 'master' - - features-suite: 'fds' - stream: 'euphrates' - - build-job-settings: &build-job-settings - current-parameter: false - git-revision: true - node-parameters: false - kill-phase-on: FAILURE - abort-all-jobs: false - predefined-parameters: | - FUNCTEST_MODE=$FUNCTEST_MODE - FUNCTEST_TIER=$FUNCTEST_TIER - - features-job-settings: &features-job-settings - current-parameter: false - git-revision: true - node-parameters: false - kill-phase-on: FAILURE - abort-all-jobs: false - predefined-parameters: | - FUNCTEST_MODE=$FUNCTEST_MODE - FUNCTEST_SUITE_NAME=$FUNCTEST_SUITE_NAME + testsuite: + - 'suite': + job-timeout: 60 + - 'daily': + job-timeout: 300 + - 'arm-daily': + job-timeout: 300 jobs: - - 'functest-{installer}-{pod}-suite-{stream}' - - 'functest-{installer}-{pod}-daily-{stream}' - - 'functest-{installer}-{pod}-daily-{functest-tier}-{stream}' - - 'functest-{installer}-{pod}-daily-features-{features-suite}-{stream}' + - 'functest-{installer}-{pod}-{testsuite}-{stream}' + ################################ # job template ################################ - job-template: - - name: 'functest-{installer}-{pod}-daily-{stream}' - - project-type: multijob - - disabled: '{obj:disabled}' - - parameters: - - project-parameter: - project: '{project}' - branch: '{branch}' - - '{installer}-defaults' - - '{slave-label}-defaults' - - functest-parameter: - gs-pathname: '{gs-pathname}' - - builders: - - multijob: - name: 'Run functest tests' - execution-type: SEQUENTIAL - projects: - - name: 'functest-{installer}-{pod}-daily-healthcheck-{stream}' - <<: *build-job-settings - - name: 'functest-{installer}-{pod}-daily-smoke-{stream}' - <<: *build-job-settings - - name: 'functest-{installer}-{pod}-daily-vnf-{stream}' - <<: *build-job-settings - - name: 'functest-{installer}-{pod}-daily-features-doctor-notification-{stream}' - <<: *features-job-settings - - name: 'functest-{installer}-{pod}-daily-features-bgpvpn-{stream}' - <<: *features-job-settings - - name: 'functest-{installer}-{pod}-daily-features-functest-odl-sfc-{stream}' - <<: *features-job-settings - - name: 'functest-{installer}-{pod}-daily-features-barometercollectd-{stream}' - <<: *features-job-settings - - name: 'functest-{installer}-{pod}-daily-features-fds-{stream}' - <<: *features-job-settings - - name: 'functest-{installer}-{pod}-daily-features-promise-{stream}' - <<: *features-job-settings - - name: 'functest-{installer}-{pod}-daily-features-domino-multinode-{stream}' - <<: *features-job-settings - -- job-template: &functest-installer-tier-job - - name: 'functest-{installer}-{pod}-daily-{functest-tier}-{stream}' + name: 'functest-{installer}-{pod}-{testsuite}-{stream}' concurrent: true @@ -317,15 +232,10 @@ branch: '{branch}' - '{installer}-defaults' - '{slave-label}-defaults' - - string: - name: FUNCTEST_MODE - default: 'tier' - - string: - name: FUNCTEST_TIER - default: '{functest-tier}' + - 'functest-{testsuite}-parameter' - string: name: DEPLOY_SCENARIO - default: 'os-nosdn-nofeature-noha' + default: 'os-odl_l2-nofeature-ha' - string: name: CLEAN_DOCKER_IMAGES default: 'false' @@ -339,93 +249,7 @@ builders: - description-setter: description: "Built on $NODE_NAME" - - 'functest-daily-builder' - - publishers: - - 'functest-recipients' - - 'fuel-recipients' - -- job-template: - - name: 'functest-{installer}-{pod}-suite-{stream}' - <<: *functest-installer-tier-job - - wrappers: - - build-name: - name: '$BUILD_NUMBER Suite: $FUNCTEST_MODE Scenario: $DEPLOY_SCENARIO' - - timeout: - timeout: '60' - abort: true - parameters: - - project-parameter: - project: '{project}' - branch: '{branch}' - - '{installer}-defaults' - - '{slave-label}-defaults' - - 'functest-suite-parameter' - - string: - name: DEPLOY_SCENARIO - default: 'os-nosdn-nofeature-noha' - - string: - name: CLEAN_DOCKER_IMAGES - default: 'false' - description: 'Remove downloaded docker images (opnfv/functest*:*)' - - functest-parameter: - gs-pathname: '{gs-pathname}' - - builders: - - description-setter: - description: "Built on $NODE_NAME" - - 'functest-suite-builder' - -- job-template: - - name: 'functest-{installer}-{pod}-daily-features-{features-suite}-{stream}' - concurrent: true - properties: - - logrotate-default - - throttle: - enabled: true - max-per-node: 1 - option: 'project' - wrappers: - - build-name: - name: '$BUILD_NUMBER Suite: $FUNCTEST_MODE Scenario: $DEPLOY_SCENARIO' - - parameters: - - project-parameter: - project: '{project}' - branch: '{branch}' - - '{installer}-defaults' - - '{slave-label}-defaults' - - string: - name: FUNCTEST_MODE - default: 'testcase' - - string: - name: FUNCTEST_SUITE_NAME - default: '{features-suite}' - - string: - name: DEPLOY_SCENARIO - default: 'os-nosdn-nofeature-noha' - - string: - name: CLEAN_DOCKER_IMAGES - default: 'false' - description: 'Remove downloaded docker images (opnfv/functest*:*)' - - functest-parameter: - gs-pathname: '{gs-pathname}' - - scm: - - git-scm - - builders: - - description-setter: - description: "Built on $NODE_NAME" - - 'functest-daily-builder' - - publishers: - - 'functest-features-recipients' - - 'functest-recipients' - - 'fuel-recipients' + - 'functest-{testsuite}-builder' ######################## @@ -440,6 +264,14 @@ description: "Daily suite name to run" - parameter: + name: functest-arm-daily-parameter + parameters: + - string: + name: FUNCTEST_MODE + default: 'arm-daily' + description: "Daily suite name (Aarch64) to run" + +- parameter: name: functest-suite-parameter parameters: - choice: @@ -532,6 +364,14 @@ - 'functest-exit' - builder: + name: functest-arm-daily-builder + builders: + - 'functest-cleanup' + - 'functest-arm-daily' + - 'functest-store-results' + - 'functest-exit' + +- builder: name: functest-suite-builder builders: - 'functest-cleanup' @@ -565,6 +405,17 @@ # yamllint enable rule:indentation - builder: + name: functest-arm-daily + builders: + # yamllint disable rule:indentation + - shell: + !include-raw: + - ./functest-env-presetup.sh + - ../../utils/fetch_os_creds.sh + - ./functest-alpine.sh + +# yamllint enable rule:indentation +- builder: name: functest-store-results builders: - shell: @@ -581,30 +432,3 @@ builders: - shell: !include-raw: ./functest-exit.sh - - -- publisher: - name: 'functest-features-recipients' - publishers: - - email: - recipients: - -- publisher: - name: 'functest-recipients' - publishers: - - email: - recipients: > - jalausuch@suse.com morgan.richomme@orange.com - cedric.ollivier@orange.com feng.xiaowei@zte.com.cn - juha.kosonen@nokia.com wangwulin@huawei.com - delia.popescu@enea.com cristina.pauna@enea.com - valentin.boucher@kontron.com - - email-jenkins-admins-on-failure - -- publisher: - name: 'fuel-recipients' - publishers: - - email: - recipients: > - peter.barabas@ericsson.com mpolenchuck@mirantis.com - alexandru.avadanii@enea.com guillermo.herrero@enea.com diff --git a/jjb/global/releng-macros.yml b/jjb/global/releng-macros.yml index e58e1cfee..3433cee5f 100644 --- a/jjb/global/releng-macros.yml +++ b/jjb/global/releng-macros.yml @@ -965,6 +965,7 @@ - shell: !include-raw-escape: installer-report.sh - postbuildscript: + script-only-if-succeeded: false script-only-if-failed: true builders: - shell: | diff --git a/jjb/qtip/qtip-experimental-jobs.yml b/jjb/qtip/qtip-experimental-jobs.yml index 103069fb7..ee143b4f3 100644 --- a/jjb/qtip/qtip-experimental-jobs.yml +++ b/jjb/qtip/qtip-experimental-jobs.yml @@ -7,28 +7,31 @@ name: qtip-experimental-jobs project: qtip jobs: - - 'qtip-experimental-{pod}-{stream}' + - 'qtip-{sut}-experimental-{pod}-{stream}' stream: - master: branch: '{stream}' gs-pathname: '' disabled: false - - euphrates: - branch: 'stable/{stream}' - gs-pathname: '/{stream}' - disabled: false pod: - zte-virtual6: installer: fuel pod: zte-virtual6 + # ------------------------------- + # SYSTEM UNDER TEST + # ------------------------------- + sut: + - 'host' + - 'vnf' + ################################ ## job templates ################################# - job-template: - name: 'qtip-experimental-{pod}-{stream}' + name: 'qtip-{sut}-experimental-{pod}-{stream}' disabled: '{obj:disabled}' @@ -38,6 +41,9 @@ branch: '{branch}' - '{installer}-defaults' - '{pod}-defaults' + - string: + name: SUT + default: '{sut}' scm: - git-scm-gerrit diff --git a/jjb/qtip/qtip-validate-jobs.yml b/jjb/qtip/qtip-validate-jobs.yml index d9d3e72e6..282cb93e2 100644 --- a/jjb/qtip/qtip-validate-jobs.yml +++ b/jjb/qtip/qtip-validate-jobs.yml @@ -33,29 +33,28 @@ pod: zte-virtual5 <<: *master - compute: - installer: apex - pod: zte-virtual5 - <<: *euphrates - - storage: - installer: apex - pod: zte-virtual5 - <<: *euphrates - - compute: installer: fuel pod: zte-virtual6 <<: *master # ------------------------------- + # SYSTEM UNDER TEST + # ------------------------------- + sut: + - 'host' + - 'vnf' + + # ------------------------------- # JOB LIST # ------------------------------- jobs: - - 'qtip-{qpi}-{installer}-{pod}-{stream}' + - 'qtip-{qpi}-{sut}-{installer}-{pod}-{stream}' ################################ # job templates ################################ - job-template: - name: 'qtip-{qpi}-{installer}-{pod}-{stream}' + name: 'qtip-{qpi}-{sut}-{installer}-{pod}-{stream}' disabled: false parameters: @@ -84,6 +83,9 @@ - string: name: OPNFV_RELEASE default: '{stream}' + - string: + name: SUT + default: '{sut}' scm: - git-scm diff --git a/jjb/releng/functest-docker.yml b/jjb/releng/functest-docker.yml index 584dc302c..bfeae5eaa 100644 --- a/jjb/releng/functest-docker.yml +++ b/jjb/releng/functest-docker.yml @@ -205,6 +205,11 @@ name: GIT_BASE default: https://gerrit.opnfv.org/gerrit/$PROJECT description: 'Git URL to use on this Jenkins Slave' + - string: + name: REPO + default: "opnfv" + description: "Repository name for functest images" + disabled: '{obj:disabled}' @@ -219,8 +224,8 @@ esac sudo manifest-tool push from-args \ --platforms linux/amd64,linux/arm64 \ - --template opnfv/functest-{image}:ARCH-$tag \ - --target opnfv/functest-{image}:$tag + --template $REPO/functest-{image}:ARCH-$tag \ + --target $REPO/functest-{image}:$tag exit $? # parameter macro @@ -262,6 +267,10 @@ name: PROJECT default: "{project}" description: "Project name used to enable job conditions" + - string: + name: REPO + default: "opnfv" + description: "Repository name for functest images" # publisher macros - publisher: diff --git a/jjb/releng/opnfv-utils.yml b/jjb/releng/opnfv-utils.yml index 93b3615ef..fb3bab42b 100644 --- a/jjb/releng/opnfv-utils.yml +++ b/jjb/releng/opnfv-utils.yml @@ -89,7 +89,6 @@ name: 'check-status-of-slaves' disabled: false - concurrent: true parameters: @@ -97,17 +96,23 @@ name: SLAVE_NAME description: 'script lives on master node' default-slaves: - - master + - lf-build1 allowed-multiselect: false ignore-offline-nodes: true + - project-parameter: + project: releng + branch: master + + scm: + - git-scm triggers: - timed: '@midnight' builders: - shell: | - cd /opt/jenkins-ci/slavemonitor - bash slave-monitor-0.1.sh | sort + cd $WORKSPACE/utils/ + bash slave-monitor-0.1.sh - job-template: name: 'ansible-build-server' @@ -162,7 +167,7 @@ builders: - shell: | # run playbook - sudo ansible-playbook -C -D -i \ + sudo ansible-playbook -i \ $WORKSPACE/utils/build-server-ansible/inventory.ini \ $WORKSPACE/utils/build-server-ansible/main.yml diff --git a/jjb/xci/xci-run-functest.sh b/jjb/xci/xci-run-functest.sh index b2421de32..39d4ea190 100755 --- a/jjb/xci/xci-run-functest.sh +++ b/jjb/xci/xci-run-functest.sh @@ -20,6 +20,18 @@ if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then exit 0 fi +# if the scenario is external, we need to wipe WORKSPACE to place releng-xci there since +# the project where the scenario is coming from is cloned and the patch checked out to the +# xci/scenarios/$DEPLOY_SCENARIO to be synched on clean VM +# apart from that, we need releng-xci stuff in WORKSPACE for things to function correctly on Jenkins. +# if the change is coming to releng-xci, we don't need to do anything since the patch is checked +# out to the WORKSPACE anyways +if [[ $GERRIT_PROJECT != "releng-xci" ]]; then + cd $HOME && /bin/rm -rf $WORKSPACE + git clone https://gerrit.opnfv.org/gerrit/releng-xci $WORKSPACE && cd $WORKSPACE + chmod -R go-rwx $WORKSPACE/xci/scripts/vm +fi + # skip the deployment if the scenario is not supported on this distro OPNFV_SCENARIO_REQUIREMENTS=$WORKSPACE/xci/opnfv-scenario-requirements.yml if ! sed -n "/^- scenario: $DEPLOY_SCENARIO$/,/^$/p" $OPNFV_SCENARIO_REQUIREMENTS | grep -q $DISTRO; then diff --git a/jjb/xci/xci-set-scenario.sh b/jjb/xci/xci-set-scenario.sh new file mode 100755 index 000000000..59205e291 --- /dev/null +++ b/jjb/xci/xci-set-scenario.sh @@ -0,0 +1,80 @@ +#!/bin/bash +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2018 SUSE and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +set -o errexit +set -o nounset +set -o pipefail + +#---------------------------------------------------------------------- +# This script is used by CI and executed by Jenkins jobs. +# You are not supposed to use this script manually if you don't know +# what you are doing. +#---------------------------------------------------------------------- + +WORK_DIRECTORY=/tmp/$GERRIT_CHANGE_NUMBER/$DISTRO +/bin/rm -rf $WORK_DIRECTORY && mkdir -p $WORK_DIRECTORY + +# ensure GERRIT_TOPIC is set +GERRIT_TOPIC="${GERRIT_TOPIC:-''}" + +# skip the healthcheck if the patch doesn't impact the deployment +if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then + echo "Skipping verify!" + echo "DEPLOY_SCENARIO=os-nosdn-nofeature" > $WORK_DIRECTORY/scenario.properties + exit 0 +fi + +# if the scenario is external, we need to wipe WORKSPACE to place releng-xci there since +# the project where the scenario is coming from is cloned and the patch checked out to the +# xci/scenarios/$DEPLOY_SCENARIO to be synched on clean VM +# apart from that, we need releng-xci stuff in WORKSPACE for things to function correctly on Jenkins. +# if the change is coming to releng-xci, we don't need to do anything since the patch is checked +# out to the WORKSPACE anyways +if [[ $GERRIT_PROJECT != "releng-xci" ]]; then + cd $HOME && /bin/rm -rf $WORKSPACE + git clone https://gerrit.opnfv.org/gerrit/releng-xci $WORKSPACE && cd $WORKSPACE + chmod -R go-rwx $WORKSPACE/xci/scripts/vm +fi + +# if change is coming to releng-xci, continue as usual until that part is fixed as well +if [[ $GERRIT_PROJECT == "releng-xci" ]]; then + # save the scenario name into java properties file to be injected to downstream jobs via envInject + echo "Recording scenario name for downstream jobs" + echo "DEPLOY_SCENARIO=os-nosdn-nofeature" > $WORK_DIRECTORY/scenario.properties + exit 0 +fi + +# projects develop different scenarios and jobs need to know which scenario got the +# change under test so the jobs can deploy and test the right scenario. +# we need to fetch the change and look at the changeset to find out the scenario instead +# of hardcoding scenario per project. + +git clone https://gerrit.opnfv.org/gerrit/$GERRIT_PROJECT $WORK_DIRECTORY/$GERRIT_PROJECT +cd $WORK_DIRECTORY/$GERRIT_PROJECT +git fetch https://gerrit.opnfv.org/gerrit/$GERRIT_PROJECT $GERRIT_REFSPEC && git checkout FETCH_HEAD +DEPLOY_SCENARIO=$(git diff HEAD^..HEAD --name-only | grep scenarios | sed -r 's/scenarios\/(.*?)\/.*/\1/' | uniq) + +# ensure single scenario is impacted +if [[ $(echo $DEPLOY_SCENARIO | wc -w) != 1 ]]; then + echo "Change impacts multiple scenarios!" + echo "XCI doesn't support testing of changes that impact multiple scenarios currently." + echo "Please split your change into multiple different/dependent changes, each modifying single scenario." + exit 1 +fi + +# save the scenario name into java properties file to be injected to downstream jobs via envInject +echo "Recording scenario name '$DEPLOY_SCENARIO' for downstream jobs" +echo "DEPLOY_SCENARIO=$DEPLOY_SCENARIO" > $WORK_DIRECTORY/scenario.properties + +# skip the deployment if the scenario is not supported on this distro +OPNFV_SCENARIO_REQUIREMENTS=$WORKSPACE/xci/opnfv-scenario-requirements.yml +if ! sed -n "/^- scenario: $DEPLOY_SCENARIO$/,/^$/p" $OPNFV_SCENARIO_REQUIREMENTS | grep -q $DISTRO; then + echo "# SKIPPED: Scenario $DEPLOY_SCENARIO is NOT supported on $DISTRO" + exit 0 +fi diff --git a/jjb/xci/xci-start-deployment.sh b/jjb/xci/xci-start-deployment.sh index e86f5b3a1..cb75b511e 100755 --- a/jjb/xci/xci-start-deployment.sh +++ b/jjb/xci/xci-start-deployment.sh @@ -20,6 +20,18 @@ if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then exit 0 fi +# if the scenario is external, we need to wipe WORKSPACE to place releng-xci there since +# the project where the scenario is coming from is cloned and the patch checked out to the +# xci/scenarios/$DEPLOY_SCENARIO to be synched on clean VM +# apart from that, we need releng-xci stuff in WORKSPACE for things to function correctly on Jenkins. +# if the change is coming to releng-xci, we don't need to do anything since the patch is checked +# out to the WORKSPACE anyways +if [[ $GERRIT_PROJECT != "releng-xci" ]]; then + cd $HOME && /bin/rm -rf $WORKSPACE + git clone https://gerrit.opnfv.org/gerrit/releng-xci $WORKSPACE && cd $WORKSPACE + chmod -R go-rwx $WORKSPACE/xci/scripts/vm +fi + # skip the deployment if the scenario is not supported on this distro OPNFV_SCENARIO_REQUIREMENTS=$WORKSPACE/xci/opnfv-scenario-requirements.yml if ! sed -n "/^- scenario: $DEPLOY_SCENARIO$/,/^$/p" $OPNFV_SCENARIO_REQUIREMENTS | grep -q $DISTRO; then diff --git a/jjb/xci/xci-start-new-vm.sh b/jjb/xci/xci-start-new-vm.sh index 2c6ec3fad..d676e2662 100755 --- a/jjb/xci/xci-start-new-vm.sh +++ b/jjb/xci/xci-start-new-vm.sh @@ -20,6 +20,18 @@ if [[ "$GERRIT_TOPIC" =~ 'skip-verify' ]]; then exit 0 fi +# if the scenario is external, we need to wipe WORKSPACE to place releng-xci there since +# the project where the scenario is coming from is cloned and the patch checked out to the +# xci/scenarios/$DEPLOY_SCENARIO to be synched on clean VM +# apart from that, we need releng-xci stuff in WORKSPACE for things to function correctly on Jenkins. +# if the change is coming to releng-xci, we don't need to do anything since the patch is checked +# out to the WORKSPACE anyways +if [[ $GERRIT_PROJECT != "releng-xci" ]]; then + cd $HOME && /bin/rm -rf $WORKSPACE + git clone https://gerrit.opnfv.org/gerrit/releng-xci $WORKSPACE && cd $WORKSPACE + chmod -R go-rwx $WORKSPACE/xci/scripts/vm +fi + # skip the deployment if the scenario is not supported on this distro OPNFV_SCENARIO_REQUIREMENTS=$WORKSPACE/xci/opnfv-scenario-requirements.yml if ! sed -n "/^- scenario: $DEPLOY_SCENARIO$/,/^$/p" $OPNFV_SCENARIO_REQUIREMENTS | grep -q $DISTRO; then @@ -35,6 +47,7 @@ cd $WORKSPACE # yourself. cat > xci_test.sh<<EOF #!/bin/bash +set -o pipefail export DISTRO=$DISTRO export DEPLOY_SCENARIO=$DEPLOY_SCENARIO export FUNCTEST_MODE=$FUNCTEST_MODE diff --git a/jjb/xci/xci-verify-jobs.yml b/jjb/xci/xci-verify-jobs.yml index c6b6bc43b..c54a1b941 100644 --- a/jjb/xci/xci-verify-jobs.yml +++ b/jjb/xci/xci-verify-jobs.yml @@ -102,7 +102,7 @@ comment-contains-value: 'reverify' projects: - project-compare-type: 'ANT' - project-pattern: '{project}' + project-pattern: 'releng-xci' branches: - branch-compare-type: 'ANT' branch-pattern: '**/{branch}' @@ -110,6 +110,15 @@ forbidden-file-paths: - compare-type: ANT pattern: 'xci/scripts/vm/**' + - project-compare-type: 'REG_EXP' + project-pattern: 'sfc|sdnvpn' + branches: + - branch-compare-type: 'ANT' + branch-pattern: '**/{branch}' + disable-strict-forbidden-file-verification: 'true' + file-paths: + - compare-type: ANT + pattern: 'scenarios/**' readable-message: true custom-url: '* $JOB_NAME $BUILD_URL' skip-vote: @@ -120,12 +129,15 @@ parameters: - project-parameter: - project: '{project}' + project: $GERRIT_PROJECT branch: '{branch}' - label: name: SLAVE_LABEL default: 'xci-virtual' - string: + name: DISTRO + default: '{distro}' + - string: name: CLEAN_DIB_IMAGES default: 'true' - string: @@ -134,8 +146,11 @@ description: 'Git URL to use on this Jenkins Slave' builders: + - 'xci-verify-set-scenario-macro' + - inject: + properties-file: "/tmp/$GERRIT_CHANGE_NUMBER/$DISTRO/scenario.properties" - description-setter: - description: "Built on $NODE_NAME" + description: "Scenario: $DEPLOY_SCENARIO | Node: $NODE_NAME" - multijob: name: deploy condition: SUCCESSFUL @@ -144,8 +159,8 @@ current-parameters: true predefined-parameters: | DISTRO={distro} - DEPLOY_SCENARIO=os-nosdn-nofeature CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES + GERRIT_PROJECT=$GERRIT_PROJECT GERRIT_BRANCH=$GERRIT_BRANCH GERRIT_REFSPEC=$GERRIT_REFSPEC GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER @@ -161,14 +176,14 @@ current-parameters: true predefined-parameters: | DISTRO={distro} - DEPLOY_SCENARIO=os-nosdn-nofeature CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES - FUNCTEST_MODE=tier - FUNCTEST_TIER=healthcheck + GERRIT_PROJECT=$GERRIT_PROJECT GERRIT_BRANCH=$GERRIT_BRANCH GERRIT_REFSPEC=$GERRIT_REFSPEC GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE + FUNCTEST_MODE=tier + FUNCTEST_TIER=healthcheck node-parameters: true kill-phase-on: NEVER abort-all-job: true @@ -194,14 +209,11 @@ parameters: - string: name: PROJECT - default: 'releng-xci' + default: $GERRIT_PROJECT - string: name: DISTRO default: 'ubuntu' - string: - name: DEPLOY_SCENARIO - default: 'os-nosdn-nofeature' - - string: name: FUNCTEST_MODE default: 'tier' - string: @@ -225,6 +237,8 @@ description: 'Git URL to use on this Jenkins Slave' wrappers: + - inject: + properties-file: "/tmp/$GERRIT_CHANGE_NUMBER/$DISTRO/scenario.properties" - ssh-agent-wrapper - build-timeout: timeout: 240 @@ -235,13 +249,19 @@ builders: - description-setter: - description: "Built on $NODE_NAME" + description: "Scenario: $DEPLOY_SCENARIO | Node: $NODE_NAME" - 'xci-verify-{phase}-macro' # ------------------------------- # builder macros # ------------------------------- - builder: + name: 'xci-verify-set-scenario-macro' + builders: + - shell: + !include-raw: ./xci-set-scenario.sh + +- builder: name: 'xci-verify-deploy-macro' builders: - shell: @@ -254,4 +274,6 @@ name: 'xci-verify-healthcheck-macro' builders: - shell: + !include-raw: ./xci-run-functest.sh + - shell: !include-raw: ./xci-cleanup.sh diff --git a/jjb/yardstick/yardstick-daily.sh b/jjb/yardstick/yardstick-daily.sh index f0e4f8e22..2fd68484e 100755 --- a/jjb/yardstick/yardstick-daily.sh +++ b/jjb/yardstick/yardstick-daily.sh @@ -50,7 +50,7 @@ opts="--privileged=true --rm" envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} \ -e NODE_NAME=${NODE_NAME} -e EXTERNAL_NETWORK=${EXTERNAL_NETWORK} \ -e YARDSTICK_BRANCH=${BRANCH} -e BRANCH=${BRANCH} \ - -e DEPLOY_SCENARIO=${DEPLOY_SCENARIO}" + -e DEPLOY_SCENARIO=${DEPLOY_SCENARIO} -e CI_DEBUG=true" if [[ "${INSTALLER_TYPE}" == 'fuel' ]]; then envs+=" -e SSH_KEY=/root/.ssh/mcp.rsa" diff --git a/utils/build-server-ansible/vars/docker-compose-Centos.yml b/utils/build-server-ansible/vars/docker-compose-CentOS.yml index fc4bcba7e..fc4bcba7e 100644 --- a/utils/build-server-ansible/vars/docker-compose-Centos.yml +++ b/utils/build-server-ansible/vars/docker-compose-CentOS.yml diff --git a/utils/slave-monitor-0.1.sh b/utils/slave-monitor-0.1.sh index 161aaef21..5201f93d6 100644..100755 --- a/utils/slave-monitor-0.1.sh +++ b/utils/slave-monitor-0.1.sh @@ -8,9 +8,8 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -#This will put a bunch of files in the pwd. you have been warned. #Counts how long slaves have been online or offline - +#exec 2>/dev/null #Yes I know about jq curlcommand() { @@ -25,74 +24,66 @@ curl -s "https://build.opnfv.org/ci/computer/api/json?tree=computer\[displayName | sed s,\",,g } -if [ -f podoutput-current ]; then - cp podoutput-current podoutput-lastiteration -fi - -curlcommand > podoutput-current +curlcommand > /tmp/podoutput-current -declare -A slavescurrent slaveslastiteration +declare -A slavescurrent while read -r name status ; do slavescurrent["$name"]="$status" -done < <(cat podoutput-current) - -while read -r name status ; do - slaveslastiteration["$name"]=$status -done < <(cat podoutput-lastiteration) - +done < <(cat /tmp/podoutput-current) + +#haste bin stopped allowing post :( +#files=(*online) +#for ((i=0; i<${#files[@]}; i+=9)); do +#./eplot -d -r [-1:74][-1:30] -m ${files[i]} ${files[i+1]} ${files[i+2]} ${files[i+3]} ${files[i+4]} ${files[i+5]} ${files[i+6]} ${files[i+7]} ${files[i+8]} ${files[i+9]} +#done | ./haste.bash +## main () { + for slavename in "${!slavescurrent[@]}"; do - #Slave is online. Mark it down. + + #Slave is online. Mark it down. if [ "${slavescurrent[$slavename]}" == "false" ]; then - if [ -f "$slavename"-offline ]; then - echo "removing offline status from $slavename slave was offline for $(cat "$slavename"-offline ) iterations" - rm "$slavename"-offline - fi - - if ! [ -f "$slavename"-online ]; then - echo "1" > "$slavename"-online - elif [ -f "$slavename"-online ]; then - #read and increment slavename - read -r -d $'\x04' var < "$slavename"-online - ((var++)) - echo -n "ONLINE $slavename " - echo "for $var iterations" - echo "$var" > "$slavename"-online - fi - fi + if ! [ -f /tmp/"$slavename"-online ]; then + echo "1" > /tmp/"$slavename"-online + echo "new online slave file created $slavename ${slavescurrent[$slavename]} up for 1 iterations" + fi - #went offline since last iteration. - if [ "${slavescurrent[$slavename]}" == "false" ] && [ "${slaveslastiteration[$slavename]}" == "true" ]; then - echo "JUST WENT OFFLINE $slavename " - if [ -f "$slavename"-online ]; then - echo "removing online status from $slavename. slave was online for $(cat "$slavename"-online ) iterations" - rm "$slavename"-online - fi + #read and increment slavename + var="$(cat /tmp/"$slavename"-online |tail -n 1)" + if [[ "$var" == "0" ]]; then + echo "slave $slavename ${slavescurrent[$slavename]} back up for $var iterations" + fi + ((var++)) + echo "$var" >> /tmp/"$slavename"-online + unset var + echo "$slavename up $(cat /tmp/$slavename-online | tail -n 10 | xargs)" fi - #slave is offline + #slave is offline remove all points if [ "${slavescurrent[$slavename]}" == "true" ]; then - if ! [ -f "$slavename"-offline ]; then - echo "1" > "$slavename"-offline - fi - - if [ -f "$slavename"-offline ]; then - #read and increment slavename - read -r -d $'\x04' var < "$slavename"-offline - ((var++)) - echo "$var" > "$slavename"-offline - if [ "$var" -gt "30" ]; then - echo "OFFLINE FOR $var ITERATIONS REMOVE $slavename " - else - echo "OFFLINE $slavename FOR $var ITERATIONS " - fi - fi + if ! [ -f /tmp/"$slavename"-online ]; then + echo "0" > /tmp/"$slavename"-online + echo "new offline slave file created $slavename ${slavescurrent[$slavename]} up for 0 iterations" + + fi + var="$(cat /tmp/"$slavename"-online |tail -n 1)" + + if [[ "$var" != "0" ]]; then + echo "slave $slavename ${slavescurrent[$slavename]} was up for $var iterations" + echo "slave $slavename ${slavescurrent[$slavename]} has gone offline, was $var iterations now reset to 0" + fi + + echo "0" >> /tmp/"$slavename"-online + echo "$slavename down $(cat /tmp/$slavename-online | tail -n 10 | xargs)" + unset var + fi + done } -main +main | sort | column -t |