Merge lp:~robru/cupstream2distro/drop-merge-checks into lp:cupstream2distro

Proposed by Robert Bruce Park
Status: Merged
Approved by: Robert Bruce Park
Approved revision: 1223
Merged at revision: 1223
Proposed branch: lp:~robru/cupstream2distro/drop-merge-checks
Merge into: lp:cupstream2distro
Diff against target: 155 lines (+12/-69)
5 files modified
citrain/jenkins-templates/merge-clean.xml.tmpl (+0/-5)
citrain/merge_clean.py (+3/-5)
citrain/recipes/base.py (+0/-21)
tests/unit/test_recipe_base.py (+0/-33)
tests/unit/test_script_merge_clean.py (+9/-5)
To merge this branch: bzr merge lp:~robru/cupstream2distro/drop-merge-checks
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
CU2D maintainers Pending
Review via email: mp+278104@code.launchpad.net

Commit message

Drop redundant checks from merge job.

Description of the change

Now that the merge job can no longer be triggered by landers, it is only triggered automatically by the train, or manually by trainguards who want to force it. This means that the non-force option and all safety checks are redundant: migration job only triggers it after checking that merges are in good states and packages are at destination, so there's no point for the merge job to check that stuff a second time before proceeding with the merge.

If a trainguard is triggering it manually, it's *because* they want to force it, so there's no need to check this stuff and prevent them from merging.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:1223
http://jenkins.qa.ubuntu.com/job/cu2d-choo-choo-ci/912/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/cu2d-choo-choo-ci/912/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'citrain/jenkins-templates/merge-clean.xml.tmpl'
2--- citrain/jenkins-templates/merge-clean.xml.tmpl 2015-11-04 21:05:27 +0000
3+++ citrain/jenkins-templates/merge-clean.xml.tmpl 2015-11-20 06:37:47 +0000
4@@ -24,11 +24,6 @@
5 <hudson.model.ParametersDefinitionProperty>
6 <parameterDefinitions>
7 <hudson.model.BooleanParameterDefinition>
8- <name>FORCE</name>
9- <description>Proceed with merging even if versions not at destination.</description>
10- <defaultValue>false</defaultValue>
11- </hudson.model.BooleanParameterDefinition>
12- <hudson.model.BooleanParameterDefinition>
13 <name>DEBUG</name>
14 <description>Debug mode</description>
15 <defaultValue>false</defaultValue>
16
17=== modified file 'citrain/merge_clean.py'
18--- citrain/merge_clean.py 2015-11-17 18:30:50 +0000
19+++ citrain/merge_clean.py 2015-11-20 06:37:47 +0000
20@@ -21,9 +21,6 @@
21
22 Environment variables:
23
24-FORCE
25- Proceed with merge even if version is not at destination.
26-
27 SILONAME
28 Determines which silo to merge & clean.
29
30@@ -42,8 +39,9 @@
31
32 def merge(silo_state):
33 """Do the steps specific to merging & cleaning."""
34- manager = Manager(silo_state)
35- manager.do('validate', 'enumeration', 'merge', 'push', 'nuke')
36+ silo_state.status = 'Merging'
37+ silo_state.save_config()
38+ Manager(silo_state).do('merge', 'push', 'nuke')
39 silo_state.status = 'Landed'
40
41
42
43=== modified file 'citrain/recipes/base.py'
44--- citrain/recipes/base.py 2015-11-20 05:43:41 +0000
45+++ citrain/recipes/base.py 2015-11-20 06:37:47 +0000
46@@ -572,27 +572,6 @@
47 if cls.packagelist.lines:
48 cls.packagelist.write()
49
50- def enumeration_phase(self):
51- """Halt merge&clean job if packages not in destination.
52-
53- :raises MergeError: If PPA versions don't match destination archive.
54- """
55- msg = 'Checking that %s has reached destination archive...'
56- logging.info(msg, self.name)
57- ours = self.get_archive_version(self.silo_ppa)
58- dest = self.get_archive_version(self.dest)
59- log_value_of.ours('Silo PPA version')
60- log_value_of.dest('Archive version')
61- if ours != dest and env.FORCE != 'true':
62- msg = '{} mismatch: PPA has {}, destination archive has {}.'
63- self.failures.add(msg.format(self.name, ours, dest))
64-
65- @staticmethod
66- def post_enumeration_phase(silo_state):
67- """Indicate that merge is proceeding in dashboard status. """
68- silo_state.status = 'Merging.'
69- silo_state.save_config()
70-
71 @staticmethod
72 def post_nuke_phase(silo_state):
73 """Delete all packages from PPA and remove local silo dir."""
74
75=== modified file 'tests/unit/test_recipe_base.py'
76--- tests/unit/test_recipe_base.py 2015-11-20 05:43:41 +0000
77+++ tests/unit/test_recipe_base.py 2015-11-20 06:37:47 +0000
78@@ -875,39 +875,6 @@
79 self.assertEqual(silo_state.mock_calls, [])
80 BuildBase.packagelist.write.assert_called_once_with() # ONCE
81
82- def test_buildbase_enumeration_phase(self):
83- """Don't raise an exception when versions match."""
84- build = BuildBase('foo', self.series, self.dest, self.ppa)
85- build.get_archive_version = Mock(return_value='1.0')
86- build.enumeration_phase()
87- self.assertEqual(
88- build.get_archive_version.mock_calls, [
89- call(self.ppa), call(self.dest),
90- ])
91-
92- def test_buildbase_enumeration_phase_failed(self):
93- """Raise MergeError when ppa and dest versions don't match."""
94- versions = ['1+15.04.20150226-0ubuntu1', '1+15.04.20150226-0ubuntu2']
95- build = BuildBase('foo', self.series, self.dest, self.ppa)
96- build.get_archive_version = Mock(
97- side_effect=lambda *a, **kw: versions.pop())
98- build.enumeration_phase()
99- self.assertEqual(build.failures, set([
100- 'foo mismatch: PPA has 1+15.04.20150226-0ubuntu2, destination '
101- 'archive has 1+15.04.20150226-0ubuntu1.',
102- ]))
103- self.assertEqual(
104- build.get_archive_version.mock_calls, [
105- call(self.ppa), call(self.dest),
106- ])
107-
108- def test_buildbase_post_enumeration_phase(self):
109- """Set the silo as merging after enumeration has completed."""
110- silo_state = Mock()
111- BuildBase.post_enumeration_phase(silo_state)
112- self.assertEqual(silo_state.status, 'Merging.')
113- silo_state.save_config.assert_called_once_with()
114-
115 @patch('citrain.recipes.base.mkdir')
116 @patch('citrain.recipes.base.shutil')
117 @patch('citrain.recipes.base.SILO_DIR')
118
119=== modified file 'tests/unit/test_script_merge_clean.py'
120--- tests/unit/test_script_merge_clean.py 2015-11-17 18:30:50 +0000
121+++ tests/unit/test_script_merge_clean.py 2015-11-20 06:37:47 +0000
122@@ -16,7 +16,7 @@
123
124 """Tests for CI Train Merge & Clean script."""
125
126-from mock import Mock
127+from mock import Mock, call
128
129 from tests.unit import CITrainScriptTestCase
130
131@@ -38,9 +38,11 @@
132 mergemanager = self.script.Manager.return_value
133 self.assertIsNone(self.script.merge(silo_state))
134 self.script.Manager.assert_called_once_with(silo_state)
135- mergemanager.do.assert_called_once_with(
136- 'validate', 'enumeration', 'merge', 'push', 'nuke')
137+ mergemanager.do.assert_called_once_with('merge', 'push', 'nuke')
138 self.assertEqual(silo_state.status, 'Landed')
139+ self.assertEqual(silo_state.mock_calls, [
140+ call.save_config(),
141+ ])
142
143 def test_merge_failed(self):
144 """merge() doesn't catch exceptions."""
145@@ -52,6 +54,8 @@
146 with self.assertRaisesRegexp(MergeError, 'Merge&Clean failed: whoa'):
147 self.script.merge(silo_state)
148 self.script.Manager.assert_called_once_with(silo_state)
149- mergemanager.do.assert_called_once_with(
150- 'validate', 'enumeration', 'merge', 'push', 'nuke')
151+ mergemanager.do.assert_called_once_with('merge', 'push', 'nuke')
152 assert silo_state.status != 'Landed'
153+ self.assertEqual(silo_state.mock_calls, [
154+ call.save_config(),
155+ ])

Subscribers

People subscribed via source and target branches