Merge lp:~canonical-platform-qa/qa-jenkins-jobs/ust-style-improvements into lp:qa-jenkins-jobs

Proposed by Allan LeSage
Status: Merged
Approved by: Max Brustkern
Approved revision: 59
Merged at revision: 57
Proposed branch: lp:~canonical-platform-qa/qa-jenkins-jobs/ust-style-improvements
Merge into: lp:qa-jenkins-jobs
Diff against target: 217 lines (+81/-94)
3 files modified
ubuntu-system-tests/flash-device-builder.sh (+11/-0)
ubuntu-system-tests/jobs.yaml (+20/-94)
ubuntu-system-tests/ubuntu-system-tests-builder.sh (+50/-0)
To merge this branch: bzr merge lp:~canonical-platform-qa/qa-jenkins-jobs/ust-style-improvements
Reviewer Review Type Date Requested Status
Max Brustkern (community) Approve
Christopher Lee (community) Approve
Review via email: mp+293181@code.launchpad.net

Commit message

Style improvements for ubuntu-system-tests.

Description of the change

Improve names, use anchor-based inheritance, include scripty builders instead of listing in-job.

To post a comment you must log in.
Revision history for this message
Christopher Lee (veebers) wrote :

LGTM I loaded it into my test jenkins instance and all seemed fine.
I like the use of the templating for the jobs.

review: Approve
Revision history for this message
Max Brustkern (nuclearbob) wrote :

Let's make sure the _PT jobs are removed if we're deprecating those in favor of _test.

I see on ust_{channel}_{device}_{test_level}, we now provide device, but not node. Do we no longer need to link jobs to nodes?

Also, it looks like you define &DEFAULT_UST_PUBLISHERS but don't use it yet. That makes sense to me, since it seems likely we may want to add arbitrary new publishers to jobs in the future, I just want to make sure there's not a use of that somewhere that I'm missing.

59. By Allan LeSage

Remove default publishers.

Revision history for this message
Allan LeSage (allanlesage) wrote :

The device property is set in the "anchor" slash parent template, although this is not easy to see in the diff.

Removed &DEFAULT_UST_PUBLISHERS b/c I was getting ahead of myself.

One more round Max!

Revision history for this message
Max Brustkern (nuclearbob) wrote :

I see it now! Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'ubuntu-system-tests/flash-device-builder.sh'
2--- ubuntu-system-tests/flash-device-builder.sh 1970-01-01 00:00:00 +0000
3+++ ubuntu-system-tests/flash-device-builder.sh 2016-04-28 20:18:56 +0000
4@@ -0,0 +1,11 @@
5+# use plars' lifeboat scripts to get our adb serial
6+rm -rf lifeboat
7+git clone $LIFEBOAT_BRANCH lifeboat
8+export ANDROID_SERIAL=$(./lifeboat/get-device-info serial $NODE_NAME)
9+
10+rm -rf qa-jenkins-jobs
11+bzr branch $QA_JENKINS_JOBS_BRANCH qa-jenkins-jobs
12+
13+./qa-jenkins-jobs/scripts/get-recovery-image.sh
14+./qa-jenkins-jobs/scripts/recover-device.sh
15+./qa-jenkins-jobs/scripts/flash-device.sh
16
17=== modified file 'ubuntu-system-tests/jobs.yaml'
18--- ubuntu-system-tests/jobs.yaml 2016-04-26 15:38:52 +0000
19+++ ubuntu-system-tests/jobs.yaml 2016-04-28 20:18:56 +0000
20@@ -31,8 +31,8 @@
21 device_channel: 'meizu.en'
22 jobs:
23 - 'flash-device'
24- - 'ust_{channel}_{device}_{test_level}_PT'
25 - 'ust_{channel}_{device}_{test_level}'
26+ - 'ust_{channel}_{device}_{test_level}_test'
27
28 - job-template:
29 name: 'flash-device'
30@@ -64,22 +64,11 @@
31 - builder:
32 name: flash-device-builder
33 builders:
34- - shell: |
35- # use plars' lifeboat scripts to get our adb serial
36- rm -rf lifeboat
37- git clone $LIFEBOAT_BRANCH lifeboat
38- export ANDROID_SERIAL=$(./lifeboat/get-device-info serial $NODE_NAME)
39-
40- rm -rf qa-jenkins-jobs
41- bzr branch $QA_JENKINS_JOBS_BRANCH qa-jenkins-jobs
42-
43- ./qa-jenkins-jobs/scripts/get-recovery-image.sh
44- ./qa-jenkins-jobs/scripts/recover-device.sh
45- ./qa-jenkins-jobs/scripts/flash-device.sh
46-
47-- job-template:
48- name: 'ust_{channel}_{device}_{test_level}_PT'
49- description: "Triggered upon image update."
50+ - shell:
51+ !include-raw: 'flash-device-builder.sh'
52+
53+- job-template: &UST_DEFAULT_JOB_TEMPLATE
54+ name: 'ust_default_job_template'
55 parameters:
56 - ubuntu-system-tests-parameters:
57 test_level: '{test_level}'
58@@ -103,24 +92,21 @@
59 results: 'results/artifacts/test-results.xml'
60
61 - job-template:
62+ <<: *UST_DEFAULT_JOB_TEMPLATE
63+ name: 'ust_{channel}_{device}_{test_level}_test'
64+ description: |
65+ Provided for experimentation--e.g. re-running of failed tests.
66+
67+- job-template:
68+ <<: *UST_DEFAULT_JOB_TEMPLATE
69 name: 'ust_{channel}_{device}_{test_level}'
70- description: "Provided for experimentation--e.g. re-running of failed tests--in way that won't contribute to the pass/fail record of the canonical job."
71- parameters:
72- - ubuntu-system-tests-parameters:
73- test_level: '{test_level}'
74+ description: |
75+ Triggered by image publication, reports results to PractiTest.
76+ triggers:
77+ - ubuntu-system-tests-triggers:
78 channel: '{channel}'
79+ device: '{device}'
80 device_channel: '{device_channel}'
81- node: '{device}'
82- builders:
83- - clear-artifacts
84- - flash-device-builder
85- - ubuntu-system-tests-builder
86- publishers:
87- - archive:
88- artifacts: 'results/**/*'
89- allow-empty: 'true'
90- - junit:
91- results: 'results/artifacts/test-results.xml'
92
93 - parameter:
94 name: ubuntu-system-tests-parameters
95@@ -173,65 +159,5 @@
96 - builder:
97 name: ubuntu-system-tests-builder
98 builders:
99- - shell: |
100- # use plars' lifeboat scripts to get our adb serial
101- rm -rf lifeboat
102- # we occasionally see 500s from Launchpad git service
103- GIT_RETRY=0
104- until git clone $LIFEBOAT_BRANCH lifeboat || [ $GIT_RETRY -gt 10 ]; do
105- sleep 1
106- GIT_RETRY=$(($GIT_RETRY+1))
107- echo "git clone lifeboat attempt failed, trying again . . .'
108- done
109- if [ $GIT_RETRY -gt 10 ]; then
110- echo "error: git clone lifeboat failed!"
111- exit 1
112- fi
113-
114- export ANDROID_SERIAL=$(./lifeboat/get-device-info serial $NODE_NAME)
115-
116- rm -rf $WORKSPACE/results
117- mkdir $WORKSPACE/results
118- export OUTPUTDIR="$WORKSPACE/results"
119-
120- rm -rf qa-jenkins-jobs
121- bzr branch $QA_JENKINS_JOBS_BRANCH qa-jenkins-jobs
122-
123- export UBUNTU_SYSTEM_TESTS_CONFIG_BRANCH="lp:ubuntu-system-tests-config"
124- export CONFIG_PATH=${WORKSPACE}/ubuntu-system-tests.conf
125- ./qa-jenkins-jobs/scripts/ubuntu-system-tests/write-config.sh
126- cat >> $CONFIG_PATH <<EOF
127- device_serial = $ANDROID_SERIAL
128- output_dir = $OUTPUTDIR
129- EOF
130- cat $CONFIG_PATH
131-
132- case "$TESTS_TO_RUN" in
133- "regression")
134- TESTS_TO_RUN=""
135- ;;
136- "sanity")
137- TESTS_TO_RUN=$(bzr cat "$UBUNTU_SYSTEM_TESTS_BRANCH/test_lists/sanity.tests" | tr '\n' ' ')
138- ;;
139- "")
140- echo "Please specify tests to run!" >&2
141- exit 1
142- ;;
143- esac
144-
145- recover_device_flash_and_run_tests () {
146- ./qa-jenkins-jobs/scripts/ubuntu-system-tests/run-ubuntu-system-tests.sh "$1"
147- }
148- recover_device_flash_and_run_tests "$(echo "$TESTS_TO_RUN")"
149-
150- # default to sanity for testing, TODO: consider exiting if not sanity or regression
151- case "${TESTS_TO_RUN}" in
152- "regression")
153- export TEST_LEVEL=regression
154- ;;
155- *)
156- export TEST_LEVEL=sanity
157- ;;
158- esac
159- # "1SS" is the name of the lab
160- ./qa-jenkins-jobs/scripts/ubuntu-system-tests/report-results-to-practitest.sh $WORKSPACE/results/artifacts/test-results.subunit $TEST_LEVEL 1SS
161+ - shell:
162+ !include-raw: 'ubuntu-system-tests-builder.sh'
163
164=== added file 'ubuntu-system-tests/ubuntu-system-tests-builder.sh'
165--- ubuntu-system-tests/ubuntu-system-tests-builder.sh 1970-01-01 00:00:00 +0000
166+++ ubuntu-system-tests/ubuntu-system-tests-builder.sh 2016-04-28 20:18:56 +0000
167@@ -0,0 +1,50 @@
168+# use plars' lifeboat scripts to get our adb serial
169+rm -rf lifeboat
170+git clone $LIFEBOAT_BRANCH lifeboat
171+export ANDROID_SERIAL=$(./lifeboat/get-device-info serial $NODE_NAME)
172+
173+rm -rf $WORKSPACE/results
174+mkdir $WORKSPACE/results
175+export OUTPUTDIR="$WORKSPACE/results"
176+
177+rm -rf qa-jenkins-jobs
178+bzr branch $QA_JENKINS_JOBS_BRANCH qa-jenkins-jobs
179+
180+export UBUNTU_SYSTEM_TESTS_CONFIG_BRANCH="lp:ubuntu-system-tests-config"
181+export CONFIG_PATH=${WORKSPACE}/ubuntu-system-tests.conf
182+./qa-jenkins-jobs/scripts/ubuntu-system-tests/write-config.sh
183+cat >> $CONFIG_PATH <<EOF
184+device_serial = $ANDROID_SERIAL
185+output_dir = $OUTPUTDIR
186+EOF
187+cat $CONFIG_PATH
188+
189+case "$TESTS_TO_RUN" in
190+ "regression")
191+ TESTS_TO_RUN=""
192+ ;;
193+ "sanity")
194+ TESTS_TO_RUN=$(bzr cat "$UBUNTU_SYSTEM_TESTS_BRANCH/test_lists/sanity.tests" | tr '\n' ' ')
195+ ;;
196+ "")
197+ echo "Please specify tests to run!" >&2
198+ exit 1
199+ ;;
200+esac
201+
202+recover_device_flash_and_run_tests () {
203+ ./qa-jenkins-jobs/scripts/ubuntu-system-tests/run-ubuntu-system-tests.sh "$1"
204+}
205+recover_device_flash_and_run_tests "$(echo "$TESTS_TO_RUN")"
206+
207+# default to sanity for testing, TODO: consider exiting if not sanity or regression
208+case "${TESTS_TO_RUN}" in
209+ "regression")
210+ export TEST_LEVEL=regression
211+ ;;
212+ *)
213+ export TEST_LEVEL=sanity
214+ ;;
215+esac
216+# "1SS" is the name of the lab
217+./qa-jenkins-jobs/scripts/ubuntu-system-tests/report-results-to-practitest.sh $WORKSPACE/results/artifacts/test-results.subunit $TEST_LEVEL 1SS

Subscribers

People subscribed via source and target branches