diff --git a/jenkins/jobs/javascript.yaml b/jenkins/jobs/javascript.yaml index faaa1597a1..377866d200 100644 --- a/jenkins/jobs/javascript.yaml +++ b/jenkins/jobs/javascript.yaml @@ -65,6 +65,47 @@ copy-after-failure: true - console-log +- job-template: + name: '{name}-dsvm-nodejs{version}-npm-run-{command}' + node: ubuntu-xenial + + wrappers: + - build-timeout: + timeout: 40 + - timestamps + + builders: + - print-template-name: + template-name: "{template-name}" + - gerrit-git-prep + - install-distro-packages + - nodejs-install: + version: "{version}" + - xvfb-install + - chrome-install + - firefox-install + - devstack-checkout + - revoke-sudo + - xvfb-start + - npm-dsvm-run: + pre_test_command: 'configure-devstack' + post_test_command: "{command}" + - assert-no-extra-files + publishers: + - devstack-logs + - scp: + site: 'static.openstack.org' + files: + - target: 'logs/$LOG_PATH' + source: 'reports/**' + keep-hierarchy: true + copy-after-failure: true + - target: 'logs/$LOG_PATH' + source: 'karma.subunit' + keep-hierarchy: false + copy-after-failure: true + - console-log + # Builds and uploads a tarball using NPM. - job-template: name: '{name}-nodejs{version}-npm-publish-tarball' diff --git a/jenkins/jobs/macros.yaml b/jenkins/jobs/macros.yaml index 8fe2a4e2f4..c231c0b344 100644 --- a/jenkins/jobs/macros.yaml +++ b/jenkins/jobs/macros.yaml @@ -428,6 +428,52 @@ npm shrinkwrap fi +- builder: + name: npm-dsvm-run + builders: + - shell: | + #!/bin/bash -eux + export PYTHONUNBUFFERED=true + export DEVSTACK_GATE_TEMPEST=0 + export DEVSTACK_GATE_EXERCISES=0 + export DEVSTACK_GATE_INSTALL_TESTONLY=1 + export DEVSTACK_GATE_NEUTRON=1 + + # Xvfb Buffer... + export DISPLAY=:99 + (cd $ZUUL_URL/$ZUUL_PROJECT && npm install ) + npm_lifecycle_phases="publish install version test stop start restart pack" + + # Run any custom devstack configuration required by the project + function pre_test_hook {{ + cd $ZUUL_URL/$ZUUL_PROJECT + + # Try running as a standard lifecycle script, otherwise try custom. + if [[ $npm_lifecycle_phases =~ (^| ){pre_test_command}($| ) ]]; then + npm {pre_test_command} --silent + else + npm run {pre_test_command} --silent + fi + }} + export -f pre_test_hook + + function post_test_hook {{ + # If you need access to devstack's clouds.yaml file, it is available + # at its canonical location at /etc/openstack/clouds.yaml + cd $ZUUL_URL/$ZUUL_PROJECT + + # Try running as a standard lifecycle script, otherwise try custom. + if [[ $npm_lifecycle_phases =~ (^| ){post_test_command}($| ) ]]; then + npm {post_test_command} --silent + else + npm run {post_test_command} --silent + fi + }} + export -f post_test_hook + + cp devstack-gate/devstack-vm-gate-wrap.sh ./safe-devstack-vm-gate-wrap.sh + ./safe-devstack-vm-gate-wrap.sh + - builder: name: xvfb-start builders: diff --git a/jenkins/jobs/projects.yaml b/jenkins/jobs/projects.yaml index 104dece29e..ad6d12831a 100644 --- a/jenkins/jobs/projects.yaml +++ b/jenkins/jobs/projects.yaml @@ -5322,6 +5322,12 @@ - nodejs4-publish-to-npm - nodejs6-jobs - nodejs6-docs + - '{name}-dsvm-nodejs{version}-npm-run-{command}': + command: functional-test + version: 4 + - '{name}-dsvm-nodejs{version}-npm-run-{command}': + command: functional-test + version: 6 - project: name: js-openstack-registry-hooks diff --git a/zuul/layout.yaml b/zuul/layout.yaml index bae55d0689..fcb54032c8 100755 --- a/zuul/layout.yaml +++ b/zuul/layout.yaml @@ -3144,6 +3144,9 @@ jobs: - name: ^.*-npm-docs$ voting: false + - name: ^.*-dsvm-nodejs[0-9]+-npm-run.*$ + voting: false + # Mutexes - name: reprepro-import-debian-openstack-jessie mutex: mirror.deb-openstack @@ -9586,6 +9589,9 @@ projects: - name: nodejs4-publish-to-npm - name: nodejs6-jobs - name: nodejs6-docs + check: + - js-openstack-lib-dsvm-nodejs6-npm-run-functional-test + - js-openstack-lib-dsvm-nodejs4-npm-run-functional-test - name: openstack/karma-subunit-reporter template: