Merge ~michihenning/jenkaas-jobs:master into jenkaas-jobs:master

Proposed by Michi Henning
Status: Merged
Approved by: Michał Sawicz
Approved revision: 99fa61c6db940edf62b71b26a1733a10d691fe9a
Merged at revision: 19de48091415b880c4866f637b12deecb50e2ff5
Proposed branch: ~michihenning/jenkaas-jobs:master
Merge into: jenkaas-jobs:master
Diff against target: 814 lines (+659/-8)
15 files modified
jenkaas_jobs/yaml/defaults.yaml (+1/-0)
jenkaas_jobs/yaml/launchpad/launchpad.yaml (+9/-1)
jenkaas_jobs/yaml/launchpad/lp-autoland.yaml (+60/-0)
jenkaas_jobs/yaml/launchpad/lp-generic-land-mp.sh (+6/-0)
jenkaas_jobs/yaml/launchpad/lp-generic-land-mp.yaml (+30/-0)
jenkaas_jobs/yaml/launchpad/lp-trigger-autolanding.sh (+6/-0)
jenkaas_jobs/yaml/launchpad/lp-trigger-autolanding.yaml (+17/-0)
project-example.yaml (+27/-4)
tests/fixtures/credentials/credentials-3-launchpad-plugin.xml (+1/-0)
tests/fixtures/launchpad/lp-generic-land-mp.xml (+66/-0)
tests/fixtures/launchpad/lp-three-autoland.xml (+166/-0)
tests/fixtures/launchpad/lp-three-trigger-autolanding.xml (+44/-0)
tests/fixtures/launchpad/lp-two-autoland.xml (+166/-0)
tests/fixtures/launchpad/lp-two-trigger-autolanding.xml (+44/-0)
tests/project.yaml (+16/-3)
Reviewer Review Type Date Requested Status
Michał Sawicz Needs Fixing
Review via email: mp+293340@code.launchpad.net

Commit message

Added auto-landing jobs.

Description of the change

Added auto-landing jobs. Auto-landing can be enabled/disabled on a per-project basis, and it's possible to set a default in the project.yaml file.

I've tested with the unity-api jenkaas, and it seems to be doing all the right things.

To post a comment you must log in.
Revision history for this message
Michał Sawicz (saviq) wrote :

I think I would rather not create the autolanding jobs for projects that don't use that - or at least instead of exiting early from the script - disabling the trigger and autolanding jobs [1].

You also need to add a .xml fixture so that the job is tested against a known-working configuration [2] [3]. The test will pick it up automagically when the .xml is named the same as the generated job. Note you will have to edit the xml a bit (especially around log rotation, which JJB generates differently than Jenkins returns it - I can give you a hand with that).

[1] http://docs.openstack.org/infra/jenkins-job-builder/definition.html?highlight=disabled
[2] https://jenkins.canonical.com/unity-api-1/job/lp-thumbnailer-trigger-autolanding/config.xml
[3] https://jenkins.canonical.com/unity-api-1/job/lp-thumbnailer-autoland/config.xml

review: Needs Fixing
~michihenning/jenkaas-jobs:master updated
a61ef6c... by Michi Henning

Conditional build step for autolanding trigger.

Revision history for this message
Michi Henning (michihenning) wrote :

I looked long and hard for a way to generate a job based on a condition. There is a multi-job plugin that appears to be able to do this: http://docs.openstack.org/infra/jenkins-job-builder/project_multijob.html
But we don't have that installed at the moment. If we add the plugin, I think it would be possible to create the project-specific autolanding jobs based on the setting of the parameter, so we wouldn't have two extra jobs for projects that don't use autolanding.

Because it appears to be impossible to negate a boolean parameter, I didn't use the disabled parameter and used a conditional build step instead. That avoids calling the shell script when autolanding is disabled.

~michihenning/jenkaas-jobs:master updated
4b33afc... by Michi Henning

Fixed parameter description and removed unused properties.

Revision history for this message
Michi Henning (michihenning) wrote :

I had a bunch of replies to your inline comments. Unfortunately, every time another revision is pushed, all the inline comments are lost :-(

I fixed the incorrect parameter descriptions and removed the unused properties.

Revision history for this message
Michi Henning (michihenning) wrote :

I'm having problems with the tests. When I run

python3 tests/test_jenkaas_jobs.py

on trunk, the tests pass.

In my branch, I get a failure (without the additional fixtures that need to be added):

AIL: testGeneratedJob_2_credentials_3_launchpad_plugin (__main__.TestJenkaasJobs)
Test that the generated job XML is equal to the fixture
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/ddt.py", line 122, in wrapper
    return func(self, *args, **kwargs)
  File "tests/test_jenkaas_jobs.py", line 78, in testGeneratedJob
    "Generated xml is different to what was expected.")
AssertionError: <Element 'matrix-project' at 0x7fe28324d410> != <Element 'matrix-project' at 0x7fe283216830> : Generated xml is different to what was expected.

It's not clear to me why this is failing.

To generate the test xml, I'm using

jenkins-jobs --conf ../unity-api-team-jenkins.conf test tests/project.yaml:`pwd`/jenkaas_jobs/yaml/ -o project.test

I take it that's the correct way to generate the xml so I can use it to create the test fixture files?

Revision history for this message
Michał Sawicz (saviq) wrote :
Download full text (4.3 KiB)

W dniu 04.05.2016 o 04:24, Michi Henning pisze:
> I looked long and hard for a way to generate a job based on a condition. There is a multi-job plugin that appears to be able to do this: http://docs.openstack.org/infra/jenkins-job-builder/project_multijob.html
> But we don't have that installed at the moment. If we add the plugin, I think it would be possible to create the project-specific autolanding jobs based on the setting of the parameter, so we wouldn't have two extra jobs for projects that don't use autolanding.

We could have a separate lp-{project}-autoland job group instead of
adding them to lp-{project} - this way I could not include that in our
config and would not get any jobs generated for this.

To enable it for a few projects you would have to then add a new minimal
project to your yaml. This would unfortunately mean you have to pass on
at least autopkgtest_filter between the two projects (but then again you
might want a different set of tests for autolanding).

Something like:

- project:
  name: foo-autolanding
  autopkgtest_filter: *autopkgtest_filter
  project:
  - foo
  - bar
  jobs:
  - lp-{project}-autoland

So, by default, you'd just add lp-{project}-autoland to your main
project/jobs - but if you wanted more flexibility - you'd do the above.

> Because it appears to be impossible to negate a boolean parameter, I didn't use the disabled parameter and used a conditional build step instead. That avoids calling the shell script when autolanding is disabled.

Interesting. I'd probably go the other way and have a
autolanding_disabled parameter then. Not sure if we still need it with
the above, though. You can always disable autolanding temporarily in the
web ui, or drop the jobs altogether.

> I had a bunch of replies to your inline comments. Unfortunately, every time another revision is pushed, all the inline comments are lost

They don't disappear - you just need to select the diff where they were
made on in the "Preview Diff" dropdown - or use the link "show inline
comments" that'd be there if you sent them. They should still be in your
browser's local storage, so you should be able to send them still.

> I fixed the incorrect parameter descriptions and removed the unused properties.

Tx.

> python3 tests/test_jenkaas_jobs.py

Use "nosetests", you'll get logging output by default.

> In my branch, I get a failure (without the additional fixtures that need to be added):
>
> AIL: testGeneratedJob_2_credentials_3_launchpad_plugin (__main__.TestJenkaasJobs)
> Test that the generated job XML is equal to the fixture
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "/usr/lib/python3/dist-packages/ddt.py", line 122, in wrapper
> return func(self, *args, **kwargs)
> File "tests/test_jenkaas_jobs.py", line 78, in testGeneratedJob
> "Generated xml is different to what was expected.")
> AssertionError: <Element 'matrix-project' at 0x7fe28324d410> != <Element 'matrix-project' at 0x7fe283216830> : Generated xml is different to what was expected.
>
> It's not clear to me why this is failing.

With nosetests you'll see http://pastebin.ubuntu.com/16212853/...

Read more...

~michihenning/jenkaas-jobs:master updated
0916de8... by Michi Henning

Separate job group for autolanding.

46d8e42... by Michi Henning

Autolanding comments for project example.

4744e16... by Michi Henning

Fixed failing credentials test.

a4633b8... by Michi Henning

Test fixture for lp-generic-land-mp.xml

8896edf... by Michi Henning

Added test fixtures for test project autolanding.

a0d3944... by Michi Henning

Modified project.yaml for tests.

31554da... by Michi Henning

Fixed whitespace.

Revision history for this message
Michi Henning (michihenning) wrote :

Thanks heaps for all your help!

I think what's there now is closer.

I had endless problems with nosetests:

nosetests: error: Error reading config file 'setup.cfg': no such option 'with-ignore-docstrings'

I have nose-ignore-docstring installed. Not sure why it still bitches about the option. I muddled through without it for this. I think the test fixtures should be OK now.

~michihenning/jenkaas-jobs:master updated
dc98e23... by Michał Sawicz

Fix branch references

e156b78... by Michał Sawicz

Fix autolanding test fixtures and use references

Using references to projects we can reduce duplication and make
sure changes are applied across the board.

df6b4f7... by Michał Sawicz

Use references in project-example.yaml

Revision history for this message
Michał Sawicz (saviq) wrote :

I've fixed up a few things - please pull/merge lp:~saviq/jenkaas-jobs:add-autolanding [1] here.

A few errors there were due to using JJB-generated definitions as fixtures instead of downloading a known-working jenkins config.xml.

Can you please revert the changes to AUTHORS and ChangeLog, I'll take care of that in master.

[1] https://code.launchpad.net/~saviq/jenkaas-jobs/+git/jenkaas-jobs/+merge/293860

review: Needs Fixing
~michihenning/jenkaas-jobs:master updated
99fa61c... by Michi Henning

Reverted changes to AUTHORS and ChangeLog.

Revision history for this message
Michi Henning (michihenning) wrote :

Thanks for that! I apologize for being so inept. I'm still unfamiliar with the python testing and the JBB/yaml idioms :-(

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/jenkaas_jobs/yaml/defaults.yaml b/jenkaas_jobs/yaml/defaults.yaml
2index aaf5825..805878b 100644
3--- a/jenkaas_jobs/yaml/defaults.yaml
4+++ b/jenkaas_jobs/yaml/defaults.yaml
5@@ -6,6 +6,7 @@
6 # These jobs will not be shown on the Launchpad MP comments
7 blacklisted_jobs: |
8 - "lp-generic-update-mp"
9+ - "lp-generic-land-mp"
10
11 # How many build runs to keep artifacts for. This applies to both source
12 # and binary builds, also note you can only cover a third of your available
13diff --git a/jenkaas_jobs/yaml/launchpad/launchpad.yaml b/jenkaas_jobs/yaml/launchpad/launchpad.yaml
14index 51686dc..3cd22dc 100644
15--- a/jenkaas_jobs/yaml/launchpad/launchpad.yaml
16+++ b/jenkaas_jobs/yaml/launchpad/launchpad.yaml
17@@ -2,10 +2,18 @@
18 name: launchpad-jobs
19 jobs:
20 - lp-generic-update-mp
21+ - lp-generic-land-mp
22
23 - job-group:
24 name: lp-{project}
25 branch: lp:{project}
26 jobs:
27 - lp-{project}-trigger
28- - lp-{project}-ci
29\ No newline at end of file
30+ - lp-{project}-ci
31+
32+- job-group:
33+ name: lp-{project}-autolanding
34+ branch: lp:{project}
35+ jobs:
36+ - lp-{project}-trigger-autolanding
37+ - lp-{project}-autoland
38diff --git a/jenkaas_jobs/yaml/launchpad/lp-autoland.yaml b/jenkaas_jobs/yaml/launchpad/lp-autoland.yaml
39new file mode 100644
40index 0000000..19f3f30
41--- /dev/null
42+++ b/jenkaas_jobs/yaml/launchpad/lp-autoland.yaml
43@@ -0,0 +1,60 @@
44+- job-template:
45+ name: lp-{project}-autoland
46+ project-type: freestyle
47+ description: 'Auto-land top-approved merge proposal in {branch}'
48+ node: monitor
49+ concurrent: true
50+ auth-token: BUILD_ME
51+ logrotate:
52+ daysToKeep: 60
53+ properties:
54+ - rebuild
55+ parameters:
56+ - string:
57+ name: landing_candidate
58+ description: Launchpad branch to process
59+ - string:
60+ name: candidate_revision
61+ description: Branch revision to process
62+ - string:
63+ name: merge_proposal
64+ description: Merge proposal to process
65+ builders:
66+ - trigger-builds:
67+ - project:
68+ - build
69+ block: true
70+ predefined-parameters: |
71+ source_branch=${{landing_candidate}}
72+ source_revision=${{candidate_revision}}
73+ target_branch={branch}
74+ - matrix-trigger:
75+ job: test-0-autopkgtest
76+ parameters: |
77+ build_run=build#${{TRIGGERED_BUILD_NUMBER_build}}
78+ testnames={autopkgtest_names}
79+ filter: '{autopkgtest_filter}'
80+ wrappers:
81+ - timestamps
82+ - build-name:
83+ name: ${{ENV,var="landing_candidate"}}
84+ publishers:
85+ - trigger-parameterized-builds:
86+ - project:
87+ - lp-generic-land-mp
88+ predefined-parameters: |
89+ ci_result=PASSED
90+ ci_build=${{BUILD_URL}}
91+ ci_branch=${{landing_candidate}}
92+ ci_merge_proposal=${{merge_proposal}}
93+ ci_revision=${{candidate_revision}}
94+ condition: SUCCESS
95+ - project:
96+ - lp-generic-land-mp
97+ predefined-parameters: |
98+ ci_result=FAILED
99+ ci_build=${{BUILD_URL}}
100+ ci_branch=${{landing_candidate}}
101+ ci_merge_proposal=${{merge_proposal}}
102+ ci_revision=${{candidate_revision}}
103+ condition: UNSTABLE_OR_WORSE
104diff --git a/jenkaas_jobs/yaml/launchpad/lp-generic-land-mp.sh b/jenkaas_jobs/yaml/launchpad/lp-generic-land-mp.sh
105new file mode 100644
106index 0000000..9c19c81
107--- /dev/null
108+++ b/jenkaas_jobs/yaml/launchpad/lp-generic-land-mp.sh
109@@ -0,0 +1,6 @@
110+#!/bin/bash
111+
112+# log all commands and abort on error
113+set -ex
114+
115+autoland --test-result="${ci_result}" --build-job-url="${ci_build}" --merge-proposal="${ci_merge_proposal}" --revision="${ci_revision}"
116diff --git a/jenkaas_jobs/yaml/launchpad/lp-generic-land-mp.yaml b/jenkaas_jobs/yaml/launchpad/lp-generic-land-mp.yaml
117new file mode 100644
118index 0000000..3145341
119--- /dev/null
120+++ b/jenkaas_jobs/yaml/launchpad/lp-generic-land-mp.yaml
121@@ -0,0 +1,30 @@
122+- job-template:
123+ name: lp-generic-land-mp
124+ project-type: freestyle
125+ description: 'Auto-land top-approved merge proposal on Launchpad.'
126+ node: launchpad
127+ logrotate:
128+ numToKeep: 100
129+ parameters:
130+ - string:
131+ name: ci_result
132+ description: Result of the CI build
133+ - string:
134+ name: ci_build
135+ description: Jenkins URL of the build
136+ - string:
137+ name: ci_branch
138+ description: Launchpad branch that was processed
139+ - string:
140+ name: ci_merge_proposal
141+ description: Launchpad merge proposal that was processed
142+ - string:
143+ name: ci_revision
144+ description: Revision of the processed branch
145+ wrappers:
146+ - timestamps
147+ - build-name:
148+ name: ${{ENV,var="ci_branch"}}
149+ builders:
150+ - shell:
151+ !include-raw-escape: lp-generic-land-mp.sh
152diff --git a/jenkaas_jobs/yaml/launchpad/lp-trigger-autolanding.sh b/jenkaas_jobs/yaml/launchpad/lp-trigger-autolanding.sh
153new file mode 100644
154index 0000000..488a91b
155--- /dev/null
156+++ b/jenkaas_jobs/yaml/launchpad/lp-trigger-autolanding.sh
157@@ -0,0 +1,6 @@
158+#!/bin/bash
159+
160+# log all commands and abort on error
161+set -ex
162+
163+launchpadTrigger --lock-name=${{JOB_NAME}} --job=lp-{project}-autoland --branch={branch} --autoland || true
164diff --git a/jenkaas_jobs/yaml/launchpad/lp-trigger-autolanding.yaml b/jenkaas_jobs/yaml/launchpad/lp-trigger-autolanding.yaml
165new file mode 100644
166index 0000000..d1f8b97
167--- /dev/null
168+++ b/jenkaas_jobs/yaml/launchpad/lp-trigger-autolanding.yaml
169@@ -0,0 +1,17 @@
170+- job-template:
171+ name: lp-{project}-trigger-autolanding
172+ project-type: freestyle
173+ description: 'Auto-land top-approved changes for {branch}'
174+ node: launchpad-{project}
175+ logrotate:
176+ numToKeep: 10
177+ triggers:
178+ - timed: # every five minutes
179+ H/5 * * * *
180+ properties:
181+ - rebuild
182+ wrappers:
183+ - timestamps
184+ builders:
185+ - shell:
186+ !include-raw: lp-trigger-autolanding.sh
187diff --git a/project-example.yaml b/project-example.yaml
188index dceb47a..dbd7205 100644
189--- a/project-example.yaml
190+++ b/project-example.yaml
191@@ -91,7 +91,7 @@
192 # of them by putting the same key under the entry in the "jobs" key.
193
194 # Default space-separated list of autopkgtest names.
195- autopkgtest_names: ''
196+ autopkgtest_names: &autopkgtest_names ''
197
198 # Which autopktests to run on which architectures.
199 #
200@@ -99,7 +99,7 @@
201 #
202 # FIXME: this has to use XML entities for & due to a Jenkins Job Builder
203 # limitation.
204- autopkgtest_filter:
205+ autopkgtest_filter: &autopkgtest_filter
206 (label=="amd64" &amp;&amp; testname=="test-name.sh") || (label=="phone-armhf" &amp;&amp; testname=="autopilot.sh" &amp;&amp; release=="vivid+overlay")
207
208 # A list of Launchpad projects to configure for CI, each of which can have
209@@ -107,8 +107,8 @@
210 project:
211 - your-project:
212 autopkgtest_names: test-name.sh autopilot.sh
213- - your-other-project
214- - even-another-project:
215+ - your-other-project: &your_other_project
216+ - even-another-project: &even_another_project
217 # You can direct the trigger and CI jobs at a branch different than
218 # lp:{project}
219 branch: lp:another-branch
220@@ -145,3 +145,26 @@
221 # from the list of projects above.
222 - lp-{project}
223
224+ # If you want to autoland all projects defined above, enable the following line, which will
225+ # result in autolanding for your-project, your-other-project, and even-another-project in
226+ # their respective branches.
227+ #
228+ # - lp-{project}-autolanding
229+
230+# If only some projects defined above use autolanding, you can selectively enable them by adding
231+# the project below. This example enables autolanding for your-other-project and even-another-project.
232+# The per-project variables need to be set here - use references, unless you want the configurations
233+# to differ. You might for example want a wider set of tests to run during autolanding. In that case
234+# you can still use references and only override a single parameter.
235+
236+- project:
237+ name: your-project-autolanding
238+ autopkgtest_names: *autopkgtest_names
239+ autopkgtest_filter: *autopkgtest_filter
240+ project:
241+ - your-other-project: *your_other_project
242+ - even-another-project:
243+ <<: *even_another_project
244+ autopkgtest_names: test-name.sh autopilot.sh integration.sh
245+ jobs:
246+ - lp-{project}-autolanding
247\ No newline at end of file
248diff --git a/tests/fixtures/credentials/credentials-3-launchpad-plugin.xml b/tests/fixtures/credentials/credentials-3-launchpad-plugin.xml
249index dd96e9b..8b7ae74 100644
250--- a/tests/fixtures/credentials/credentials-3-launchpad-plugin.xml
251+++ b/tests/fixtures/credentials/credentials-3-launchpad-plugin.xml
252@@ -104,6 +104,7 @@ jenkins_build_token: &quot;BUILD_ME&quot;
253 # affected merge proposal (in the &quot;Executed test runs:&quot; section)
254 jobs_blacklisted_from_messages:
255 - &quot;lp-generic-update-mp&quot;
256+- &quot;lp-generic-land-mp&quot;
257
258
259 #message that is used for &quot;testing in progress&quot; comment
260diff --git a/tests/fixtures/launchpad/lp-generic-land-mp.xml b/tests/fixtures/launchpad/lp-generic-land-mp.xml
261new file mode 100644
262index 0000000..5b8e67c
263--- /dev/null
264+++ b/tests/fixtures/launchpad/lp-generic-land-mp.xml
265@@ -0,0 +1,66 @@
266+<?xml version="1.0" encoding="UTF-8"?><project>
267+ <actions/>
268+ <description>Auto-land top-approved merge proposal on Launchpad.&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
269+ <keepDependencies>false</keepDependencies>
270+ <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
271+ <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
272+ <concurrentBuild>false</concurrentBuild>
273+ <assignedNode>launchpad</assignedNode>
274+ <canRoam>false</canRoam>
275+ <logRotator>
276+ <daysToKeep>-1</daysToKeep>
277+ <numToKeep>100</numToKeep>
278+ <artifactDaysToKeep>-1</artifactDaysToKeep>
279+ <artifactNumToKeep>-1</artifactNumToKeep>
280+ </logRotator>
281+ <properties>
282+ <hudson.model.ParametersDefinitionProperty>
283+ <parameterDefinitions>
284+ <hudson.model.StringParameterDefinition>
285+ <name>ci_result</name>
286+ <description>Result of the CI build</description>
287+ <defaultValue/>
288+ </hudson.model.StringParameterDefinition>
289+ <hudson.model.StringParameterDefinition>
290+ <name>ci_build</name>
291+ <description>Jenkins URL of the build</description>
292+ <defaultValue/>
293+ </hudson.model.StringParameterDefinition>
294+ <hudson.model.StringParameterDefinition>
295+ <name>ci_branch</name>
296+ <description>Launchpad branch that was processed</description>
297+ <defaultValue/>
298+ </hudson.model.StringParameterDefinition>
299+ <hudson.model.StringParameterDefinition>
300+ <name>ci_merge_proposal</name>
301+ <description>Launchpad merge proposal that was processed</description>
302+ <defaultValue/>
303+ </hudson.model.StringParameterDefinition>
304+ <hudson.model.StringParameterDefinition>
305+ <name>ci_revision</name>
306+ <description>Revision of the processed branch</description>
307+ <defaultValue/>
308+ </hudson.model.StringParameterDefinition>
309+ </parameterDefinitions>
310+ </hudson.model.ParametersDefinitionProperty>
311+ </properties>
312+ <scm class="hudson.scm.NullSCM"/>
313+ <builders>
314+ <hudson.tasks.Shell>
315+ <command>#!/bin/bash
316+
317+# log all commands and abort on error
318+set -ex
319+
320+autoland --test-result="${ci_result}" --build-job-url="${ci_build}" --merge-proposal="${ci_merge_proposal}" --revision="${ci_revision}"
321+</command>
322+ </hudson.tasks.Shell>
323+ </builders>
324+ <publishers/>
325+ <buildWrappers>
326+ <hudson.plugins.timestamper.TimestamperBuildWrapper/>
327+ <org.jenkinsci.plugins.buildnamesetter.BuildNameSetter>
328+ <template>${ENV,var="ci_branch"}</template>
329+ </org.jenkinsci.plugins.buildnamesetter.BuildNameSetter>
330+ </buildWrappers>
331+</project>
332diff --git a/tests/fixtures/launchpad/lp-three-autoland.xml b/tests/fixtures/launchpad/lp-three-autoland.xml
333new file mode 100644
334index 0000000..7660caa
335--- /dev/null
336+++ b/tests/fixtures/launchpad/lp-three-autoland.xml
337@@ -0,0 +1,166 @@
338+<?xml version="1.0" encoding="utf-8"?>
339+<project>
340+ <actions/>
341+ <description>Auto-land top-approved merge proposal in lp:three/devel&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
342+ <keepDependencies>false</keepDependencies>
343+ <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
344+ <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
345+ <authToken>BUILD_ME</authToken>
346+ <concurrentBuild>true</concurrentBuild>
347+ <assignedNode>monitor</assignedNode>
348+ <canRoam>false</canRoam>
349+ <logRotator>
350+ <daysToKeep>60</daysToKeep>
351+ <numToKeep>-1</numToKeep>
352+ <artifactDaysToKeep>-1</artifactDaysToKeep>
353+ <artifactNumToKeep>-1</artifactNumToKeep>
354+ </logRotator>
355+ <properties>
356+ <com.sonyericsson.rebuild.RebuildSettings>
357+ <autoRebuild>false</autoRebuild>
358+ <rebuildDisabled>false</rebuildDisabled>
359+ </com.sonyericsson.rebuild.RebuildSettings>
360+ <hudson.model.ParametersDefinitionProperty>
361+ <parameterDefinitions>
362+ <hudson.model.StringParameterDefinition>
363+ <name>landing_candidate</name>
364+ <description>Launchpad branch to process</description>
365+ <defaultValue/>
366+ </hudson.model.StringParameterDefinition>
367+ <hudson.model.StringParameterDefinition>
368+ <name>candidate_revision</name>
369+ <description>Branch revision to process</description>
370+ <defaultValue/>
371+ </hudson.model.StringParameterDefinition>
372+ <hudson.model.StringParameterDefinition>
373+ <name>merge_proposal</name>
374+ <description>Merge proposal to process</description>
375+ <defaultValue/>
376+ </hudson.model.StringParameterDefinition>
377+ </parameterDefinitions>
378+ </hudson.model.ParametersDefinitionProperty>
379+ </properties>
380+ <scm class="hudson.scm.NullSCM"/>
381+ <builders>
382+ <hudson.plugins.parameterizedtrigger.TriggerBuilder>
383+ <configs>
384+ <hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig>
385+ <configs>
386+ <hudson.plugins.parameterizedtrigger.PredefinedBuildParameters>
387+ <properties>source_branch=${landing_candidate}
388+source_revision=${candidate_revision}
389+target_branch=lp:three/devel
390+</properties>
391+ </hudson.plugins.parameterizedtrigger.PredefinedBuildParameters>
392+ </configs>
393+ <projects>build</projects>
394+ <condition>ALWAYS</condition>
395+ <triggerWithNoParameters>false</triggerWithNoParameters>
396+ <buildAllNodesWithLabel>false</buildAllNodesWithLabel>
397+ <block>
398+ <buildStepFailureThreshold>
399+ <name>FAILURE</name>
400+ <ordinal>2</ordinal>
401+ <color>RED</color>
402+ <completeBuild>true</completeBuild>
403+ </buildStepFailureThreshold>
404+ <unstableThreshold>
405+ <name>UNSTABLE</name>
406+ <ordinal>1</ordinal>
407+ <color>YELLOW</color>
408+ <completeBuild>true</completeBuild>
409+ </unstableThreshold>
410+ <failureThreshold>
411+ <name>FAILURE</name>
412+ <ordinal>2</ordinal>
413+ <color>RED</color>
414+ <completeBuild>true</completeBuild>
415+ </failureThreshold>
416+ </block>
417+ </hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig>
418+ </configs>
419+ </hudson.plugins.parameterizedtrigger.TriggerBuilder>
420+ <hudson.plugins.parameterizedtrigger.TriggerBuilder>
421+ <configs>
422+ <hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig>
423+ <configs>
424+ <hudson.plugins.parameterizedtrigger.PredefinedBuildParameters>
425+ <properties>build_run=build#${TRIGGERED_BUILD_NUMBER_build}
426+testnames=test-three
427+</properties>
428+ </hudson.plugins.parameterizedtrigger.PredefinedBuildParameters>
429+ <hudson.plugins.parameterizedtrigger.matrix.MatrixSubsetBuildParameters>
430+ <filter/>
431+ </hudson.plugins.parameterizedtrigger.matrix.MatrixSubsetBuildParameters>
432+ </configs>
433+ <projects>test-0-autopkgtest</projects>
434+ <condition>ALWAYS</condition>
435+ <triggerWithNoParameters>false</triggerWithNoParameters>
436+ <buildAllNodesWithLabel>false</buildAllNodesWithLabel>
437+ <block>
438+ <buildStepFailureThreshold>
439+ <name>FAILURE</name>
440+ <ordinal>2</ordinal>
441+ <color>RED</color>
442+ <completeBuild>true</completeBuild>
443+ </buildStepFailureThreshold>
444+ <unstableThreshold>
445+ <name>UNSTABLE</name>
446+ <ordinal>1</ordinal>
447+ <color>YELLOW</color>
448+ <completeBuild>true</completeBuild>
449+ </unstableThreshold>
450+ <failureThreshold>
451+ <name>FAILURE</name>
452+ <ordinal>2</ordinal>
453+ <color>RED</color>
454+ <completeBuild>true</completeBuild>
455+ </failureThreshold>
456+ </block>
457+ </hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig>
458+ </configs>
459+ </hudson.plugins.parameterizedtrigger.TriggerBuilder>
460+ </builders>
461+ <publishers>
462+ <hudson.plugins.parameterizedtrigger.BuildTrigger>
463+ <configs>
464+ <hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
465+ <configs>
466+ <hudson.plugins.parameterizedtrigger.PredefinedBuildParameters>
467+ <properties>ci_result=PASSED
468+ci_build=${BUILD_URL}
469+ci_branch=${landing_candidate}
470+ci_merge_proposal=${merge_proposal}
471+ci_revision=${candidate_revision}
472+</properties>
473+ </hudson.plugins.parameterizedtrigger.PredefinedBuildParameters>
474+ </configs>
475+ <projects>lp-generic-land-mp</projects>
476+ <condition>SUCCESS</condition>
477+ <triggerWithNoParameters>false</triggerWithNoParameters>
478+ </hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
479+ <hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
480+ <configs>
481+ <hudson.plugins.parameterizedtrigger.PredefinedBuildParameters>
482+ <properties>ci_result=FAILED
483+ci_build=${BUILD_URL}
484+ci_branch=${landing_candidate}
485+ci_merge_proposal=${merge_proposal}
486+ci_revision=${candidate_revision}
487+</properties>
488+ </hudson.plugins.parameterizedtrigger.PredefinedBuildParameters>
489+ </configs>
490+ <projects>lp-generic-land-mp</projects>
491+ <condition>UNSTABLE_OR_WORSE</condition>
492+ <triggerWithNoParameters>false</triggerWithNoParameters>
493+ </hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
494+ </configs>
495+ </hudson.plugins.parameterizedtrigger.BuildTrigger>
496+ </publishers>
497+ <buildWrappers>
498+ <hudson.plugins.timestamper.TimestamperBuildWrapper/>
499+ <org.jenkinsci.plugins.buildnamesetter.BuildNameSetter>
500+ <template>${ENV,var=&quot;landing_candidate&quot;}</template>
501+ </org.jenkinsci.plugins.buildnamesetter.BuildNameSetter>
502+ </buildWrappers>
503+</project>
504diff --git a/tests/fixtures/launchpad/lp-three-trigger-autolanding.xml b/tests/fixtures/launchpad/lp-three-trigger-autolanding.xml
505new file mode 100644
506index 0000000..1694b1e
507--- /dev/null
508+++ b/tests/fixtures/launchpad/lp-three-trigger-autolanding.xml
509@@ -0,0 +1,44 @@
510+<?xml version="1.0" encoding="utf-8"?>
511+<project>
512+ <actions/>
513+ <description>Auto-land top-approved changes for lp:three/devel&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
514+ <keepDependencies>false</keepDependencies>
515+ <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
516+ <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
517+ <concurrentBuild>false</concurrentBuild>
518+ <assignedNode>launchpad-three</assignedNode>
519+ <canRoam>false</canRoam>
520+ <logRotator>
521+ <daysToKeep>-1</daysToKeep>
522+ <numToKeep>10</numToKeep>
523+ <artifactDaysToKeep>-1</artifactDaysToKeep>
524+ <artifactNumToKeep>-1</artifactNumToKeep>
525+ </logRotator>
526+ <properties>
527+ <com.sonyericsson.rebuild.RebuildSettings>
528+ <autoRebuild>false</autoRebuild>
529+ <rebuildDisabled>false</rebuildDisabled>
530+ </com.sonyericsson.rebuild.RebuildSettings>
531+ </properties>
532+ <scm class="hudson.scm.NullSCM"/>
533+ <triggers class="vector">
534+ <hudson.triggers.TimerTrigger>
535+ <spec>H/5 * * * *</spec>
536+ </hudson.triggers.TimerTrigger>
537+ </triggers>
538+ <builders>
539+ <hudson.tasks.Shell>
540+ <command>#!/bin/bash
541+
542+# log all commands and abort on error
543+set -ex
544+
545+launchpadTrigger --lock-name=${JOB_NAME} --job=lp-three-autoland --branch=lp:three/devel --autoland || true
546+</command>
547+ </hudson.tasks.Shell>
548+ </builders>
549+ <publishers/>
550+ <buildWrappers>
551+ <hudson.plugins.timestamper.TimestamperBuildWrapper/>
552+ </buildWrappers>
553+</project>
554diff --git a/tests/fixtures/launchpad/lp-two-autoland.xml b/tests/fixtures/launchpad/lp-two-autoland.xml
555new file mode 100644
556index 0000000..8613b23
557--- /dev/null
558+++ b/tests/fixtures/launchpad/lp-two-autoland.xml
559@@ -0,0 +1,166 @@
560+<?xml version="1.0" encoding="utf-8"?>
561+<project>
562+ <actions/>
563+ <description>Auto-land top-approved merge proposal in lp:two&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
564+ <keepDependencies>false</keepDependencies>
565+ <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
566+ <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
567+ <authToken>BUILD_ME</authToken>
568+ <concurrentBuild>true</concurrentBuild>
569+ <assignedNode>monitor</assignedNode>
570+ <canRoam>false</canRoam>
571+ <logRotator>
572+ <daysToKeep>60</daysToKeep>
573+ <numToKeep>-1</numToKeep>
574+ <artifactDaysToKeep>-1</artifactDaysToKeep>
575+ <artifactNumToKeep>-1</artifactNumToKeep>
576+ </logRotator>
577+ <properties>
578+ <com.sonyericsson.rebuild.RebuildSettings>
579+ <autoRebuild>false</autoRebuild>
580+ <rebuildDisabled>false</rebuildDisabled>
581+ </com.sonyericsson.rebuild.RebuildSettings>
582+ <hudson.model.ParametersDefinitionProperty>
583+ <parameterDefinitions>
584+ <hudson.model.StringParameterDefinition>
585+ <name>landing_candidate</name>
586+ <description>Launchpad branch to process</description>
587+ <defaultValue/>
588+ </hudson.model.StringParameterDefinition>
589+ <hudson.model.StringParameterDefinition>
590+ <name>candidate_revision</name>
591+ <description>Branch revision to process</description>
592+ <defaultValue/>
593+ </hudson.model.StringParameterDefinition>
594+ <hudson.model.StringParameterDefinition>
595+ <name>merge_proposal</name>
596+ <description>Merge proposal to process</description>
597+ <defaultValue/>
598+ </hudson.model.StringParameterDefinition>
599+ </parameterDefinitions>
600+ </hudson.model.ParametersDefinitionProperty>
601+ </properties>
602+ <scm class="hudson.scm.NullSCM"/>
603+ <builders>
604+ <hudson.plugins.parameterizedtrigger.TriggerBuilder>
605+ <configs>
606+ <hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig>
607+ <configs>
608+ <hudson.plugins.parameterizedtrigger.PredefinedBuildParameters>
609+ <properties>source_branch=${landing_candidate}
610+source_revision=${candidate_revision}
611+target_branch=lp:two
612+</properties>
613+ </hudson.plugins.parameterizedtrigger.PredefinedBuildParameters>
614+ </configs>
615+ <projects>build</projects>
616+ <condition>ALWAYS</condition>
617+ <triggerWithNoParameters>false</triggerWithNoParameters>
618+ <buildAllNodesWithLabel>false</buildAllNodesWithLabel>
619+ <block>
620+ <buildStepFailureThreshold>
621+ <name>FAILURE</name>
622+ <ordinal>2</ordinal>
623+ <color>RED</color>
624+ <completeBuild>true</completeBuild>
625+ </buildStepFailureThreshold>
626+ <unstableThreshold>
627+ <name>UNSTABLE</name>
628+ <ordinal>1</ordinal>
629+ <color>YELLOW</color>
630+ <completeBuild>true</completeBuild>
631+ </unstableThreshold>
632+ <failureThreshold>
633+ <name>FAILURE</name>
634+ <ordinal>2</ordinal>
635+ <color>RED</color>
636+ <completeBuild>true</completeBuild>
637+ </failureThreshold>
638+ </block>
639+ </hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig>
640+ </configs>
641+ </hudson.plugins.parameterizedtrigger.TriggerBuilder>
642+ <hudson.plugins.parameterizedtrigger.TriggerBuilder>
643+ <configs>
644+ <hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig>
645+ <configs>
646+ <hudson.plugins.parameterizedtrigger.PredefinedBuildParameters>
647+ <properties>build_run=build#${TRIGGERED_BUILD_NUMBER_build}
648+testnames=test-one test-two
649+</properties>
650+ </hudson.plugins.parameterizedtrigger.PredefinedBuildParameters>
651+ <hudson.plugins.parameterizedtrigger.matrix.MatrixSubsetBuildParameters>
652+ <filter>(label=="armhf").implies(testname=="test-one")</filter>
653+ </hudson.plugins.parameterizedtrigger.matrix.MatrixSubsetBuildParameters>
654+ </configs>
655+ <projects>test-0-autopkgtest</projects>
656+ <condition>ALWAYS</condition>
657+ <triggerWithNoParameters>false</triggerWithNoParameters>
658+ <buildAllNodesWithLabel>false</buildAllNodesWithLabel>
659+ <block>
660+ <buildStepFailureThreshold>
661+ <name>FAILURE</name>
662+ <ordinal>2</ordinal>
663+ <color>RED</color>
664+ <completeBuild>true</completeBuild>
665+ </buildStepFailureThreshold>
666+ <unstableThreshold>
667+ <name>UNSTABLE</name>
668+ <ordinal>1</ordinal>
669+ <color>YELLOW</color>
670+ <completeBuild>true</completeBuild>
671+ </unstableThreshold>
672+ <failureThreshold>
673+ <name>FAILURE</name>
674+ <ordinal>2</ordinal>
675+ <color>RED</color>
676+ <completeBuild>true</completeBuild>
677+ </failureThreshold>
678+ </block>
679+ </hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig>
680+ </configs>
681+ </hudson.plugins.parameterizedtrigger.TriggerBuilder>
682+ </builders>
683+ <publishers>
684+ <hudson.plugins.parameterizedtrigger.BuildTrigger>
685+ <configs>
686+ <hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
687+ <configs>
688+ <hudson.plugins.parameterizedtrigger.PredefinedBuildParameters>
689+ <properties>ci_result=PASSED
690+ci_build=${BUILD_URL}
691+ci_branch=${landing_candidate}
692+ci_merge_proposal=${merge_proposal}
693+ci_revision=${candidate_revision}
694+</properties>
695+ </hudson.plugins.parameterizedtrigger.PredefinedBuildParameters>
696+ </configs>
697+ <projects>lp-generic-land-mp</projects>
698+ <condition>SUCCESS</condition>
699+ <triggerWithNoParameters>false</triggerWithNoParameters>
700+ </hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
701+ <hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
702+ <configs>
703+ <hudson.plugins.parameterizedtrigger.PredefinedBuildParameters>
704+ <properties>ci_result=FAILED
705+ci_build=${BUILD_URL}
706+ci_branch=${landing_candidate}
707+ci_merge_proposal=${merge_proposal}
708+ci_revision=${candidate_revision}
709+</properties>
710+ </hudson.plugins.parameterizedtrigger.PredefinedBuildParameters>
711+ </configs>
712+ <projects>lp-generic-land-mp</projects>
713+ <condition>UNSTABLE_OR_WORSE</condition>
714+ <triggerWithNoParameters>false</triggerWithNoParameters>
715+ </hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
716+ </configs>
717+ </hudson.plugins.parameterizedtrigger.BuildTrigger>
718+ </publishers>
719+ <buildWrappers>
720+ <hudson.plugins.timestamper.TimestamperBuildWrapper/>
721+ <org.jenkinsci.plugins.buildnamesetter.BuildNameSetter>
722+ <template>${ENV,var=&quot;landing_candidate&quot;}</template>
723+ </org.jenkinsci.plugins.buildnamesetter.BuildNameSetter>
724+ </buildWrappers>
725+</project>
726diff --git a/tests/fixtures/launchpad/lp-two-trigger-autolanding.xml b/tests/fixtures/launchpad/lp-two-trigger-autolanding.xml
727new file mode 100644
728index 0000000..6af75ad
729--- /dev/null
730+++ b/tests/fixtures/launchpad/lp-two-trigger-autolanding.xml
731@@ -0,0 +1,44 @@
732+<?xml version="1.0" encoding="utf-8"?>
733+<project>
734+ <actions/>
735+ <description>Auto-land top-approved changes for lp:two&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
736+ <keepDependencies>false</keepDependencies>
737+ <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
738+ <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
739+ <concurrentBuild>false</concurrentBuild>
740+ <assignedNode>launchpad-two</assignedNode>
741+ <canRoam>false</canRoam>
742+ <logRotator>
743+ <daysToKeep>-1</daysToKeep>
744+ <numToKeep>10</numToKeep>
745+ <artifactDaysToKeep>-1</artifactDaysToKeep>
746+ <artifactNumToKeep>-1</artifactNumToKeep>
747+ </logRotator>
748+ <properties>
749+ <com.sonyericsson.rebuild.RebuildSettings>
750+ <autoRebuild>false</autoRebuild>
751+ <rebuildDisabled>false</rebuildDisabled>
752+ </com.sonyericsson.rebuild.RebuildSettings>
753+ </properties>
754+ <scm class="hudson.scm.NullSCM"/>
755+ <triggers class="vector">
756+ <hudson.triggers.TimerTrigger>
757+ <spec>H/5 * * * *</spec>
758+ </hudson.triggers.TimerTrigger>
759+ </triggers>
760+ <builders>
761+ <hudson.tasks.Shell>
762+ <command>#!/bin/bash
763+
764+# log all commands and abort on error
765+set -ex
766+
767+launchpadTrigger --lock-name=${JOB_NAME} --job=lp-two-autoland --branch=lp:two --autoland || true
768+</command>
769+ </hudson.tasks.Shell>
770+ </builders>
771+ <publishers/>
772+ <buildWrappers>
773+ <hudson.plugins.timestamper.TimestamperBuildWrapper/>
774+ </buildWrappers>
775+</project>
776diff --git a/tests/project.yaml b/tests/project.yaml
777index d0892af..f28afc5 100644
778--- a/tests/project.yaml
779+++ b/tests/project.yaml
780@@ -18,12 +18,14 @@
781 (release=="vivid+overlay")
782 chroot_filter:
783 (node=="jenkins-slave-2").implies(arch=="amd64" || arch=="i386") && (node=="cyclops-node02").implies(arch=="armhf")
784+ autopkgtest_filter: &autopkgtest_filter
785+ ''
786 project:
787 - one
788- - two:
789+ - two: &two
790 autopkgtest_names: test-one test-two
791 autopkgtest_filter: (label==&quot;armhf&quot;).implies(testname==&quot;test-one&quot;)
792- - three:
793+ - three: &three
794 branch: lp:three/devel
795 jobs:
796 - prepare-jobs
797@@ -33,4 +35,15 @@
798 - test-jobs
799 - launchpad-jobs
800 - device-flash
801- - lp-{project}
802\ No newline at end of file
803+ - lp-{project}
804+
805+- project:
806+ name: test-autolanding
807+ autopkgtest_filter: *autopkgtest_filter
808+ project:
809+ - two: *two
810+ - three:
811+ <<: *three
812+ autopkgtest_names: test-three
813+ jobs:
814+ - lp-{project}-autolanding

Subscribers

People subscribed via source and target branches

to all changes: