Cleanup jjb files
[releng.git] / jjb / compass4nfv / compass4nfv.yml
old mode 100755 (executable)
new mode 100644 (file)
index 9c94871..9db53e6
@@ -1,4 +1,3 @@
-# this is the job configuration for bgs
 - project:
 
     name: compass
@@ -6,28 +5,32 @@
     installer: 'compass'
 
     jobs:
-        - 'compass-verify'
-        - 'compass-upload-iso'
-        - 'compass-merge'
+        - 'compass-verify-{stream}'
         - 'compass-daily-{stream}'
-        - 'compass-build'
+        - 'compass-build-iso'
+        - 'compass-build-ppa'
         - 'compass-deploy-virtual-{flavor}'
+        - 'compass-deploy-bare-huawei-us'
 
-    # stream:    branch with - in place of / (eg. stable-helium)
-    # branch:    branch (eg. stable/helium)
+# only master branch is enabled at the moment to keep no of jobs sane
     stream:
         - master:
             branch: 'master'
+            gs-pathname: ''
+#        - stable-brahmaputra:
+#            branch: 'stable/brahmaputra'
+#            gs-pathname: '/brahmaputra'
 
     flavor:
-        - five:
-            conf: 'five'
-            node: 'compass-build-deploy-02'
+        - cluster-odl:
+            conf: 'virtual_cluster_odl'
+            node: 'huawei-deploy-vm'
+        - cluster-onos:
+            conf: 'virtual_cluster_onos'
+            node: 'huawei-deploy-vm'
         - cluster:
-            conf: 'cluster'
-            node: 'compass-build-deploy-03'
-
-
+            conf: 'virtual_cluster'
+            node: 'huawei-deploy-vm'
 
     project: 'compass4nfv'
 
 # job templates
 ########################
 - job-template:
-    name: 'compass-upload-iso'
-    project-type: freestyle
-    disabled: false
-
-    node: master
-
-    logrotate:
-        daysToKeep: 30
-        numToKeep: 10
-        artifactDaysToKeep: -1
-        artifactNumToKeep: -1
-
-    parameters:
-        - project-parameter:
-            project: '{project}'
-        - compass-parameter:
-             installer: '{installer}'
-
-    wrappers:
-        - ssh-agent-credentials:
-            user: '{ssh-credentials}'
-
-    builders:
-        - 'compass-copy-artifact'
-        - 'compass-upload-artifact'
-
-- job-template:
-    name: 'compass-verify'
-
-    project-type: freestyle
+    name: 'compass-verify-{stream}'
 
     disabled: false
 
-    node: compass-build-deploy-03
+    node: 'huawei-deploy-vm'
 
-    logrotate:
-        daysToKeep: 30
-        numToKeep: 10
-        artifactDaysToKeep: -1
-        artifactNumToKeep: -1
+    concurrent: true
+
+    properties:
+        - throttle:
+            enabled: true
+            max-total: 3
+            max-per-node: 1
 
     parameters:
         - project-parameter:
             branch: 'master'
         - compass-parameter:
             installer: '{installer}'
-
+        - string:
+            name: FLAVOR_CONF
+            default: 'virtual_cluster'
+            description: ""
     scm:
         - gerrit-trigger-scm:
             credentials-id: '{ssh-credentials}'
             refspec: '$GERRIT_REFSPEC'
             choosing-strategy: 'gerrit'
 
-    wrappers:
-        - ssh-agent-credentials:
-            user: '{ssh-credentials}'
-
     triggers:
         - gerrit:
             trigger-on:
                 branches:
                   - branch-compare-type: 'ANT'
                     branch-pattern: '**/master'
+                forbidden-file-paths:
+                  - compare-type: ANT
+                    pattern: 'docs/**|.gitignore'
 
     builders:
-        - 'compass-build'
-        #- 'compass-workspace-cleanup'
+        - 'builder-compass-build-iso'
+        - 'builder-compass-deploy-virtual-flavor'
+    publishers:
+        - archive:
+            artifacts: 'ansible.log'
+            allow-empty: 'true'
+            fingerprint: true
 
 - job-template:
-    name: 'compass-merge'
-
-    # builder-merge job to run JJB update
-    #
-    # This job's purpose is to update all the JJB
+    name: 'compass-daily-{stream}'
 
-    project-type: freestyle
+    node: huawei-build
 
-    node: compass-build-deploy-03
+    concurrent: true
 
-    logrotate:
-        daysToKeep: 30
-        numToKeep: 40
-        artifactDaysToKeep: -1
-        artifactNumToKeep: 5
+    properties:
+        - throttle:
+            enabled: true
+            max-total: 1
+            max-per-node: 1
 
     parameters:
         - project-parameter:
             project: '{project}'
-        - gerrit-parameter:
-            branch: 'master'
         - compass-parameter:
             installer: '{installer}'
+
     scm:
-        - gerrit-trigger-scm:
+        - git-scm:
             credentials-id: '{ssh-credentials}'
             refspec: ''
-            choosing-strategy: 'default'
-
-    wrappers:
-        - ssh-agent-credentials:
-            user: '{ssh-credentials}'
+            branch: '{branch}'
 
     triggers:
-        - gerrit:
-            trigger-on:
-                - change-merged-event
-                - comment-added-contains-event:
-                    comment-contains-value: 'remerge'
-            projects:
-              - project-compare-type: 'ANT'
-                project-pattern: '{project}'
-                branches:
-                    - branch-compare-type: 'ANT'
-                      branch-pattern: '**/master'
+        - timed: '@midnight'
+
     builders:
-        - 'compass-merge'
+        - trigger-builds:
+          - project: 'compass-build-iso'
+            git-revision: true
+            block: true
+        - trigger-builds:
+          - project: 'compass-deploy-virtual-cluster'
+            git-revision: true
+            block: true
+#        - trigger-builds:
+#          - project: 'compass-deploy-virtual-cluster-odl'
+#            git-revision: true
+#            block: true
+        - trigger-builds:
+          - project: 'compass-deploy-virtual-cluster-onos'
+            git-revision: true
+            block: true
 
 - job-template:
-    name: 'compass-daily-{stream}'
+    name: 'compass-build-iso'
 
-    project-type: freestyle
+    node: ericsson-build
 
-    node: compass-build-deploy-03
+    concurrent: true
+
+    properties:
+        - throttle:
+            enabled: true
+            max-total: 1
+            max-per-node: 1
 
     parameters:
         - project-parameter:
         - git-scm:
             credentials-id: '{ssh-credentials}'
             refspec: ''
-            branch: '{branch}'
-
-    triggers:
-        - pollscm: '@midnight'
-
-    logrotate:
-        daysToKeep: 30
-        numToKeep: 10
-        artifactDaysToKeep: -1
-        artifactNumToKeep: -1
+            branch: 'master'
 
     builders:
-        #- 'compass-build'
-        #- 'compass-upload-artifact'
-        #- 'compass-workspace-cleanup'
-        - shell: |
-            echo "Hello world!"
-            echo "compass-deploy-virtual job will be triggered!"
-
-    publishers:
-        - trigger:
-            project: 'compass-deploy-virtual-five'
-            threshold: SUCCESS
-        - trigger:
-            project: 'compass-deploy-virtual-cluster'
-            threshold: SUCCESS
+        - 'builder-compass-build-iso'
+        - 'builder-compass-upload-artifact'
+        - 'builder-compass-workspace-cleanup'
 
 - job-template:
-    name: 'compass-build'
+    name: 'compass-build-ppa'
+
+    description: "build ppa(using docker) in huawei lab"
 
-    project-type: freestyle
+    node: huawei-build
 
-    node: compass-build-deploy-03
+    concurrent: true
 
-    logrotate:
-        daysToKeep: 30
-        numToKeep: 10
-        artifactDaysToKeep: -1
-        artifactNumToKeep: -1
+    properties:
+        - throttle:
+            enabled: true
+            max-total: 1
+            max-per-node: 1
 
     parameters:
         - project-parameter:
             refspec: ''
             branch: 'master'
 
-    builders:
-        - 'compass-build'
-        - 'compass-workspace-cleanup'
+    triggers:
+        - timed: 'H 16 * * *'
 
-    publishers:
-        - archive:
-            artifacts: '$BUILD_DIRECTORY/*.*'
-            allow-empty: 'true'
-            fingerprint: true
-        - trigger:
-            project: 'compass-upload-iso'
-            threshold: SUCCESS
+    builders:
+        - 'builder-compass-make-ppa'
 
 - job-template:
     name: 'compass-deploy-virtual-{flavor}'
 
-    project-type: freestyle
-
     disabled: false
 
     node: '{node}'
 
+    concurrent: true
+
+    properties:
+        - throttle:
+            enabled: true
+            max-total: 1
+            max-per-node: 1
+
     parameters:
         - project-parameter:
             project: '{project}'
             default: '{conf}'
             description: ""
 
-    triggers:
-        - pollscm: "H/2 * * * *"
+    builders:
+        - 'builder-compass-ci-preclean-workspace'
+        - 'builder-compass-download-artifact'
+        - 'builder-compass-deploy-virtual-flavor'
+    publishers:
+        - archive:
+            artifacts: 'ansible.log'
+            allow-empty: 'true'
+            fingerprint: true
+
+- job-template:
+    name: 'compass-deploy-bare-huawei-us'
+
+    disabled: false
+
+    node: 'huawei-us-deploy-bare-1'
 
-    logrotate:
-        daysToKeep: 30
-        numToKeep: 10
-        artifactDaysToKeep: -1
-        artifactNumToKeep: -1
+    concurrent: true
+
+    properties:
+        - throttle:
+            enabled: true
+            max-total: 1
+            max-per-node: 1
+
+    parameters:
+        - project-parameter:
+            project: '{project}'
+        - compass-parameter:
+            installer: '{installer}'
 
     builders:
-        - 'compass-ci-preclean-workspace'
-        - 'compass-deploy-virtual-flavor'
+        - 'builder-compass-ci-preclean-workspace'
+        - 'builder-compass-download-artifact'
+        - 'builder-compass-deploy-bare'
+
+    publishers:
+        - archive:
+            artifacts: 'ansible.log'
+            allow-empty: 'true'
+            fingerprint: true
 
 ########################
 # parameter macros
             description: "Installer to use."
         - string:
             name: BUILD_DIRECTORY
-            default: build_output
+            default: $WORKSPACE/build_output
             description: "Directory where the build artifact will be located upon the completion of the build."
         - string:
             name: CACHE_DIRECTORY
-            default: $HOME/opnfv/cache/$INSTALLER
+            default: $HOME/opnfv/cache/$PROJECT
             description: "Directory where the cache to be used during the build is located."
         - string:
             name: GIT_BASE
             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
         - string:
             name: GS_URL
-            default: artifacts.opnfv.org/$PROJECT/$INSTALLER
+            default: artifacts.opnfv.org/$PROJECT/
             description: "URL to Google Storage."
         - string:
-            name: INTERNAL_REPO
-            default: "root@192.168.127.11:~/xh/work/build/work"
-            description: "Artifact Repository"
+            name: GS_URL_PROXY
+            default: build.opnfv.org/artifacts/$PROJECT/
+            description: "URL to Google Storage proxy"
+        - string:
+            name: installer_ip
+            default: "192.168.200.2"
+        - string:
+            name: PPA_REPO
+            default: "http://205.177.226.235:9999"
+        - string:
+            name: PPA_CACHE
+            default: "$WORKSPACE/work/repo/"
+
 ########################
 # builder macros
 ########################
 - builder:
-    name: compass-copy-artifact
-    builders:
-        - copyartifact:
-            project: "compass-build"
-            filter: "$BUILD_DIRECTORY/compass.iso, $BUILD_DIRECTORY/opnfv.properties"
-            target: ./
-            which-build: upstream-build
-            optional: true
-            flatten: true
-            parameter-filters: PUBLISH=true
-
-
-- builder:
-    name: compass-merge
+    name: 'builder-compass-make-ppa'
     builders:
         - shell: |
             #!/bin/bash
-            echo "Hello World!"
-
+            set -x
+            set -o errexit
+            set -o nounset
+            set -o pipefail
+            # make ppa
+            cd $WORKSPACE/
+            ./build/make_repo.sh
+            # calc MD5 of ppa
+            cd $PPA_CACHE
+            for i in $(find *.gz *.iso *.img -type f)
+            do
+                md5=$(md5sum $i | cut -d ' ' -f1)
+                echo $md5 > $i.md5
+                curl -T $i $PPA_REPO
+                curl -T $i.md5 $PPA_REPO
+            done
 
 - builder:
-    name: 'compass-build'
+    name: 'builder-compass-build-iso'
     builders:
         - shell: |
             #!/bin/bash
 
             # create the cache directory if it doesn't exist
             [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
+            [[ -d $BUILD_DIRECTORY ]] || mkdir -p $BUILD_DIRECTORY
 
             # set OPNFV_ARTIFACT_VERSION
             export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
 
             # start the build
-            cd $WORKSPACE/ci
-            ./build.sh
-            mkdir $WORKSPACE/$BUILD_DIRECTORY
-            mv $WORKSPACE/ci/work/compass.iso $WORKSPACE/$BUILD_DIRECTORY/
+            if [ -d $PPA_CACHE ]
+            then
+                cp $PPA_CACHE/*.tar.gz $PPA_CACHE/*.iso $PPA_CACHE/*.img $CACHE_DIRECTORY/ -f
+            fi
+
+            cd $WORKSPACE/
+            ./build.sh  --iso-dir $BUILD_DIRECTORY/ --iso-name compass.iso -c $CACHE_DIRECTORY
 
             # list the build artifacts
-            ls -al $WORKSPACE/$BUILD_DIRECTORY
+            ls -al $BUILD_DIRECTORY
 
             # save information regarding artifact into file
             (
                 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
                 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
                 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
-                echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $WORKSPACE/$BUILD_DIRECTORY/compass.iso | cut -d' ' -f1)"
+                echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/compass.iso | cut -d' ' -f1)"
                 echo "OPNFV_BUILD_URL=$BUILD_URL"
-            ) > $WORKSPACE/$BUILD_DIRECTORY/opnfv.properties
-
+            ) > $BUILD_DIRECTORY/opnfv.properties
             echo
             echo "--------------------------------------------------------"
             echo "Done!"
 
 - builder:
-    name: 'compass-deploy'
+    name: 'builder-compass-deploy-virtual-flavor'
     builders:
         - shell: |
             #!/bin/bash
-            set -o errexit
-            set -o nounset
-            set -o pipefail
+            set -x
 
             # log info to console
-            echo "Hello world!"
+            echo "Starting the deployment on virtual environment using $INSTALLER. This could take some time..."
+            echo "--------------------------------------------------------"
+            echo
+
+            export ISO_URL=file://$BUILD_DIRECTORY/compass.iso
+            cd $WORKSPACE
+
+            ./deploy.sh $FLAVOR_CONF
+            if [ $? -ne 0 ]; then
+                echo "depolyment failed!"
+                deploy_ret=1
+            fi
+
+            echo
+            echo "--------------------------------------------------------"
+            echo "Done!"
+
+            ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
+            sshpass -p root scp 2>/dev/null $ssh_options root@${installer_ip}:/var/ansible/run/openstack_juno-opnfv2/ansible.log ./  &> /dev/null
+
+            exit $deploy_ret
 
 - builder:
-    name: 'compass-deploy-virtual-flavor'
+    name: 'builder-compass-deploy-bare'
     builders:
         - shell: |
             #!/bin/bash
-            set -o errexit
-            set -o nounset
-            set -o pipefail
+            set -x
 
             # log info to console
-            echo "Starting the deployment on virtual environment using $INSTALLER. This could take some time..."
+            echo "Starting the deployment on baremetal environment using $INSTALLER. This could take some time..."
             echo "--------------------------------------------------------"
             echo
 
+            export CONFDIR=$WORKSPACE/deploy/conf/hardware_environment/huawei_us_lab/pod1
+            export ISO_URL=file://$BUILD_DIRECTORY/compass.iso
+            export EXTERNAL_NIC=eth0
+            export INSTALL_NIC=eth1
+
             cd $WORKSPACE
-            ./ci/deploy.sh $FLAVOR_CONF
-            # ssh -o BatchMode=yes -o TCPKeepAlive=yes cideploy@10.118.34.205 ./cideploy.sh
+
+            ./deploy.sh --dha $CONFDIR/dha.yml --network $CONFDIR/network.yml
+            if [ $? -ne 0 ]; then
+                echo "depolyment failed!"
+                deploy_ret=1
+            fi
 
             echo
             echo "--------------------------------------------------------"
             echo "Done!"
 
+            ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
+            sshpass -p root scp 2>/dev/null $ssh_options root@${installer_ip}:/var/ansible/run/openstack_juno-opnfv2/ansible.log ./  &> /dev/null
+
+            exit $deploy_ret
+
 - builder:
-    name: 'compass-upload-artifact'
+    name: 'builder-compass-upload-artifact'
     builders:
         - shell: |
             #!/bin/bash
             echo
 
             # source the opnfv.properties to get ARTIFACT_VERSION
-            source $WORKSPACE/opnfv.properties
-
-            scp $WORKSPACE/compass.iso $INTERNAL_REPO/
-            scp $WORKSPACE/opnfv.properties $INTERNAL_REPO/
-            scp $WORKSPACE/compass.iso $INTERNAL_REPO/opnfv-$OPNFV_ARTIFACT_VERSION.iso
+            source $BUILD_DIRECTORY/opnfv.properties
 
             # upload artifact and additional files to google storage
-            gsutil cp $WORKSPACE/compass.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
-            gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
-            gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
+            gsutil cp $BUILD_DIRECTORY/compass.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
+            gsutil cp $BUILD_DIRECTORY/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
+            gsutil cp $BUILD_DIRECTORY/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
 
             echo
             echo "--------------------------------------------------------"
             echo "Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
 
 - builder:
-    name: 'compass-download-artifact'
+    name: 'builder-compass-download-artifact'
     builders:
         - shell: |
             #!/bin/bash
             echo
 
             # get the latest.properties file in order to get info regarding latest artifact
-            curl -s -o $WORKSPACE/latest.properties http://$GS_URL/latest.properties
+            [[ -d $BUILD_DIRECTORY ]] || mkdir -p $BUILD_DIRECTORY
+            curl -s -o $BUILD_DIRECTORY/latest.properties http://$GS_URL/latest.properties
 
             # check if we got the file
-            [[ -f latest.properties ]] || exit 1
+            [[ -f $BUILD_DIRECTORY/latest.properties ]] || exit 1
 
             # source the file so we get OPNFV vars
-            source latest.properties
+            source $BUILD_DIRECTORY/latest.properties
 
             # download the file
-            curl -s -o $WORKSPACE/opnfv.iso http://$OPNFV_ARTIFACT_URL > gsutil.iso.log 2>&1
+            curl -s -o $BUILD_DIRECTORY/compass.iso http://$OPNFV_ARTIFACT_URL > gsutil.iso.log 2>&1
 
             # list the file
-            ls -al $WORKSPACE/opnfv.iso
+            ls -al $BUILD_DIRECTORY/compass.iso
 
             echo
             echo "--------------------------------------------------------"
             echo "Done!"
 
 - builder:
-    name: 'compass-workspace-cleanup'
+    name: 'builder-compass-workspace-cleanup'
     builders:
         - shell: |
             #!/bin/bash
             /bin/rm -rf $WORKSPACE
 
 - builder:
-    name: 'compass-ci-preclean-workspace'
+    name: 'builder-compass-ci-preclean-workspace'
     builders:
         - shell: |
             #!/bin/bash