Merge lp:~canonical-platform-qa/qa-jenkins-jobs/auto_ci-land_upgrade_testing into lp:qa-jenkins-jobs

Proposed by Christopher Lee
Status: Superseded
Proposed branch: lp:~canonical-platform-qa/qa-jenkins-jobs/auto_ci-land_upgrade_testing
Merge into: lp:qa-jenkins-jobs
Diff against target: 474 lines (+469/-0)
1 file modified
mp-ci-autoland/ci-jobs.yaml (+469/-0)
To merge this branch: bzr merge lp:~canonical-platform-qa/qa-jenkins-jobs/auto_ci-land_upgrade_testing
Reviewer Review Type Date Requested Status
Canonical Platform QA Jenkins Pending
Review via email: mp+288055@code.launchpad.net

This proposal has been superseded by a proposal from 2016-03-06.

Commit message

Template autolanding and ci jobs to add auto-upgrade-testing.

Description of the change

Template autolanding and ci jobs to add auto-upgrade-testing.

To post a comment you must log in.
Revision history for this message
Max Brustkern (nuclearbob) wrote :

We've talked about creating separate macros files. Would this be a good time to start that, since we're directly reusing a lot of code from other jobs? It seems like otherwise, some of these job names will overlap as well. Even if we don't go as far as making a generic macros file, maybe making a generic autolanding job set would work.

28. By Christopher Lee

Merge parent

29. By Christopher Lee

Merge parent

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'mp-ci-autoland'
2=== added file 'mp-ci-autoland/ci-jobs.yaml'
3--- mp-ci-autoland/ci-jobs.yaml 1970-01-01 00:00:00 +0000
4+++ mp-ci-autoland/ci-jobs.yaml 2016-03-04 03:55:40 +0000
5@@ -0,0 +1,469 @@
6+# vim: sw=4 ts=4 et
7+
8+# QA Jenkins Jobs
9+# Copyright 2016 Canonical Ltd.
10+
11+# This program is free software: you can redistribute it and/or modify it
12+# under the terms of the GNU General Public License version 3, as published
13+# by the Free Software Foundation.
14+
15+# This program is distributed in the hope that it will be useful, but
16+# WITHOUT ANY WARRANTY; without even the implied warranties of
17+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
18+# PURPOSE. See the GNU General Public License for more details.
19+
20+# You should have received a copy of the GNU General Public License along
21+# with this program. If not, see <http://www.gnu.org/licenses/>.
22+
23+- builder:
24+ name: create-chroot
25+ # This and the update-chroot builder share a lot of code. TODO: Dedupe/be
26+ # smarter about this.
27+ builders:
28+ - shell: |
29+ # TODO: Use the production PPA
30+ sudo add-apt-repository -y ppa:jenkaas-hackers/tools
31+ sudo apt-get update
32+ sudo apt-get install -y --assume-yes sphinx-common python3-setuptools pbuilder pbuilderjenkins bzr-builddeb devscripts dh-translations
33+
34+ # Only proceed if the config options are set for building chroots
35+ if [ -z "$distributions" ] || [ -z "$arches" ]; then
36+ echo "Missing vales for distributions and arches,"
37+ echo " skipping pbuilder chroot creation."
38+ exit 1
39+ fi
40+
41+ COMPONENTS="main restricted universe multiverse"
42+ MIRROR="http://archive.ubuntu.com/ubuntu/"
43+ EXTRA_PACKAGES="apt-transport-https ca-certificates devscripts eatmydata gnupg patchutils pbuilder vim-tiny"
44+ for dist in $distributions; do
45+ for arch in $arches; do
46+ if [ ! -f "/var/cache/pbuilder/$dist-$arch.tgz" ]; then
47+ OTHER_MIRROR="deb $MIRROR $dist-updates main restricted universe multiverse|deb-src $MIRROR $dist-updates main restricted universe multiverse|deb-src $MIRROR $dist main restricted universe multiverse"
48+ sudo /usr/sbin/pbuilder --create \
49+ --distribution "$dist" \
50+ --architecture "$arch" \
51+ --basetgz "/var/cache/pbuilder/$dist-$arch.tgz" \
52+ --debootstrapopts \
53+ --variant=buildd
54+ sudo /usr/sbin/pbuilder --update \
55+ --distribution "$dist" \
56+ --basetgz "/var/cache/pbuilder/$dist-$arch.tgz" \
57+ --components "$COMPONENTS" \
58+ --mirror "$MIRROR" \
59+ --othermirror "$OTHER_MIRROR" \
60+ --override-config \
61+ --extrapackages "$EXTRA_PACKAGES"
62+ else
63+ echo "Skipping creation of /var/cache/pbuilder/$dist-$arch.tgz, it already exists."
64+ fi
65+ done
66+ done
67+
68+
69+- builder:
70+ name: update-chroot
71+ builders:
72+ - shell: |
73+ # Only proceed if the config options are set for building chroots
74+ if [ -z "$distributions" ] || [ -z "$arches" ]; then
75+ echo "Missing values for distributions and arches,"
76+ echo " skipping pbuilder chroot creation."
77+ exit 1
78+ fi
79+
80+ COMPONENTS="main restricted universe multiverse"
81+ MIRROR="http://archive.ubuntu.com/ubuntu/"
82+
83+ for dist in "$distributions"; do
84+ for arch in "$arches"; do
85+ if [ -f "/var/cache/pbuilder/$dist-$arch.tgz" ]; then
86+ OTHER_MIRROR="deb $MIRROR $dist-updates $COMPONENTS|deb-src $MIRROR $dist-updates $COMPONENTS|deb-src $MIRROR $dist $COMPONENTS"
87+ sudo /usr/sbin/pbuilder --update \
88+ --basetgz "/var/cache/pbuilder/$dist-$arch.tgz" \
89+ --distribution "$dist" \
90+ --components "$COMPONENTS" \
91+ --mirror "$MIRROR" \
92+ --othermirror "$OTHER_MIRROR" \
93+ --override-config
94+ if [ -n "$extra_packages" ]; then
95+ sudo /usr/sbin/pbuilder --update \
96+ --basetgz "/var/cache/pbuilder/$dist-$arch.tgz" \
97+ --extrapackages "$extra_packages"
98+ fi
99+ else
100+ echo "Chroot /var/cache/pbuilder/$dist-$arch.tgz not found, skipping update."
101+ fi
102+ done
103+ done
104+
105+- builder:
106+ name: build-package
107+ builders:
108+ - shell: |
109+ # Remove any prior work dir created by a prior build
110+ rm -rf work
111+
112+ # local_archive_pocket is used by H05set_package_version and therefore necessary for most builds
113+ export local_archive_pocket={dist}
114+
115+ pbuilderjenkins -c -j "$parallelism" -m "$landing_candidate" -t "$target_branch" --hook-list "$hooks" --base "{dist}-{arch}"
116+
117+- builder: # This step removes artifacts from previous builds
118+ name: clear-artifacts
119+ builders:
120+ - shell: 'sudo rm -rf *'
121+
122+- builder:
123+ name: trigger-deb-builders
124+ builders:
125+ - trigger-builds:
126+ - project:
127+ # I should be able to parameterize this, right?
128+ - 'build-wily-amd64-package'
129+ - 'build-wily-i386-package'
130+ block: true
131+ predefined-parameters: |
132+ landing_candidate=$landing_candidate
133+ target_branch={target_branch}
134+ hooks={hooks}
135+ parallelism={parallelism}
136+
137+- builder:
138+ name: 'trigger-generic-update-mp'
139+ builders:
140+ - trigger-builds:
141+ - project:
142+ - 'generic-update-mp'
143+ block: 'true'
144+ predefined-parameters: |
145+ ci_result=PASSED
146+ ci_build=$BUILD_URL
147+ ci_branch=$landing_candidate
148+ ci_merge_proposal=$merge_proposal
149+ ci_revision=$candidate_revision
150+ block-thresholds:
151+ build-step-failure-threshold: 'never'
152+ unstable-threshold: 'never'
153+ failure-threshold: 'never'
154+
155+- publisher:
156+ name: 'trigger-generic-update-mp-failed'
157+ publishers:
158+ - trigger-parameterized-builds:
159+ - project:
160+ - 'generic-update-mp'
161+ condition: 'UNSTABLE_OR_WORSE'
162+ predefined-parameters: |
163+ ci_result=FAILED
164+ ci_build=$BUILD_URL
165+ ci_branch=$landing_candidate
166+ ci_merge_proposal=$merge_proposal
167+ ci_revision=$candidate_revision
168+
169+# Can I parameterize a builder?
170+- builder:
171+ name: 'upcopy-amd64-from-downstream'
172+ builders:
173+ - copyartifact:
174+ project: 'build-wily-amd64-package'
175+ filter: '**/*.deb'
176+ target: ./wily-amd64
177+
178+- builder:
179+ name: 'upcopy-i386-from-downstream'
180+ builders:
181+ - copyartifact:
182+ project: 'build-wily-i386-package'
183+ filter: '**/*.deb'
184+ target: ./wily-i386
185+
186+- publisher:
187+ name: 'collect-debs'
188+ publishers:
189+ - archive:
190+ artifacts: '**/*.deb'
191+ only-if-success: 'true'
192+
193+- project:
194+ name: 'ci-setup'
195+ jobs:
196+ - 'create-debian-chroot'
197+ - 'update-debian-chroot'
198+
199+- project:
200+ name: 'ci-details'
201+ jobs:
202+ - 'build-{dist}-{arch}-package'
203+ - 'trigger-{target_project}-ci'
204+ - '{target_project}-ci'
205+ - 'generic-update-mp'
206+ target_project:
207+ # Must be projects lp:<name>
208+ - 'autopilot'
209+ - 'auto-upgrade-testing'
210+ dist:
211+ - wily
212+ arch:
213+ - amd64
214+ - i386
215+
216+- job-template:
217+ name: 'generic-update-mp'
218+ description: |
219+ Update a lanchpad merge proposal with the results of the CI run (Pass/Fail etc.)
220+ node: 'jenkins-slave-2'
221+ builders:
222+ - shell: |
223+ voteOnMergeProposal --status="$ci_result" --build-url="$ci_build" --branch="$ci_branch" --merge-proposal="$ci_merge_proposal" --revision="$ci_revision"
224+ parameters:
225+ - string:
226+ name: ci_result
227+ description: 'The result of the CI build'
228+ - string:
229+ name: ci_build
230+ description: 'The jenkins URL of the build'
231+ - string:
232+ name: ci_branch
233+ description: 'The launchpad branch that was processed'
234+ - string:
235+ name: ci_merge_proposal
236+ description: 'The launchpad merge proposal that was processed'
237+ - string:
238+ name: ci_revision
239+ description: 'The revision of the processed branch'
240+
241+- job-template:
242+ name: 'trigger-{target_project}-ci'
243+ description: |
244+ Poll and trigger {target_project}-ci when there is a new MP that needs it.
245+ node: 'jenkins-slave-2'
246+ triggers:
247+ - timed: 'H/5 * * * *'
248+ builders:
249+ - shell: |
250+ BRANCH_NAME=lp:{target_project}
251+ TARGET_JOB={target_project}-ci
252+ # TARGET_JOB needs to already exist.
253+
254+ launchpadTrigger --lock-name=$JOB_NAME --job=$TARGET_JOB --branch=$BRANCH_NAME --trigger-ci
255+
256+ exit 0
257+
258+- job-template:
259+ name: '{target_project}-ci'
260+ description: |
261+ Build packages and run tests for an {target_project} merge proposal
262+ node: 'jenkins-slave-2'
263+ # This token is the string that was setup for the launchpad bot.
264+ auth-token: BUILD_ME
265+ builders:
266+ - trigger-deb-builders:
267+ landing_candidate: {landing_candidate}
268+ target_branch: 'lp:{target_project}'
269+ hooks: 'H05set_package_version H10strip_native_depends'
270+ parallelism: 1
271+ - upcopy-i386-from-downstream
272+ - upcopy-amd64-from-downstream
273+ - trigger-generic-update-mp
274+ publishers:
275+ - collect-debs
276+ - trigger-generic-update-mp-failed
277+ parameters:
278+ - string:
279+ name: landing_candidate
280+ description: The launchpad branch to process
281+ - string:
282+ name: candidate_revision
283+ description: The revision of the branch
284+ - string:
285+ name: merge_proposal
286+ description: The merge proposal to process
287+
288+- job-template:
289+ name: 'create-debian-chroot'
290+ description: |
291+ Create the required chroots for pbuilder.
292+ node: 'jenkins-slave-2'
293+ parameters:
294+ - string:
295+ name: arches
296+ default: 'amd64 i386'
297+ description: 'Architectures to create machines of'
298+ - string:
299+ name: distributions
300+ default: 'wily'
301+ description: 'Distributions to create machines of'
302+ builders:
303+ - clear-artifacts
304+ - create-chroot
305+
306+- job-template:
307+ name: 'update-debian-chroot'
308+ description: |
309+ Create the required chroots for pbuilder.
310+ node: 'jenkins-slave-2'
311+ parameters:
312+ - string:
313+ name: arches
314+ default: 'amd64 i386'
315+ description: 'Architectures to create machines of'
316+ - string:
317+ name: distributions
318+ default: 'wily'
319+ description: 'Distributions to create machines of'
320+ builders:
321+ - clear-artifacts
322+ - update-chroot
323+
324+- job-template:
325+ name: 'build-{dist}-{arch}-package'
326+ description: |
327+ Build a debian package for {dist} - {arch}.
328+ node: 'jenkins-slave-2'
329+ # TODO: Explore if concurrent will work for us.
330+ # concurrent: 'true' ?
331+ parameters:
332+ - string:
333+ name: landing_candidate
334+ description: 'LP branch to merge and build.'
335+ - string:
336+ name: target_branch
337+ description: 'LP branch to merge into and build from.'
338+ - string:
339+ name: hooks
340+ description: 'Build hooks to run during the build.'
341+ - string:
342+ name: parallelism
343+ description: 'Level of parallelism to use.'
344+ builders:
345+ - clear-artifacts
346+ - build-package:
347+ dist: '{dist}'
348+ arch: '{arch}'
349+ landing_candidate: {landing_candidate}
350+ target_branch: {target_branch}
351+ hooks: {hooks}
352+ parallelism: {parallelism}
353+ publishers:
354+ - collect-debs
355+
356+- project:
357+ name: 'project-autolanding'
358+ description: |
359+ Autolanding jobs for projects in QA control
360+ jobs:
361+ - '{target_project}-autoland'
362+ - 'trigger-{target_project}-autoland'
363+ - 'generic-land-mp'
364+ target_project:
365+ # Must be lp:<name>
366+ - 'autopilot'
367+ - 'auto-upgrade-testing'
368+
369+- job-template:
370+ name: '{target_project}-autoland'
371+ description: |
372+ Gets triggered when a MP exists that meets autoland criteria. Merges with
373+ {target_project} trunk.
374+ node: 'jenkins-slave-2'
375+ auth-token: BUILD_ME
376+ parameters:
377+ - string:
378+ name: 'landing_candidate'
379+ description: 'The launchpad branch to process'
380+ - string:
381+ name: 'candidate_revision'
382+ description: 'The revision of the branch'
383+ - string:
384+ name: 'merge_proposal'
385+ description: 'The merge proposal to process'
386+ builders:
387+ - trigger-deb-builders:
388+ landing_candidate: {landing_candidate}
389+ target_branch: 'lp:{target_project}'
390+ hooks: 'H05set_package_version H10strip_native_depends'
391+ parallelism: 1
392+ - 'trigger-generic-land-mp'
393+ publishers:
394+ - 'trigger-generic-land-mp-failed'
395+
396+- builder:
397+ name: 'trigger-generic-land-mp'
398+ description: |
399+ Run when an autolanding job succeeds to update the MP with the success details.
400+ builders:
401+ - trigger-builds:
402+ - project:
403+ - 'generic-land-mp'
404+ block: 'true'
405+ predefined-parameters: |
406+ ci_result=PASSED
407+ ci_build=$BUILD_URL
408+ ci_branch=$landing_candidate
409+ ci_merge_proposal=$merge_proposal
410+ ci_revision=$candidate_revision
411+ block-thresholds:
412+ build-step-failure-threshold: 'never'
413+ unstable-threshold: 'never'
414+ failure-threshold: 'never'
415+
416+- publisher:
417+ name: 'trigger-generic-land-mp-failed'
418+ description: |
419+ Run when an autolanding job fails to update the MP with the failure details.
420+ publishers:
421+ - trigger-parameterized-builds:
422+ - project:
423+ - 'generic-land-mp'
424+ condition: 'UNSTABLE_OR_WORSE'
425+ predefined-parameters: |
426+ ci_result=FAILED
427+ ci_build=$BUILD_URL
428+ ci_branch=$landing_candidate
429+ ci_merge_proposal=$merge_proposal
430+ ci_revision=$candidate_revision
431+
432+- job-template:
433+ name: 'trigger-{target_project}-autoland'
434+ description: |
435+ Poll and trigger {target_project}-ci when there is a new MP that needs it.
436+ node: 'jenkins-slave-2'
437+ triggers:
438+ - timed: 'H/5 * * * *'
439+ builders:
440+ - shell: |
441+ #!/bin/bash
442+ set -x
443+
444+ BRANCH_NAME=lp:{target_project}
445+ TARGET_JOB={target_project}-autoland
446+
447+ launchpadTrigger --lock-name=$JOB_NAME --job=$TARGET_JOB --branch=$BRANCH_NAME --autoland
448+
449+ exit 0
450+
451+- job-template:
452+ name: 'generic-land-mp'
453+ description: |
454+ Updates a MP with the autoland results (Success/Failure)
455+ node: 'jenkins-slave-2'
456+ parameters:
457+ - string:
458+ name: 'ci_result'
459+ description: 'The result of the CI build'
460+ - string:
461+ name: 'ci_build'
462+ description: 'The jenkins URL of the build'
463+ - string:
464+ name: 'ci_branch'
465+ description: 'The launchpad branch that was processed'
466+ - string:
467+ name: 'ci_merge_proposal'
468+ description: 'The launchpad merge proposal that was processed'
469+ - string:
470+ name: 'ci_revision'
471+ description: 'The revision of the processed branch'
472+ builders:
473+ - shell: |
474+ autoland --test-result="$ci_result" --build-job-url="$ci_build" --merge-proposal="$ci_merge_proposal" --revision="$ci_revision"

Subscribers

People subscribed via source and target branches