Created DSVM Job for NPM Projects

Create a devstack environment against which a nodejs project may
be tested. Pre and post hooks are delegated directly to npm via
custom commands, which can be configured per job. The Post hook
additionally is passed the path to devstack's generated 'clouds.yaml'
file, which contains credentials for an admin, a non-admin, and
an alternate user.

Example format:

clouds:
  devstack:
    auth: ...
  devstack-admin:
    auth: ...
  devstack-alt:
    auth: ...

Co-Authored-By: Corentin Ardeois <cardeois@internap.com>
Change-Id: I48624786cc5dacf7d94653c0ce269236ba8c442c
This commit is contained in:
Michael Krotscheck 2016-07-27 14:42:08 -07:00
parent 68fcf0822d
commit 79a6ad8c3a
4 changed files with 99 additions and 0 deletions

View File

@ -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'

View File

@ -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:

View File

@ -3623,6 +3623,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

View File

@ -3102,6 +3102,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
@ -9541,6 +9544,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: