~allanlesage/+junk/qa-jenkins-jobs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# vim: sw=4 ts=4 et

# QA Jenkins Jobs
# Copyright 2016 Canonical Ltd.

# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.

# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE.  See the GNU General Public License for more details.

# You should have received a copy of the GNU General Public License along
# with this program.  If not, see <http://www.gnu.org/licenses/>.

- project:
    name: ubuntu-system-tests
    test_level:
        - sanity
        - regression
    channel:
        - 'rc'
        - 'rc-proposed'
        - 'devel-proposed'
    device:
        - krillin:
            device_channel: 'bq-aquaris.en'
        - arale:
            device_channel: 'meizu.en'
    release:
        - vivid
    jobs:
        - 'ubuntu-system-tests_{release}_{channel}_{device}_{test_level}_triggered'
        - 'ubuntu-system-tests_{release}_{channel}_{device}_{test_level}_freestyle'

- job-template:
    name: 'ubuntu-system-tests_{release}_{channel}_{device}_{test_level}_triggered'
    description: "Triggered upon image update."
    parameters:
        - ubuntu-system-tests-parameters:
            test_level: '{test_level}'
            channel: '{channel}'
            device_channel: '{device_channel}'
    node: '{device}'
    triggers:
        - ubuntu-system-tests-triggers:
            channel: '{channel}'
            device: '{device}'
            device_channel: '{device_channel}'
    builders:
        - ubuntu-system-tests-builder
    publishers:
        - archive:
            artifacts: 'results/**/*'
            allow-empty: 'true'
        - junit:
            results: 'results/artifacts/test-results.xml'

- job-template:
    name: 'ubuntu-system-tests_{release}_{channel}_{device}_{test_level}_freestyle'
    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."
    parameters:
        - ubuntu-system-tests-parameters:
            test_level: '{test_level}'
            channel: '{channel}'
            device_channel: '{device_channel}'
    node: '{device}'
    builders:
        - ubuntu-system-tests-builder
    publishers:
        - archive:
            artifacts: 'results/**/*'
            allow-empty: 'true'
        - junit:
            results: 'results/artifacts/test-results.xml'

- parameter:
    name: ubuntu-system-tests-parameters
    parameters:
        - string:
            name: UBUNTU_SYSTEM_TESTS_BRANCH
            default: lp:ubuntu-system-tests
            description: "Launchpad branch of ubuntu-system-tests from which to run tests."
        - string:
            name: TESTS_TO_RUN
            default: '{test_level}'
            description: "List of tests to run, use 'sanity' or 'regression' to run those suites."
        - string:
            name: LIFEBOAT_BRANCH
            default: https://git.launchpad.net/~canonical-hw-cert/lifeboat
            description: "Launchpad branch (may be git) of the lifeboat device descriptions."
        # Begin flash-device params, TODO: !include these as YAML instead
        - string:
            name: CHANNEL
            default: 'ubuntu-touch/{channel}/{device_channel}'
            description: "The given alternate channel will be used if specified."
        - string:
            name: REVISION
            default:
            description:
        - string:
            name: WIZARD
            default: "yes"
            description: "Run the device setup wizard?  'no' disables."
        - string:
            name: EDGEINTRO
            default: "yes"
            description: "Run the device edges intro?  'no' disables."
        - string:
            name: QA_JENKINS_JOBS_BRANCH
            default: lp:qa-jenkins-jobs
            description: Launchpad branch of qa-jenkins-jobs scripts.

- trigger:
    name: ubuntu-system-tests-triggers
    triggers:
        - pollurl:
            cron: 'H/15 * * * *'
            polling-node: 'jenkins-slave-2'
            urls:
                - url: 'http://system-image.ubuntu.com/ubuntu-touch/{channel}/{device_channel}/{device}/index.json.asc'
                  check-content:
                    - simple: true

- builder:
    name: ubuntu-system-tests-builder
    builders:
        - shell: |

            # use plars' lifeboat scripts to get our adb serial
            rm -rf lifeboat
            git clone $LIFEBOAT_BRANCH lifeboat
            export ANDROID_SERIAL=$(./lifeboat/get-device-info serial $NODE_NAME)

            rm -rf $WORKSPACE/results
            mkdir $WORKSPACE/results
            export OUTPUTDIR="$WORKSPACE/results"

            rm -rf qa-jenkins-jobs
            bzr branch $QA_JENKINS_JOBS_BRANCH qa-jenkins-jobs
            cd qa-jenkins-jobs

            export UBUNTU_SYSTEM_TESTS_CONFIG_BRANCH="lp:ubuntu-system-tests-config"
            export CONFIG_PATH=${WORKSPACE}/ubuntu-system-tests.conf
            ./scripts/ubuntu-system-tests/write-config.sh
            cat >> $CONFIG_PATH <<EOF
            device_serial = $ANDROID_SERIAL
            output_dir = $OUTPUTDIR
            EOF
            cat $CONFIG_PATH

            case "$TESTS_TO_RUN" in
              "regression")
                TESTS_TO_RUN=""
                ;;
              "sanity")
                TESTS_TO_RUN=$(bzr cat "$UBUNTU_SYSTEM_TESTS_BRANCH/test_lists/sanity.tests")
                ;;
              "")
                echo "Please specify tests to run!" >&2
                exit 1
                ;;
            esac

            ./scripts/get-recovery-image.sh

            recover_device_flash_and_run_tests () {
              # NOTE pass in a list of tests to run
              ./scripts/recover-device.sh
              ./scripts/flash-device.sh
              ./scripts/ubuntu-system-tests/run-ubuntu-system-tests.sh "$1"
            }
            recover_device_flash_and_run_tests "$(echo "$TESTS_TO_RUN")"