Merge "Prevent triggering unnecessary genesis jobs when docs change"
[releng.git] / jjb / genesis / genesis-fuel.yml
index 9f00e5d..405fbc0 100644 (file)
     installer: 'fuel'
 
     jobs:
-        - 'genesis-fuel-verify-{stream}'
-        - 'genesis-fuel-merge'
+        - 'genesis-fuel-verify-build-{stream}'
+        - 'genesis-fuel-merge-{stream}'
         - 'genesis-fuel-daily-{stream}'
         - 'genesis-fuel-build-{stream}'
         - 'genesis-fuel-deploy-{stream}'
-        - 'genesis-fuel-deploy-virtual-master'
+        - 'genesis-fuel-deploy-runner-{stream}'
+        - 'genesis-fuel-lab-reconfig-{stream}'
+        - 'genesis-fuel-verify-deploy-virtual-{stream}'
 
     # stream:    branch with - in place of / (eg. stable-arno)
     # branch:    branch (eg. stable/arno)
@@ -32,7 +34,7 @@
 ########################
 
 - job-template:
-    name: 'genesis-fuel-verify-{stream}'
+    name: 'genesis-fuel-verify-build-{stream}'
 
     project-type: freestyle
 
                     branch-pattern: '**/{branch}'
                 file-paths:
                   - compare-type: ANT
-                    pattern: 'common/**'
+                    pattern: 'common/ci/**'
                   - compare-type: ANT
-                    pattern: '{installer}/**'
+                    pattern: 'common/manifests/**'
+                  - compare-type: ANT
+                    pattern: 'common/puppet-opnfv/**'
+                  - compare-type: ANT
+                    pattern: 'common/tools/**'
+                  - compare-type: ANT
+                    pattern: '{installer}/build/**'
+                  - compare-type: ANT
+                    pattern: '{installer}/ci/**'
+                  - compare-type: ANT
+                    pattern: '{installer}/deploy/**'
+                  - compare-type: ANT
+                    pattern: '{installer}/include/**'
+                  - compare-type: ANT
+                    pattern: '{installer}/prototypes/**'
+                forbidden-file-paths:
+                  - compare-type: ANT
+                    pattern: 'common/docs/**'
+                  - compare-type: ANT
+                    pattern: '{installer}/docs/**'
 
     builders:
         - 'fuel-build'
+        - 'fuel-workspace-cleanup'
 
 - job-template:
-    name: 'genesis-fuel-merge'
+    name: 'genesis-fuel-merge-{stream}'
 
     project-type: freestyle
 
         - project-parameter:
             project: '{project}'
         - gerrit-parameter:
-            branch: 'master'
+            branch: '{branch}'
         - fuel-parameter:
             installer: '{installer}'
             gs-pathname: ''
               - project-compare-type: 'ANT'
                 project-pattern: 'genesis'
                 branches:
-                    - branch-compare-type: 'ANT'
-                      branch-pattern: '**/master'
+                  - branch-compare-type: 'ANT'
+                    branch-pattern: '**/{branch}'
                 file-paths:
                   - compare-type: ANT
-                    pattern: 'common/**'
+                    pattern: 'common/ci/**'
+                  - compare-type: ANT
+                    pattern: 'common/manifests/**'
+                  - compare-type: ANT
+                    pattern: 'common/puppet-opnfv/**'
                   - compare-type: ANT
-                    pattern: '{installer}/**'
+                    pattern: 'common/tools/**'
+                  - compare-type: ANT
+                    pattern: '{installer}/build/**'
+                  - compare-type: ANT
+                    pattern: '{installer}/ci/**'
+                  - compare-type: ANT
+                    pattern: '{installer}/deploy/**'
+                  - compare-type: ANT
+                    pattern: '{installer}/include/**'
+                  - compare-type: ANT
+                    pattern: '{installer}/prototypes/**'
+                forbidden-file-paths:
+                  - compare-type: ANT
+                    pattern: 'common/docs/**'
+                  - compare-type: ANT
+                    pattern: '{installer}/docs/**'
 
     builders:
         - 'fuel-build'
+        - 'fuel-workspace-cleanup'
 
 - job-template:
     name: 'genesis-fuel-daily-{stream}'
           - project: 'genesis-fuel-build-{stream}'
             git-revision: true
             block: true
+        - trigger-builds:
+          - project: 'genesis-fuel-lab-reconfig-{stream}'
+            git-revision: true
+            block: true
         - trigger-builds:
           - project: 'genesis-fuel-deploy-{stream}'
             git-revision: true
             block: true
         - trigger-builds:
-          - project: 'functest-opnfv-jump-1'
+          - project: 'functest-fuel-{stream}'
             block: true
+            block-thresholds:
+                build-step-failure-threshold: 'never'
+                failure-threshold: 'never'
+                unstable-threshold: 'FAILURE'
         - trigger-builds:
-          - project: 'yardstick-opnfv-jump-1'
+          - project: 'yardstick-fuel-{stream}'
+            block: true
+            block-thresholds:
+                build-step-failure-threshold: 'never'
+                failure-threshold: 'never'
+                unstable-threshold: 'FAILURE'
+
+- job-template:
+    name: 'genesis-fuel-deploy-runner-{stream}'
+
+    project-type: freestyle
+
+    disabled: false
+
+    node: master
+
+    logrotate:
+        daysToKeep: 30
+        numToKeep: 10
+        artifactDaysToKeep: -1
+        artifactNumToKeep: -1
+
+    parameters:
+        - project-parameter:
+            project: '{project}'
+        - foreman-parameter:
+            installer: '{installer}'
+            gs-pathname: '{gs-pathname}'
+        - string:
+            name: GIT_BASE
+            default: ssh://gerrit.opnfv.org:29418/$PROJECT
+            description: "Used for overriding the GIT URL coming from parameters macro."
+
+    scm:
+        - git-scm:
+            credentials-id: '{ssh-credentials}'
+            refspec: ''
+            branch: '{branch}'
+
+    properties:
+        - build-blocker:
+            use-build-blocker: true
+            blocking-jobs:
+                - "genesis-foreman-daily.*"
+                - "genesis-foreman-deploy-runner-{stream}"
+                - "genesis-fuel-daily.*"
+
+    builders:
+        - 'fuel-lab-reconfig'
+        - trigger-builds:
+          - project: 'genesis-fuel-deploy-{stream}'
+            git-revision: true
             block: true
 
 - job-template:
     builders:
         - 'fuel-build'
         - 'fuel-upload-artifact'
+        - 'fuel-workspace-cleanup'
+
+    publishers:
+        - email:
+            recipients: jonas.bjurel@ericsson.com stefan.k.berg@ericsson.com
 
 - job-template:
     name: 'genesis-fuel-deploy-{stream}'
 
     disabled: false
 
-    node: opnfv-jump-1
+    node: opnfv-jump-2
 
     parameters:
         - project-parameter:
         - string:
             name: GIT_BASE
             default: ssh://gerrit.opnfv.org:29418/$PROJECT
-            description: "POD1 has some issues with cloning using https so that's why GIT_BASE is overriden here again."
+            description: "POD2 has some issues with cloning using https so that's why GIT_BASE is overriden here again."
 
     scm:
         - git-scm:
         - 'fuel-download-artifact'
         - 'fuel-deploy'
 
+    publishers:
+        - email:
+            recipients: jonas.bjurel@ericsson.com stefan.k.berg@ericsson.com
+
 - job-template:
-    name: 'genesis-fuel-deploy-virtual-master'
+    name: 'genesis-fuel-lab-reconfig-{stream}'
 
     project-type: freestyle
 
     disabled: false
 
+    node: master
+
+    logrotate:
+        daysToKeep: 30
+        numToKeep: 10
+        artifactDaysToKeep: -1
+        artifactNumToKeep: -1
+
+    parameters:
+        - project-parameter:
+            project: '{project}'
+        - fuel-parameter:
+            installer: '{installer}'
+            gs-pathname: '{gs-pathname}'
+        - string:
+            name: GIT_BASE
+            default: ssh://gerrit.opnfv.org:29418/$PROJECT
+            description: "Used for overriding the GIT URL coming from parameters macro."
+
+    scm:
+        - git-scm:
+            credentials-id: '{ssh-credentials}'
+            refspec: ''
+            branch: '{branch}'
+
+    properties:
+        - build-blocker:
+            use-build-blocker: true
+            blocking-jobs:
+                - "genesis-foreman-daily.*"
+
+    builders:
+        - 'fuel-lab-reconfig'
+
+- job-template:
+    name: 'genesis-fuel-verify-deploy-virtual-{stream}'
+
+    project-type: freestyle
+
+    disabled: true
+
     node: ericsson-build
 
     parameters:
         - git-scm:
             credentials-id: '{ssh-credentials}'
             refspec: ''
-            branch: master
+            branch: 'master'
 
     logrotate:
         daysToKeep: 30
             chmod a+x $HOME
             chmod a+x $TMPDIR
 
-            # set TOPDIR
-            export TOPDIR=$WORKSPACE/fuel/prototypes/auto-deploy
+            # set CONFDIR, BRIDGE
+            export CONFDIR=$WORKSPACE/fuel/deploy/templates/hardware_environment/old_conf/linux_foundation_lab/pod2/ha
+            export BRIDGE=pxebr
+
+            # cleanup first
+            sudo $WORKSPACE/common/ci/clean.sh -base_config $WORKSPACE/foreman/ci/inventory/lf_pod2_ksgen_settings.yml
+
+            # prepare for Fuel Deployment
+            sudo $WORKSPACE/common/ci/setup.sh
 
             # log info to console
             echo "Starting the deployment using $INSTALLER. This could take some time..."
 
             # start the deployment
             echo "Issuing command"
-            echo "sudo TMPDIR=${TMPDIR} ${TOPDIR}/deploy/deploy.sh ${WORKSPACE}/opnfv.iso ${TOPDIR}/configs/lf_pod1/dea_no-ha.yaml ${TOPDIR}/configs/lf_pod1/dha.yaml"
-            sudo TMPDIR=${TMPDIR} ${TOPDIR}/deploy/deploy.sh ${WORKSPACE}/opnfv.iso ${TOPDIR}/configs/lf_pod1/dea_no-ha.yaml ${TOPDIR}/configs/lf_pod1/dha.yaml
+            echo "sudo $WORKSPACE/fuel/ci/deploy.sh -iso $WORKSPACE/opnfv.iso -dea $CONFDIR/dea.yaml -dha $CONFDIR/dha.yaml -s $TMPDIR -b $BRIDGE"
+            sudo $WORKSPACE/fuel/ci/deploy.sh -iso $WORKSPACE/opnfv.iso -dea $CONFDIR/dea.yaml -dha $CONFDIR/dha.yaml -s $TMPDIR -b $BRIDGE
 
             echo
             echo "--------------------------------------------------------"
             # delete everything that is in $WORKSPACE
             /bin/rm -rf $WORKSPACE
 
+- builder:
+    name: 'fuel-lab-reconfig'
+    builders:
+        - shell: |
+            #!/bin/bash
+            set -o errexit
+            set -o nounset
+            set -o pipefail
+
+            # check to see if ucs login info file exists
+            if [ -e ~/.ssh/ucs_creds ];then
+              source ~/.ssh/ucs_creds
+            else
+              echo "Unable to find UCS credentials for LF lab reconfiguration...Exiting"
+              exit 1
+            fi
+
+            # clone releng
+            echo "Cloning releng repo..."
+            if ! GIT_SSL_NO_VERIFY=true git clone https://gerrit.opnfv.org/gerrit/releng; then
+              echo "Unable to clone releng repo...Exiting"
+              exit 1
+            fi
+
+            # log info to console
+            echo "Starting the lab reconfiguration for $INSTALLER..."
+            echo "--------------------------------------------------------"
+            echo
+
+            # create venv
+            $WORKSPACE/releng/utils/lab-reconfiguration/create_venv.sh
+
+            # disable nounset because 'activate' script contains unbound variable(s)
+            set +o nounset
+            # enter venv
+            source $WORKSPACE/releng/utils/lab-reconfiguration/venv/bin/activate
+            # set nounset back again
+            set -o nounset
+
+            # verify we are in venv
+            if [[ ! $(which python | grep venv) ]]; then
+              echo "Unable to activate venv...Exiting"
+              exit 1
+            fi
+
+            python $WORKSPACE/releng/utils/lab-reconfiguration/reconfigUcsNet.py -i $ucs_host -u $ucs_user -p $ucs_password -f $WORKSPACE/releng/utils/lab-reconfiguration/fuel.yaml
+
+            # while undergoing reboot
+            sleep 30
+
+            # check to see if slave is back up
+            ping_counter=0
+            ping_flag=0
+            while [ "$ping_counter" -lt 20 ]; do
+              if [[ $(ping -c 5 172.30.10.72) ]]; then
+                ping_flag=1
+                break
+              fi
+              ((ping_counter++))
+              sleep 10
+            done
+
+            if [ "$ping_flag" -eq 1 ]; then
+              echo "Slave is pingable, now wait 180 seconds for services to start"
+              sleep 180
+            else
+              echo "Slave did not come back up after reboot: please check opnfv-jump-2"
+              exit 1
+            fi
+
+            set +o nounset
+            deactivate
+
+            echo
+            echo "--------------------------------------------------------"
+            echo "Done!"
+
 ########################
 # trigger macros
 ########################
 - trigger:
     name: 'fuel-master'
     triggers:
-        - pollscm: '0 21 * * *'
+        - timed: '0 3 * * *'
 
 - trigger:
     name: 'fuel-stable-arno'
     triggers:
-        - pollscm: '0 3 * * *'
+        - timed: '0 7 * * *'