Merge lp:~1chb1n/ubuntu-openstack-ci/deployer-refactor into lp:ubuntu-openstack-ci

Proposed by Ryan Beisner
Status: Merged
Merged at revision: 54
Proposed branch: lp:~1chb1n/ubuntu-openstack-ci/deployer-refactor
Merge into: lp:ubuntu-openstack-ci
Diff against target: 758 lines (+391/-158)
12 files modified
admin/650-boot-nova-nothings.sh (+37/-0)
admin/651-ping-nova-nothings.sh (+20/-0)
admin/655-delete-nova-nothings.sh (+28/-0)
admin/930-images-delete.sh (+27/-0)
job-parts/deploy_with_deployer.sh (+49/-120)
job-parts/lint_check.sh (+1/-1)
job-parts/osci_job_common.sh (+188/-3)
job-parts/workspace_cleanup.sh (+0/-1)
make_exec.py (+1/-1)
mp_comment.py (+39/-30)
populate/mappings.yaml (+1/-1)
populate/mp-comment.tmpl (+0/-1)
To merge this branch: bzr merge lp:~1chb1n/ubuntu-openstack-ci/deployer-refactor
Reviewer Review Type Date Requested Status
Ryan Beisner (community) Approve
Review via email: mp+243738@code.launchpad.net

Description of the change

refactor the deployer scripts; add initial heat support; mp_comment fixes

* update nova-nothing instance tests
* fix for cli checks
* fix logic error in basic cli test function
* fix touchfile naming for deploy scripts
* add heat and ceilometer basic cli check
* adjust deploy test tempest error detection
* add no-post-destroy
* add heat stack for tempest orchestration tests
* handle mp branch string no-match in deployer script
* add admin script to list or delete ~/images on jenkins nodes
* fix makefile executor target name parsing
* lower mp-comment verbosity for passing tests
* initial prep for multiple tests per mp comment

To post a comment you must log in.
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #154 lp:ubuntu-openstack-ci for 1chb1n mp243738
    LINT OK: passed

Build: http://10.230.18.80:8080/job/charm_lint_check/154/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #117 lp:ubuntu-openstack-ci for 1chb1n mp243738
    UNIT OK: passed

Build: http://10.230.18.80:8080/job/charm_unit_test/117/

Revision history for this message
Ryan Beisner (1chb1n) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'admin/650-boot-nova-nothings.sh'
2--- admin/650-boot-nova-nothings.sh 1970-01-01 00:00:00 +0000
3+++ admin/650-boot-nova-nothings.sh 2014-12-10 16:14:04 +0000
4@@ -0,0 +1,37 @@
5+#!/bin/bash -e
6+echo $0
7+
8+# Nova boot a bunch of instances on each OSCI network just for exercise
9+
10+param=$1
11+
12+if [ -z "$param" ]; then
13+ echo "Potentially dangerous, so you must confirm with YES."
14+ echo "Usage: <this script> YES"
15+fi
16+
17+if [ "$param" != "YES" ]; then
18+ exit 0
19+fi
20+
21+. ~/novarc
22+
23+net_uuids="$(neutron net-list | grep osci | awk '{ print $2 }' || true)"
24+if [ -z "$net_uuids" ]; then
25+ echo "Couldn't get UUIDs for OSCI neutron networks."
26+ exit 1
27+fi
28+
29+img_id="$(nova image-list | grep trusty-daily | tail -n 1 | awk '{ print $2 }' || true)"
30+if [ -z "$img_id" ]; then
31+ echo "Couldn't get UUID for lastest daily trusty image."
32+ exit 1
33+fi
34+
35+# add test key if non-existent
36+nova keypair-list | grep testkey &> /dev/null || { nova keypair-add testkey > testkey.pem; chmod 600 testkey.pem; }
37+
38+# boot stuff
39+for net_id in $net_uuids; do
40+ nova boot --num-instances 10 --image ${img_id} --flavor m1.smallswap --key_name testkey --nic net-id=${net_id} "osci-nova-nothing"
41+done
42
43=== added file 'admin/651-ping-nova-nothings.sh'
44--- admin/651-ping-nova-nothings.sh 1970-01-01 00:00:00 +0000
45+++ admin/651-ping-nova-nothings.sh 2014-12-10 16:14:04 +0000
46@@ -0,0 +1,20 @@
47+#!/bin/bash -e
48+echo $0
49+
50+# Ping a bunch of instances on each OSCI network just for exercise
51+
52+. $(dirname $0)/../env-common
53+. ~/novarc
54+
55+ip_addrs="$(nova list | grep nova-nothing | awk '{ print $12 '} | cut -f 2 -d "=" | sort || true)"
56+if [ -z "$ip_addrs" ]; then
57+ echo "Couldn't get IP addresses for OSCI nova-nothing instances."
58+ exit 1
59+fi
60+for ip_addr in $ip_addrs; do
61+ echo "========== ${ip_addr} =========="
62+ echo -n "ping: "
63+ ping -c 1 $ip_addr &> /dev/null && echo OK. || echo TROUBLE!
64+ echo -n "nc ssh: "
65+ nc -w 1 $ip_addr 22 &> /dev/null && echo OK. || echo TROUBLE!
66+done
67
68=== added file 'admin/655-delete-nova-nothings.sh'
69--- admin/655-delete-nova-nothings.sh 1970-01-01 00:00:00 +0000
70+++ admin/655-delete-nova-nothings.sh 2014-12-10 16:14:04 +0000
71@@ -0,0 +1,28 @@
72+#!/bin/bash -e
73+echo $0
74+
75+# Nova delete any "nova nothing" test instances in the current tenant
76+
77+param=$1
78+
79+if [ -z "$param" ]; then
80+ echo "Potentially dangerous, so you must confirm with YES."
81+ echo "Usage: <this script> YES"
82+fi
83+
84+if [ "$param" != "YES" ]; then
85+ exit 0
86+fi
87+
88+. ~/novarc
89+
90+instance_ids="$(nova list | grep osci-nova-nothing | awk '{ print $2 }' || true)"
91+
92+if [ -z "$instance_ids" ]; then
93+ echo "Couldn't get UUIDs for OSCI nova-nothing instances."
94+ exit 1
95+fi
96+
97+for instance_id in $instance_ids; do
98+ nova delete $instance_id
99+done
100
101=== added file 'admin/930-images-delete.sh'
102--- admin/930-images-delete.sh 1970-01-01 00:00:00 +0000
103+++ admin/930-images-delete.sh 2014-12-10 16:14:04 +0000
104@@ -0,0 +1,27 @@
105+#!/bin/bash -e
106+echo $0
107+
108+# Delete the contents of /var/lib/jenkins/images from the jenkins master and all jenkins slaves (!!)
109+
110+param=$1
111+
112+if [ -z "$param" ]; then
113+ echo "Deletes the ~/images contents on all jenkins units!"
114+ echo "Potentially dangerous, so you must confirm with YES."
115+ echo "Usage: <this script> YES"
116+ sleep 2
117+fi
118+
119+# Get jenkins units
120+units=$(juju status | egrep "osci[-]?(slave)?/[0-9]{1,10}:" \
121+ | cut -d ":" -f 1 | sed 's/^ *//')
122+for unit in $units; do
123+ echo "----- ${unit} -----"
124+ if [ "$param" == "YES" ]; then
125+ juju ssh $unit "sudo ls -al /var/lib/jenkins/images && sudo rm -fv /var/lib/jenkins/images/* || echo 'No Images Dir'"
126+ else
127+ echo " Not deleting, just listing:"
128+ juju ssh $unit "sudo ls -al /var/lib/jenkins/images || echo 'No Images Dir'"
129+ fi
130+done
131+
132
133=== modified file 'job-parts/deploy_with_deployer.sh'
134--- job-parts/deploy_with_deployer.sh 2014-12-04 21:43:55 +0000
135+++ job-parts/deploy_with_deployer.sh 2014-12-10 16:14:04 +0000
136@@ -1,132 +1,61 @@
137 #!/bin/bash -e
138-# Prep for deploy
139-
140-${OSCI_ROOT}/job-parts/system_tools_refresh.sh
141-${OSCI_ROOT}/job-parts/juju_cleanup.sh
142-
143-# Gather node info and package info
144-env | sort | tee $WORKSPACE/env.$BUILD_NUMBER
145-${OSCI_ROOT}/job-parts/get_pkg_info.sh || true
146-
147-# Handle merge-proposal triggers
148-if [[ -n "$MP_TRIGGER" ]] && [[ -n "$MP_SRC_BR" ]] && [[ -n "$MP_TGT_BR" ]] && [[ -n "$DISPLAY_NAME" ]]; then
149- echo "Triggered by merge proposal: ${MP_TRIGGER}"
150- $OSCI_ROOT/job-parts/find_replace.py -yd -i "$OPENSTACK_CHARM_TESTING_ROOT/$CHARM_SET" -o "$WORKSPACE/custom-other.yaml" -f "$MP_TGT_BR" -r "$MP_SRC_BR"
151- export CHARM_SET="custom-other.yaml"
152-fi
153-
154-# Deploy new openstack on openstack environment (tempstack)
155-# Handle deployer bundle file upload
156-if [[ "$CHARM_SET" == "custom-other.yaml" ]] && [[ -f custom-other.yaml ]]; then
157- echo "Using custom-other deployer bundle yaml file..."
158- BUNDLE_FILE=$WORKSPACE/$CHARM_SET
159- touch $WORKSPACE/fyi.custom.bundle
160-else
161- BUNDLE_FILE=$OPENSTACK_CHARM_TESTING_ROOT/$CHARM_SET
162- cp $OPENSTACK_CHARM_TESTING_ROOT/$CHARM_SET $WORKSPACE/$CHARM_SET.$BUILD_NUMBER
163-fi
164-
165-INST_SOURCE=""
166-[[ "$INSTALLATION_SOURCE" != "default" ]] && INST_SOURCE="-${INSTALLATION_SOURCE}"
167-
168-set -x
169-(cd $OPENSTACK_CHARM_TESTING_ROOT &&\
170-juju-deployer --bootstrap -c ${BUNDLE_FILE} -d ${UBUNTU_RELEASE}-${OPENSTACK_RELEASE}${INST_SOURCE}) \
171- 2>&1 | tee $WORKSPACE/deployer.$BUILD_NUMBER
172-sleep 20
173+# OpenStack Test Deployment
174+test="deploy"
175+
176+# Source the common functions
177+. ${OSCI_ROOT}/job-parts/osci_job_common.sh
178+
179+#f_fresh_clean_start
180+# NOTE: workspace not cleaned at this step, as the jenkins job may be copying
181+# artifacts to the workspace from another job (such as uploading a custom bundle).
182+# Workspace should have been cleaned as step 0 in the jenkins job.
183+f_refreshtools_jujuclean
184+f_env_no_pass
185+f_touch_try
186+
187+# Handle merge-proposal trigger and substitute the proposed branch in the bundle file
188+f_openstack_mergeprop_bundle_handler
189+
190+# Handle custom deployer bundle file if present
191+f_openstack_custom_bundle_handler
192+
193+# Deploy temp stack
194+f_openstack_deploy
195
196 # Confirm deployment, configure it, run tempest smoke
197+echo "Confirming deployment..."
198 juju_ok="$(${OSCI_ROOT}/job-parts/juju_deploy_ok.sh || true)"
199 echo $juju_ok
200
201 if [[ "$juju_ok" == *DEPLOYED:* ]]; then
202- echo "Juju deployment succeeded."
203- touch $WORKSPACE/fyi.deploy.ok
204-
205- . $OPENSTACK_CHARM_TESTING_ROOT/novarc
206- set -x
207- # just cycle to confirm cli is ok
208- neutron net-list 1> /dev/null || echo cli-fail
209- neutron subnet-list 1> /dev/null || echo cli-fail
210- nova network-list 1> /dev/null || echo cli-fail
211- nova keypair-list 1> /dev/null || echo cli-fail
212- nova secgroup-list 1> /dev/null || echo cli-fail
213- keystone user-list 1> /dev/null || echo cli-fail
214- keystone tenant-list 1> /dev/null || echo cli-fail
215- keystone endpoint-list 1> /dev/null || echo cli-fail
216- keystone service-list 1> /dev/null || echo cli-fail
217- glance image-list 1> /dev/null || echo cli-fail
218- nova image-list 1> /dev/null || echo cli-fail
219- cinder list 1> /dev/null || echo cli-fail
220- set +x
221-
222- # Configure the deployed tempstack
223- echo "Calling tempstack configure to tweak network, add test keys..."
224- ${OSCI_ROOT}/job-parts/tempstack_configure.sh 2>&1 | tee $WORKSPACE/tempstack-configure.$BUILD_NUMBER || true
225-
226- if [[ -n "$(grep testkey.pem $WORKSPACE/tempstack-configure.$BUILD_NUMBER || true)" ]]; then
227- touch $WORKSPACE/fyi.tempstack-configure.ok
228- else
229- echo "Tempstack configure failed."
230- touch $WORKSPACE/fyi.tempstack-configure.bad
231- fi
232-
233- cd $OPENSTACK_CHARM_TESTING_ROOT
234- ./configure 2>&1 | tee $WORKSPACE/configure.$BUILD_NUMBER || true
235- cp $OPENSTACK_CHARM_TESTING_ROOT/tempest.conf $WORKSPACE/tempest.conf.$BUILD_NUMBER || true
236-
237- if [[ -f $WORKSPACE/tempest.conf.$BUILD_NUMBER ]]; then
238- echo "Configure succeeded."
239- touch $WORKSPACE/fyi.configure.ok
240- else
241- echo "Configure failed."
242- touch $WORKSPACE/fyi.configure.bad
243- fi
244-
245- if [[ -n "$(ls $WORKSPACE -1 | egrep '.failed|.bad')" ]]; then
246- echo "Skipping tempest, one or more preceding steps are failed or bad."
247- touch $WORKSPACE/fyi.tempest.skipped
248- else
249- # Kick off tempest
250- (cd $OPENSTACK_CHARM_TESTING_ROOT/tempest &&\
251- sudo pip install -r requirements.txt &&\
252- ./run_tempest.sh -N --smoke) 2>&1 |\
253- tee $WORKSPACE/tempest.$BUILD_NUMBER
254-
255- if [[ -n "$(grep 'failures=' $WORKSPACE/tempest.$BUILD_NUMBER)" ]]; then
256- echo "One or more tempest smoke tests failed."
257- touch $WORKSPACE/fyi.tempest.bad
258- elif [[ -z "$(grep 'failures=' $WORKSPACE/tempest.$BUILD_NUMBER)" ]] &&\
259- [[ -n "$(grep 'tempest.scenario.test' $WORKSPACE/tempest.$BUILD_NUMBER)" ]] ; then
260- echo "All tempest smoke tests passed!"
261- touch $WORKSPACE/fyi.tempest.ok
262- else
263- echo "Unknown tempest condition."
264- fi
265- fi
266+ echo " . Juju deployment succeeded." && touch $WORKSPACE/fyi-${test:0:4}.deploy.ok
267+
268+ # Validate CLI authentication and basic functionality
269+ f_openstack_cli_basic_check
270+
271+ # Misc post-deploy configs and checks
272+ f_openstack_temp_config
273+
274+ # Configure via o-c-t script
275+ f_openstack_configure
276+
277+ # Create heat stack from git templates repo
278+ f_openstack_heat_stack_create
279+
280+ # Install tempest requirements
281+ f_openstack_tempest_deps
282+
283+ # Run tempest smoke tests
284+ f_openstack_run_tempest_smoke
285 else
286- echo "Juju deployment failed."
287- echo "Skipping tempest."
288+ echo " ! Juju deployment failed."
289+ echo " ! Skipping tempest."
290 touch $WORKSPACE/fyi.tempest.skipped
291 touch $WORKSPACE/fyi.deploy.failed
292 fi
293
294-# Collect juju stat and logs
295-echo "Collecting juju status and unit logs..."
296-. $JENKINS_HOME/novarc
297-${OSCI_ROOT}/job-parts/pull_juju_logs.py || true
298-${OSCI_ROOT}/job-parts/collect_charm_revno_info.sh || true
299-nova list &> $WORKSPACE/nova-list.$BUILD_NUMBER || true
300-juju stat &> $WORKSPACE/juju-stat.$BUILD_NUMBER || true
301-
302-# Build description, combine b_d with fyi. list and echo for regex
303-${OSCI_ROOT}/job-parts/b_d.sh || true
304-
305-# Tear down
306-${OSCI_ROOT}/job-parts/juju_cleanup.sh || true
307-
308-# end
309-if [[ "$(ls $WORKSPACE -1)" == *.failed* ]]; then
310- echo "Exiting 1."
311- exit 1
312-fi
313+f_collect_juju_logs
314+f_set_build_descr
315+#f_post_mp_comment
316+f_nice_finish
317+f_openstack_check_fail
318
319=== modified file 'job-parts/lint_check.sh'
320--- job-parts/lint_check.sh 2014-10-31 02:35:31 +0000
321+++ job-parts/lint_check.sh 2014-12-10 16:14:04 +0000
322@@ -4,7 +4,7 @@
323
324 # Makefile command search strings, first match wins
325 sstring[0]="@flake8"
326-#sstring[1]=""
327+sstring[1]="/flake8"
328 #sstring[2]=""
329 #sstring[3]=""
330 #sstring[4]=""
331
332=== modified file 'job-parts/osci_job_common.sh'
333--- job-parts/osci_job_common.sh 2014-10-31 02:35:31 +0000
334+++ job-parts/osci_job_common.sh 2014-12-10 16:14:04 +0000
335@@ -8,7 +8,22 @@
336
337 function f_fresh_clean_start() {
338 # Generally run at the start of every build
339+# when no artifacts are copied into the workspace.
340+ f_workspace_cleanup
341+ f_refreshtools_jujuclean
342+}
343+
344+
345+function f_workspace_cleanup() {
346+# Purge all files from current workspace
347 ${OSCI_ROOT}/job-parts/workspace_cleanup.sh
348+}
349+
350+
351+function f_refreshtools_jujuclean() {
352+# Generally run at the start of every build
353+# when artificats are copied into the workspace from
354+# another project.
355 ${OSCI_ROOT}/job-parts/system_tools_refresh.sh
356 ${OSCI_ROOT}/job-parts/juju_cleanup.sh
357 }
358@@ -16,7 +31,7 @@
359
360 function f_touch_try() {
361 # Create touchfile, indicating 'tried to run this test'
362- touch $WORKSPACE/try-${test}
363+ touch $WORKSPACE/try-${test:0:4}
364 }
365
366
367@@ -28,7 +43,9 @@
368
369 function f_nice_finish() {
370 # Generally run at the end of every build
371- ${OSCI_ROOT}/job-parts/juju_cleanup.sh
372+ if [[ "$NO_POST_DESTROY" != "true" ]]; then
373+ ${OSCI_ROOT}/job-parts/juju_cleanup.sh
374+ fi
375 }
376
377
378@@ -44,6 +61,19 @@
379 }
380
381
382+function f_openstack_check_fail() {
383+# Check for failure touchfiles and fail if found
384+# Exclude '.bad' statuses such as tempest fail
385+# ie. pass the deploy even as tempest fails
386+ lso="$(ls $WORKSPACE -1)"
387+ if [[ "$lso" == *.failed* ]] || \
388+ [[ "$lso" == *.missing* ]]; then
389+ echo "Exiting 1"
390+ exit 1
391+ fi
392+}
393+
394+
395 function f_post_mp_comment() {
396 # Post mp comment if triggered by a merge proposal
397 if [[ -n "$MP_TRIGGER" ]]; then
398@@ -71,7 +101,7 @@
399 # check out branch
400 if [[ -z "$BASE_NAME" ]] || [[ -z "$BRANCH" ]]; then
401 echo " ! No BRANCH and/or BASE_NAME env vars."
402- touch $WORKSPACE/fyi-${test}.env-vars.bad
403+ touch $WORKSPACE/fyi-${test:0:4}.env-vars.bad
404 else
405 mkdir -pv $JENKINS_HOME/checkout
406 CO_DIR=$JENKINS_HOME/checkout/$BASE_NAME
407@@ -93,6 +123,7 @@
408 function f_run_makefile_test() {
409 # Run makefile-based test (generally lint, unit or amulet)
410 cd $CO_DIR
411+ # sstring array set by job
412 q_sstring_l=( "${sstring[@]/#/\"}" )
413 q_sstring=( "${q_sstring_l[@]/%/\"}" )
414 echo " . Running test from Makefile."
415@@ -118,3 +149,157 @@
416 ;;
417 esac
418 }
419+
420+
421+function f_collect_juju_logs() {
422+# Collect juju stat and logs
423+ echo "Collecting juju status and unit logs..."
424+ . $JENKINS_HOME/novarc
425+ ${OSCI_ROOT}/job-parts/pull_juju_logs.py || true
426+ ${OSCI_ROOT}/job-parts/collect_charm_revno_info.sh || true
427+ nova list &> $WORKSPACE/nova-list.$BUILD_NUMBER || true
428+ juju stat &> $WORKSPACE/juju-stat.$BUILD_NUMBER || true
429+}
430+
431+
432+function f_openstack_mergeprop_bundle_handler() {
433+# Handle merge-proposal trigger and substitute the proposed branch in the bundle file
434+ if [[ -n "$MP_TRIGGER" ]] && [[ -n "$MP_SRC_BR" ]] && [[ -n "$MP_TGT_BR" ]] && [[ -n "$DISPLAY_NAME" ]]; then
435+ echo "Triggered by merge proposal: ${MP_TRIGGER}"
436+ echo "Substituting proposed branch in deployer bundle..."
437+ echo '' > $WORKSPACE/custom-other.yaml || true
438+ $OSCI_ROOT/job-parts/find_replace.py -yd -i "$OPENSTACK_CHARM_TESTING_ROOT/$CHARM_SET" -o "$WORKSPACE/custom-other.yaml" -f "$MP_TGT_BR" -r "$MP_SRC_BR" || touch $WORKSPACE/fyi-${test:0:4}.mp-branch-replace.failed
439+ export CHARM_SET="custom-other.yaml"
440+ fi
441+}
442+
443+
444+function f_openstack_custom_bundle_handler() {
445+# Handle custom deployer bundle file if present
446+ if [[ "$CHARM_SET" == "custom-other.yaml" ]] && [[ -f custom-other.yaml ]]; then
447+ echo "Using custom-other deployer bundle yaml file..."
448+ BUNDLE_FILE=$WORKSPACE/$CHARM_SET
449+ touch $WORKSPACE/fyi-${test:0:4}.custom.bundle
450+ else
451+ BUNDLE_FILE=$OPENSTACK_CHARM_TESTING_ROOT/$CHARM_SET
452+ cp $OPENSTACK_CHARM_TESTING_ROOT/$CHARM_SET $WORKSPACE/$CHARM_SET.$BUILD_NUMBER
453+ fi
454+}
455+
456+
457+function f_openstack_deploy() {
458+# Deploy the stack
459+ echo "Deploying OpenStack..."
460+ INST_SOURCE=""
461+ [[ "$INSTALLATION_SOURCE" != "default" ]] && INST_SOURCE="-${INSTALLATION_SOURCE}"
462+ set -x
463+ (cd $OPENSTACK_CHARM_TESTING_ROOT &&\
464+ juju-deployer --bootstrap -c ${BUNDLE_FILE} -d ${UBUNTU_RELEASE}-${OPENSTACK_RELEASE}${INST_SOURCE}) \
465+ 2>&1 | tee $WORKSPACE/deployer.$BUILD_NUMBER
466+ set +x
467+ sleep 30
468+}
469+
470+
471+function f_openstack_temp_config() {
472+# Configure the deployed tempstack
473+ echo "Calling tempstack configure to tweak network, add test keys..."
474+ ${OSCI_ROOT}/job-parts/tempstack_configure.sh 2>&1 | tee $WORKSPACE/tempstack-configure.$BUILD_NUMBER || true
475+
476+ if [[ -n "$(grep "END RSA PRIVATE KEY" $WORKSPACE/testkey.pem.$BUILD_NUMBER || true)" ]]; then
477+ echo " . Tempstack configure ok."
478+ touch $WORKSPACE/fyi-${test:0:4}.tempstack-configure.ok
479+ else
480+ echo " ! Tempstack configure failed."
481+ touch $WORKSPACE/fyi-${test:0:4}.tempstack-configure.bad
482+ fi
483+}
484+
485+
486+function f_openstack_configure() {
487+# Run the openstack-charm-testing ./configure script
488+ echo "Configuring..."
489+ cd $OPENSTACK_CHARM_TESTING_ROOT
490+ ./configure 2>&1 | tee $WORKSPACE/configure.$BUILD_NUMBER || true
491+ cp $OPENSTACK_CHARM_TESTING_ROOT/tempest.conf $WORKSPACE/tempest.conf.$BUILD_NUMBER || true
492+
493+ if [[ -f $WORKSPACE/tempest.conf.$BUILD_NUMBER ]]; then
494+ echo " . Configure succeeded."
495+ touch $WORKSPACE/fyi-${test:0:4}.configure.ok
496+ else
497+ echo " ! Configure failed."
498+ touch $WORKSPACE/fyi-${test:0:4}.configure.bad
499+ fi
500+}
501+
502+
503+function f_openstack_heat_stack_create() {
504+# add a basic heat HOT template stack for tempest orchestration tests
505+# experimental, force pass for now
506+ heat stack-create heat_basic -f $OPENSTACK_CHARM_TESTING_ROOT/heat-templates/heat-basic.yaml \
507+ --parameters "admin_pass=Ubuntu;key_name=testkey;image=cirros;network=private" || true
508+ heat stack-list || true
509+}
510+
511+
512+function f_openstack_tempest_deps() {
513+# Install tempest requirements
514+ echo "Installing tempest requirements..."
515+ (cd $OPENSTACK_CHARM_TESTING_ROOT/tempest &&\
516+ sudo pip install -r requirements.txt) 2>&1 |\
517+ tee $WORKSPACE/tempest-deps.$BUILD_NUMBER
518+}
519+
520+
521+function f_openstack_run_tempest_smoke() {
522+# Run tempest if nothing has failed so far
523+ if [[ -n "$(ls $WORKSPACE -1 | egrep '.failed|.bad')" ]]; then
524+ echo " ! Skipping tempest, one or more preceding steps are failed or bad."
525+ touch $WORKSPACE/fyi-${test:0:4}.tempest.skipped
526+ else
527+ # Kick off tempest
528+ (cd $OPENSTACK_CHARM_TESTING_ROOT/tempest && ./run_tempest.sh -N --smoke) 2>&1 |\
529+ tee $WORKSPACE/tempest.$BUILD_NUMBER
530+ if [[ -n "$(grep 'failures=' $WORKSPACE/tempest.$BUILD_NUMBER)" ]]; then
531+ echo " ! One or more tempest smoke tests failed."
532+ touch $WORKSPACE/fyi-${test:0:4}.tempest.bad
533+ elif [[ -z "$(grep 'failures=' $WORKSPACE/tempest.$BUILD_NUMBER)" ]] &&\
534+ [[ -n "$(grep 'tempest.scenario.test' $WORKSPACE/tempest.$BUILD_NUMBER)" ]] ; then
535+ echo " . All tempest smoke tests passed!"
536+ touch $WORKSPACE/fyi-${test:0:4}.tempest.ok
537+ else
538+ echo " ! Unknown tempest result condition."
539+ fi
540+ fi
541+}
542+
543+
544+function f_openstack_cli_basic_check() {
545+# Perform basic command line checks against the cloud
546+ echo "Confirming basic CLI functionality and authentication..."
547+ . $OPENSTACK_CHARM_TESTING_ROOT/novarc
548+ tmp_cmds="$(mktemp)"
549+ cat > "$tmp_cmds" << "--EOF"
550+ neutron net-list
551+ neutron subnet-list
552+ nova network-list
553+ nova keypair-list
554+ nova secgroup-list
555+ glance image-list
556+ nova image-list
557+ cinder list
558+ swift list
559+ keystone user-list
560+ keystone tenant-list
561+ keystone endpoint-list
562+ keystone service-list
563+ heat stack-list
564+ ceilometer resource-list
565+--EOF
566+ while read cmd; do
567+ echo -n "${cmd}: "
568+ $cmd &> /dev/null && echo 'ok' ${PIPESTATUS[0]} || { echo 'cli-fail' ${PIPESTATUS[0]}; touch $WORKSPACE/fyi-${test:0:4}.cli.failed; }
569+ done < $tmp_cmds
570+ rm -fv $tmp_cmds
571+}
572+
573
574=== modified file 'job-parts/workspace_cleanup.sh'
575--- job-parts/workspace_cleanup.sh 2014-11-26 15:07:38 +0000
576+++ job-parts/workspace_cleanup.sh 2014-12-10 16:14:04 +0000
577@@ -16,4 +16,3 @@
578 sudo cp -fv $OSCI_ROOT/deployment/deploy-files/launchpad_host_keys /var/lib/jenkins/.ssh/known_hosts
579 sudo chmod 600 /var/lib/jenkins/.ssh/known_hosts
580 sudo chown jenkins:jenkins /var/lib/jenkins/.ssh/known_hosts
581-
582
583=== modified file 'make_exec.py'
584--- make_exec.py 2014-10-31 15:52:31 +0000
585+++ make_exec.py 2014-12-10 16:14:04 +0000
586@@ -62,7 +62,7 @@
587 if len(_line) != 0 and _line[0] != '#':
588 if _this_line[0] != '\t' and ':' in _line:
589 # Makefile target name found
590- _target = _line[:-1]
591+ _target = _line.split(':')[0]
592 _cmds = []
593 found_target = True
594 elif _this_line[0] == '\t':
595
596=== modified file 'mp_comment.py'
597--- mp_comment.py 2014-10-31 17:27:35 +0000
598+++ mp_comment.py 2014-12-10 16:14:04 +0000
599@@ -140,6 +140,7 @@
600 results = []
601 pbs = {}
602 something_ran = False
603+ trigger_tests = []
604 for trigger_test, tt_attrs in conf_map['mp-trigger-tests'].iteritems():
605 # look for try touchfiles
606 try_files = []
607@@ -149,14 +150,41 @@
608 try_files.extend(these_try_files)
609 if len(try_files) > 0:
610 something_ran = True
611+ trigger_tests.append(trigger_test)
612 logging.info('Found {} try file(s)'.format(trigger_test))
613 else:
614 # did not run
615 logging.info('No {} try file(s) found'.format(trigger_test))
616 continue
617
618+ # look for fail touchfiles
619+ logging.debug('Checking for {} fyi files'.format(trigger_test))
620+ passed = True
621+ for fail_mask in tt_attrs['fail-mask']:
622+ logging.debug('Checking fail mask: {}'.format(fail_mask))
623+ fyis = glob(os.path.join(WORKSPACE, fail_mask))
624+ if len(fyis) > 0:
625+ passed = False
626+ logging.debug('Found {} fyi file(s)'.format(trigger_test))
627+ # handle fyi files
628+ for fyi in fyis:
629+ _line = ' {} FAIL: {}'.format(
630+ trigger_test.upper(),
631+ os.path.split(fyi)[1][8:].replace('.', ' '))
632+ logging.debug(_line)
633+ summary.append(_line)
634+ else:
635+ logging.debug('No "fyi" files found to '
636+ 'include for mask: {}'.format(fail_mask))
637+
638+ # ran and didn't fail
639+ if passed:
640+ _line = (' {} OK: passed'.format(trigger_test.upper()))
641+ summary.append(_line)
642+
643 # look for result files
644 res_files = []
645+ this_result = []
646 logging.debug('Checking result mask for {}'.format(trigger_test))
647 for res_mask in tt_attrs['result-mask']:
648 these_res_files = glob(os.path.join(WORKSPACE, res_mask))
649@@ -171,43 +199,23 @@
650 llimit = conf_map['mp-conf']['line-limit']
651 _line = ('\n{} Results (max last {} lines):'.format(
652 trigger_test.upper(), llimit))
653- results.append(_line)
654+ this_result.append(_line)
655 with open(res_file) as _file:
656 res_lines = [f_line.decode('ascii', 'ignore').rstrip()
657 for f_line in _file][-llimit:]
658 _line = ('\nFull {} test output: {}'.format(trigger_test,
659 pbs[res_file]))
660 res_lines.append(_line)
661- results.extend(res_lines)
662+ this_result.extend(res_lines)
663 else:
664 _line = ('\n{} Results not found.'.format(trigger_test.upper()))
665 results.append(_line)
666 logging.info('No {} results files found to '
667 'include'.format(trigger_test))
668
669- # look for fail touchfiles
670- logging.debug('Checking for {} fyi files'.format(trigger_test))
671- passed = True
672- for fail_mask in tt_attrs['fail-mask']:
673- logging.debug('Checking fail mask: {}'.format(fail_mask))
674- fyis = glob(os.path.join(WORKSPACE, fail_mask))
675- if len(fyis) > 0:
676- passed = False
677- logging.debug('Found {} fyi file(s)'.format(trigger_test))
678- # handle fyi files
679- for fyi in fyis:
680- _line = ' {} FAIL: {}'.format(
681- trigger_test.upper(),
682- os.path.split(fyi)[1][8:].replace('.', ' '))
683- logging.debug(_line)
684- summary.append(_line)
685- else:
686- logging.debug('No "fyi" files found to '
687- 'include for mask: {}'.format(fail_mask))
688- # ran and didn't fail
689- if passed:
690- _line = (' {} OK: passed'.format(trigger_test.upper()))
691- summary.append(_line)
692+ if not passed:
693+ results.extend(this_result)
694+
695 logging.debug('pbs: {}'.format(pbs))
696
697 if not something_ran:
698@@ -216,6 +224,7 @@
699
700 # add summary and results to context for template
701 contexts[0]['summary'] = '\n'.join(summary)
702+# if not passed:
703 contexts[0]['results'] = '\n'.join(results)
704
705 # create mp comment file
706@@ -227,7 +236,8 @@
707 params=params)
708
709 # read mp comment file and display to console
710- subject = '[UOSCI] test result for {}'.format(DISPLAY_NAME)
711+ subject = '[UOSCI] {} test result for {}'.format('/'.join(trigger_tests),
712+ DISPLAY_NAME)
713 logging.debug('Subject: {}'.format(subject))
714 f = open(comment_filename, 'r')
715 comment = f.read()
716@@ -249,10 +259,6 @@
717 lp_branch_url = MP_TGT_BR
718 mp_url = MP_TRIGGER
719
720- # post mp comment
721- logging.debug('Connecting to LP via API')
722- launchpad = osci_utils.lpl_connect(anonymous=False)
723-
724 if MPC_SILENT:
725 # useful for setting environment variable in a jenkins staging
726 # area to prevent mp comment posting globally
727@@ -260,6 +266,9 @@
728 'will actually be posted')
729
730 if not opts.dry and not opts.no_post and not MPC_SILENT:
731+ # post mp comment
732+ logging.debug('Connecting to LP via API')
733+ launchpad = osci_utils.lpl_connect(anonymous=False)
734 logging.debug('Looking up MP object from LP API')
735 try:
736 mp = osci_utils.lpl_get_mp(launchpad, mp_url, lp_branch_url)
737
738=== modified file 'populate/mappings.yaml'
739--- populate/mappings.yaml 2014-11-22 16:16:10 +0000
740+++ populate/mappings.yaml 2014-12-10 16:14:04 +0000
741@@ -14,7 +14,7 @@
742 mp-state-file: 'mp-state'
743
744 mp-conf:
745- line-limit: 5
746+ line-limit: 2
747 # when True, post ALL MP comments to this alternate MP when mp-comment-sandbox
748 # ie. contain the noise during osci development
749 mp-comment-sandbox: False
750
751=== modified file 'populate/mp-comment.tmpl'
752--- populate/mp-comment.tmpl 2014-10-20 21:05:18 +0000
753+++ populate/mp-comment.tmpl 2014-12-10 16:14:04 +0000
754@@ -1,4 +1,3 @@
755-UOSCI bot says:
756 {{JOB_NAME}} {{BUILD_DISPLAY_NAME}}
757 {{summary}}
758 {{results}}

Subscribers

People subscribed via source and target branches