diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | docs/jenkins-job-builder/opnfv-jjb-usage.rst | 8 | ||||
-rwxr-xr-x | jjb/apex/apex-build.sh | 8 | ||||
-rwxr-xr-x | jjb/apex/apex-deploy.sh | 2 | ||||
-rw-r--r-- | jjb/cperf/cperf-ci-jobs.yml | 12 | ||||
-rw-r--r-- | jjb/daisy4nfv/daisy-daily-jobs.yml | 1 | ||||
-rw-r--r-- | jjb/daisy4nfv/daisy-project-jobs.yml | 11 | ||||
-rw-r--r-- | jjb/daisy4nfv/daisy4nfv-merge-jobs.yml | 5 | ||||
-rw-r--r-- | jjb/daisy4nfv/daisy4nfv-verify-jobs.yml | 46 | ||||
-rw-r--r-- | jjb/test-requirements.txt | 1 | ||||
-rwxr-xr-x | jjb/yardstick/yardstick-daily.sh | 2 | ||||
-rw-r--r-- | modules/requirements.txt | 3 | ||||
-rw-r--r-- | modules/test-requirements.txt | 6 | ||||
-rw-r--r-- | setup.py | 9 | ||||
-rw-r--r-- | tox.ini | 34 |
15 files changed, 104 insertions, 45 deletions
diff --git a/.gitignore b/.gitignore index 431e52139..eeabaeb63 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ testapi_venv/ .cache .tox *.retry +job_output/ diff --git a/docs/jenkins-job-builder/opnfv-jjb-usage.rst b/docs/jenkins-job-builder/opnfv-jjb-usage.rst index 52dbdebe5..f34833f5c 100644 --- a/docs/jenkins-job-builder/opnfv-jjb-usage.rst +++ b/docs/jenkins-job-builder/opnfv-jjb-usage.rst @@ -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. diff --git a/jjb/apex/apex-build.sh b/jjb/apex/apex-build.sh index 220d02435..b6b2f212a 100755 --- a/jjb/apex/apex-build.sh +++ b/jjb/apex/apex-build.sh @@ -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 diff --git a/jjb/apex/apex-deploy.sh b/jjb/apex/apex-deploy.sh index 6343b838b..c7ca3f5e3 100755 --- a/jjb/apex/apex-deploy.sh +++ b/jjb/apex/apex-deploy.sh @@ -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" diff --git a/jjb/cperf/cperf-ci-jobs.yml b/jjb/cperf/cperf-ci-jobs.yml index 6cd4e22dc..f6e068530 100644 --- a/jjb/cperf/cperf-ci-jobs.yml +++ b/jjb/cperf/cperf-ci-jobs.yml @@ -126,18 +126,20 @@ 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 \ @@ -148,7 +150,7 @@ 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 \ @@ -160,7 +162,7 @@ -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 diff --git a/jjb/daisy4nfv/daisy-daily-jobs.yml b/jjb/daisy4nfv/daisy-daily-jobs.yml index c5d8e7e8b..aac76baa4 100644 --- a/jjb/daisy4nfv/daisy-daily-jobs.yml +++ b/jjb/daisy4nfv/daisy-daily-jobs.yml @@ -71,7 +71,6 @@ use-build-blocker: true blocking-jobs: - 'daisy-daily-.*' - - 'daisy4nfv-(merge|verify)-.*' block-level: 'NODE' wrappers: diff --git a/jjb/daisy4nfv/daisy-project-jobs.yml b/jjb/daisy4nfv/daisy-project-jobs.yml index 52769ca88..e631ee9b9 100644 --- a/jjb/daisy4nfv/daisy-project-jobs.yml +++ b/jjb/daisy4nfv/daisy-project-jobs.yml @@ -54,6 +54,11 @@ enabled: true max-total: 4 option: 'project' + - build-blocker: + use-build-blocker: true + blocking-jobs: + - '{installer}-daily-.*' + block-level: 'NODE' scm: - git-scm @@ -138,12 +143,6 @@ 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 diff --git a/jjb/daisy4nfv/daisy4nfv-merge-jobs.yml b/jjb/daisy4nfv/daisy4nfv-merge-jobs.yml index 95e72e550..9e7b867af 100644 --- a/jjb/daisy4nfv/daisy4nfv-merge-jobs.yml +++ b/jjb/daisy4nfv/daisy4nfv-merge-jobs.yml @@ -29,7 +29,7 @@ - 'build': slave-label: 'opnfv-build-centos' - 'deploy-virtual': - slave-label: 'opnfv-build-centos' + slave-label: 'daisy-virtual' ##################################### # jobs ##################################### @@ -148,8 +148,7 @@ - build-blocker: use-build-blocker: true blocking-jobs: - - '{alias}-(merge|verify)-.*' - - '{project}-daily-.*' + - '{alias}-merge-(master|danube)' block-level: 'NODE' scm: diff --git a/jjb/daisy4nfv/daisy4nfv-verify-jobs.yml b/jjb/daisy4nfv/daisy4nfv-verify-jobs.yml index 9f44d99fb..a0ec2ebd7 100644 --- a/jjb/daisy4nfv/daisy4nfv-verify-jobs.yml +++ b/jjb/daisy4nfv/daisy4nfv-verify-jobs.yml @@ -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 @@ -39,29 +38,22 @@ ##################################### - 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' @@ -108,6 +100,15 @@ - 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 projects: @@ -124,33 +125,21 @@ - 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}' @@ -158,7 +147,6 @@ - '{slave-label}-defaults' - '{alias}-verify-defaults': gs-pathname: '{gs-pathname}' - builders: - description-setter: description: "Built on $NODE_NAME" @@ -177,6 +165,16 @@ - 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 index 000000000..6b700dcfc --- /dev/null +++ b/jjb/test-requirements.txt @@ -0,0 +1 @@ +jenkins-job-builder diff --git a/jjb/yardstick/yardstick-daily.sh b/jjb/yardstick/yardstick-daily.sh index f769e9cdd..973f83ad5 100755 --- a/jjb/yardstick/yardstick-daily.sh +++ b/jjb/yardstick/yardstick-daily.sh @@ -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 index 000000000..1eaf8d089 --- /dev/null +++ b/modules/requirements.txt @@ -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 index 000000000..99d7f1313 --- /dev/null +++ b/modules/test-requirements.txt @@ -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 index 000000000..2d9246ec4 --- /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 index 000000000..e9f5fbb0b --- /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 |