Merge "xci: Configure daily job to use xci scripts"
authorFatih Degirmenci <fatih.degirmenci@ericsson.com>
Sun, 2 Apr 2017 16:51:15 +0000 (16:51 +0000)
committerGerrit Code Review <gerrit@opnfv.org>
Sun, 2 Apr 2017 16:51:15 +0000 (16:51 +0000)
15 files changed:
.gitignore
docs/jenkins-job-builder/opnfv-jjb-usage.rst
jjb/apex/apex-build.sh
jjb/apex/apex-deploy.sh
jjb/cperf/cperf-ci-jobs.yml
jjb/daisy4nfv/daisy-daily-jobs.yml
jjb/daisy4nfv/daisy-project-jobs.yml
jjb/daisy4nfv/daisy4nfv-merge-jobs.yml
jjb/daisy4nfv/daisy4nfv-verify-jobs.yml
jjb/test-requirements.txt [new file with mode: 0644]
jjb/yardstick/yardstick-daily.sh
modules/requirements.txt [new file with mode: 0644]
modules/test-requirements.txt [new file with mode: 0644]
setup.py [new file with mode: 0644]
tox.ini [new file with mode: 0644]

index 431e521..eeabaeb 100644 (file)
@@ -35,3 +35,4 @@ testapi_venv/
 .cache
 .tox
 *.retry
+job_output/
index 52dbdeb..f34833f 100644 (file)
@@ -21,6 +21,14 @@ Make changes::
     To ssh://agardner@gerrit.opnfv.org:29418/releng.git
      * [new branch]      HEAD -> refs/publish/master
 
+Test with tox::
+
+    tox -v -ejjb
+
+Submit the change to gerrit::
+
+    git review -v
+
 Follow the link to gerrit https://gerrit.opnfv.org/gerrit/51 in a few moments
 the verify job will have completed and you will see Verified +1 jenkins-ci in
 the gerrit ui.
index 220d024..b6b2f21 100755 (executable)
@@ -28,10 +28,10 @@ cd $WORKSPACE/ci
 ./build.sh $BUILD_ARGS
 RPM_VERSION=$(grep Version: $WORKSPACE/build/rpm_specs/opnfv-apex.spec | awk '{ print $2 }')-$(echo $OPNFV_ARTIFACT_VERSION | tr -d '_-')
 # list the contents of BUILD_OUTPUT directory
-echo "Build Directory is ${BUILD_DIRECTORY}"
+echo "Build Directory is ${BUILD_DIRECTORY}/../.build"
 echo "Build Directory Contents:"
 echo "-------------------------"
-ls -al $BUILD_DIRECTORY
+ls -al ${BUILD_DIRECTORY}/../.build
 
 # list the contents of CACHE directory
 echo "Cache Directory is ${CACHE_DIRECTORY}"
@@ -47,10 +47,10 @@ if ! echo $BUILD_TAG | grep "apex-verify" 1> /dev/null; then
     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_SHA512SUM=$(sha512sum $BUILD_DIRECTORY/release/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)"
+    echo "OPNFV_ARTIFACT_SHA512SUM=$(sha512sum $BUILD_DIRECTORY/../.build/release/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)"
     echo "OPNFV_SRPM_URL=$GS_URL/opnfv-apex-$RPM_VERSION.src.rpm"
     echo "OPNFV_RPM_URL=$GS_URL/opnfv-apex-$RPM_VERSION.noarch.rpm"
-    echo "OPNFV_RPM_SHA512SUM=$(sha512sum $BUILD_DIRECTORY/noarch/opnfv-apex-$RPM_VERSION.noarch.rpm | cut -d' ' -f1)"
+    echo "OPNFV_RPM_SHA512SUM=$(sha512sum $BUILD_DIRECTORY/../.build/noarch/opnfv-apex-$RPM_VERSION.noarch.rpm | cut -d' ' -f1)"
     echo "OPNFV_BUILD_URL=$BUILD_URL"
   ) > $WORKSPACE/opnfv.properties
 fi
index 6343b83..c7ca3f5 100755 (executable)
@@ -123,7 +123,7 @@ if [[ "$BUILD_DIRECTORY" == *verify* || "$BUILD_DIRECTORY" == *promote* ]]; then
 # use RPMs
 else
     # find version of RPM
-    VERSION_EXTENSION=$(echo $(basename $RPM_LIST) | grep -Eo '[0-9]+\.[0-9]+-[0-9]{8}')
+    VERSION_EXTENSION=$(echo $(basename $RPM_LIST) | grep -Eo '[0-9]+\.[0-9]+-([0-9]{8}|[a-z]+-[0-9]\.[0-9]+)')
     # build RPM List which already includes base Apex RPM
     for pkg in ${APEX_PKGS}; do
         RPM_LIST+=" ${RPM_INSTALL_PATH}/opnfv-apex-${pkg}-${VERSION_EXTENSION}.noarch.rpm"
index 6cd4e22..f6e0685 100644 (file)
             undercloud_mac=$(sudo virsh domiflist undercloud | grep default | \
                               grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+")
             INSTALLER_IP=$(/usr/sbin/arp -e | grep ${undercloud_mac} | awk {'print $1'})
+
             sudo scp -o StrictHostKeyChecking=no root@$INSTALLER_IP:/home/stack/overcloudrc /tmp/overcloudrc
             sudo chmod 755 /tmp/overcloudrc
             source /tmp/overcloudrc
 
             # robot suites need the ssh key to log in to controller nodes, so throwing it
             # in tmp, and mounting /tmp as $HOME as far as robot is concerned
-            sudo mkdir -p /tmp/.ssh
+            sudo rm -rf /tmp/.ssh
+            sudo mkdir /tmp/.ssh
+            sudo chmod 0700 /tmp/.ssh
             sudo scp -o StrictHostKeyChecking=no root@$INSTALLER_IP:/home/stack/.ssh/id_rsa /tmp/.ssh/
             sudo chown -R jenkins-ci:jenkins-ci /tmp/.ssh
             # done with sudo. jenkins-ci is the user from this point
-            sudo mv /tmp/.ssh/id_rsa ~jenkins-ci/.ssh/
-            chmod -R 0600 ~jenkins-ci/.ssh
+            chmod 0600 /tmp/.ssh/id_rsa
 
             # cbench requires the openflow drop test feature to be installed.
             sshpass -p karaf ssh -o StrictHostKeyChecking=no \
 
             docker pull opnfv/cperf:$DOCKER_TAG
 
-            robot_cmd="pybot -e exclude -L TRACE \
+            robot_cmd="pybot -e exclude -L TRACE -d /tmp \
                         -v ODL_SYSTEM_1_IP:${SDN_CONTROLLER_IP} \
                         -v ODL_SYSTEM_IP:${SDN_CONTROLLER_IP} \
                         -v BUNDLEFOLDER:/opt/opendaylight \
                         -v of_port:6653"
             robot_suite="/home/opnfv/repos/odl_test/csit/suites/openflowplugin/Performance/010_Cbench.robot"
 
-            docker run -v /tmp:/tmp opnfv/cperf:$DOCKER_TAG ${robot_cmd} ${robot_suite}
+            docker run -ti -v /tmp:/tmp opnfv/cperf:$DOCKER_TAG ${robot_cmd} ${robot_suite}
 
 - builder:
     name: cperf-cleanup
index c5d8e7e..aac76ba 100644 (file)
@@ -71,7 +71,6 @@
             use-build-blocker: true
             blocking-jobs:
                 - 'daisy-daily-.*'
-                - 'daisy4nfv-(merge|verify)-.*'
             block-level: 'NODE'
 
     wrappers:
index 52769ca..e631ee9 100644 (file)
             enabled: true
             max-total: 4
             option: 'project'
+        - build-blocker:
+            use-build-blocker: true
+            blocking-jobs:
+                - '{installer}-daily-.*'
+            block-level: 'NODE'
 
     scm:
         - git-scm
             enabled: true
             max-total: 6
             option: 'project'
-        - build-blocker:
-            use-build-blocker: true
-            blocking-jobs:
-                - '{installer}-daily-.*'
-                - 'daisy4nfv-(merge|verify)-.*'
-            block-level: 'NODE'
 
     scm:
         - git-scm
index 95e72e5..9e7b867 100644 (file)
@@ -29,7 +29,7 @@
         - 'build':
             slave-label: 'opnfv-build-centos'
         - 'deploy-virtual':
-            slave-label: 'opnfv-build-centos'
+            slave-label: 'daisy-virtual'
 #####################################
 # jobs
 #####################################
         - build-blocker:
             use-build-blocker: true
             blocking-jobs:
-                - '{alias}-(merge|verify)-.*'
-                - '{project}-daily-.*'
+                - '{alias}-merge-(master|danube)'
             block-level: 'NODE'
 
     scm:
index 9f44d99..a0ec2eb 100644 (file)
@@ -1,10 +1,7 @@
 - project:
     name: 'daisy4nfv-verify-jobs'
-
     project: 'daisy'
-
     installer: 'daisy'
-
 ##########################################################
 # use alias to keep the jobs'name existed alread unchanged
 ##########################################################
@@ -26,7 +23,9 @@
 # patch verification phases
 #####################################
     phase:
-        - 'build':
+        - unit:
+            slave-label: 'opnfv-build'
+        - build:
             slave-label: 'opnfv-build-centos'
 #####################################
 # jobs
 #####################################
 - job-template:
     name: '{alias}-verify-{stream}'
-
     project-type: multijob
-
     disabled: false
-
     concurrent: true
-
     properties:
         - logrotate-default
         - throttle:
             enabled: true
             max-total: 4
             option: 'project'
-
     scm:
         - git-scm
-
     wrappers:
         - ssh-agent-wrapper
         - timeout:
             timeout: 360
             fail: true
-
     triggers:
         - gerrit:
             server-name: 'gerrit.opnfv.org'
     builders:
         - description-setter:
             description: "Built on $NODE_NAME"
+        - multijob:
+            name: unit
+            condition: SUCCESSFUL
+            projects:
+                - name: '{alias}-verify-{name}-{stream}'
+                  current-parameters: true
+                  node-parameters: false
+                  kill-phase-on: FAILURE
+                  abort-all-job: true
         - multijob:
             name: build
             condition: SUCCESSFUL
 
 - job-template:
     name: '{alias}-verify-{phase}-{stream}'
-
     disabled: '{obj:disabled}'
-
     concurrent: true
-
     properties:
         - logrotate-default
         - throttle:
             enabled: true
             max-total: 6
             option: 'project'
-        - build-blocker:
-            use-build-blocker: true
-            blocking-jobs:
-                - '{alias}-(merge|verify)-.*'
-                - '{installer}-daily-.*'
-            block-level: 'NODE'
-
     scm:
         - git-scm
-
     wrappers:
         - ssh-agent-wrapper
         - timeout:
             timeout: 360
             fail: true
-
     parameters:
         - project-parameter:
             project: '{project}'
         - '{slave-label}-defaults'
         - '{alias}-verify-defaults':
             gs-pathname: '{gs-pathname}'
-
     builders:
         - description-setter:
             description: "Built on $NODE_NAME"
         - shell:
             !include-raw: ./daisy4nfv-workspace-cleanup.sh
 
+- builder:
+    name: daisy-verify-unit-macro
+    builders:
+        - shell: |
+            #!/bin/bash
+            set -o errexit
+            set -o pipefail
+            set -o xtrace
+            tox -e py27
+
 #####################################
 # parameter macros
 #####################################
diff --git a/jjb/test-requirements.txt b/jjb/test-requirements.txt
new file mode 100644 (file)
index 0000000..6b700dc
--- /dev/null
@@ -0,0 +1 @@
+jenkins-job-builder
index f769e9c..973f83a 100755 (executable)
@@ -18,7 +18,7 @@ if [[ ${INSTALLER_TYPE} == 'apex' ]]; then
 elif [[ ${INSTALLER_TYPE} == 'joid' ]]; then
     # If production lab then creds may be retrieved dynamically
     # creds are on the jumphost, always in the same folder
-    labconfig="-v $LAB_CONFIG/admin-openrc:/home/opnfv/openrc"
+    labconfig="-v $LAB_CONFIG/admin-openrc:/etc/yardstick/openstack.creds"
     # If dev lab, credentials may not be the default ones, just provide a path to put them into docker
     # replace the default one by the customized one provided by jenkins config
 fi
diff --git a/modules/requirements.txt b/modules/requirements.txt
new file mode 100644 (file)
index 0000000..1eaf8d0
--- /dev/null
@@ -0,0 +1,3 @@
+paramiko>=2.0.1
+mock==1.3.0
+requests==2.9.1
diff --git a/modules/test-requirements.txt b/modules/test-requirements.txt
new file mode 100644 (file)
index 0000000..99d7f13
--- /dev/null
@@ -0,0 +1,6 @@
+# The order of packages is significant, because pip processes them in the order
+# of appearance. Changing the order has an impact on the overall integration
+# process, which may cause wedges in the gate later.
+
+nose
+coverage
diff --git a/setup.py b/setup.py
new file mode 100644 (file)
index 0000000..2d9246e
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,9 @@
+#!/usr/bin/env python
+
+from setuptools import setup
+
+setup(
+    name="opnfv",
+    version="master",
+    url="https://www.opnfv.org",
+)
diff --git a/tox.ini b/tox.ini
new file mode 100644 (file)
index 0000000..e9f5fbb
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,34 @@
+# Tox (http://tox.testrun.org/) is a tool for running tests
+# in multiple virtualenvs. This configuration file will run the
+# test suite on all supported python versions. To use it, "pip install tox"
+# and then run "tox" from this directory.
+
+[tox]
+envlist = py27
+skipsdist = True
+
+[testenv]
+usedevelop = True
+setenv=
+  HOME = {envtmpdir}
+  PYTHONPATH = {toxinidir}
+
+[testenv:jjb]
+deps =
+       -rjjb/test-requirements.txt
+commands=
+       jenkins-jobs test -o job_output -r jjb/
+
+[testenv:modules]
+deps=
+       -rmodules/requirements.txt
+       -rmodules/test-requirements.txt
+commands =
+       nosetests -w modules \
+       --with-xunit \
+       --xunit-file=modules/nosetests.xml \
+       --cover-package=opnfv \
+       --with-coverage \
+       --cover-xml \
+       --cover-html \
+       tests/unit