Merge ~cjwatson/launchpad:remove-oci-recipe-webhooks-enabled-feature-rule into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: ee95ea5c3d68663a671dd4c9b2c09fe7161485e3
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:remove-oci-recipe-webhooks-enabled-feature-rule
Merge into: launchpad:master
Diff against target: 368 lines (+36/-116)
10 files modified
lib/lp/oci/browser/ocirecipe.py (+1/-7)
lib/lp/oci/interfaces/ocirecipe.py (+0/-2)
lib/lp/oci/subscribers/ocirecipebuild.py (+18/-21)
lib/lp/oci/tests/test_ocirecipe.py (+3/-21)
lib/lp/oci/tests/test_ocirecipebuild.py (+4/-10)
lib/lp/oci/tests/test_ocirecipebuildjob.py (+2/-13)
lib/lp/services/webhooks/tests/test_browser.py (+2/-12)
lib/lp/services/webhooks/tests/test_job.py (+2/-10)
lib/lp/services/webhooks/tests/test_model.py (+2/-10)
lib/lp/services/webhooks/tests/test_webservice.py (+2/-10)
Reviewer Review Type Date Requested Status
Jürgen Gmach Approve
Review via email: mp+437043@code.launchpad.net

Commit message

Remove oci.recipe.webhooks.enabled feature rule

Description of the change

It's been enabled everywhere for some time.

To post a comment you must log in.
Revision history for this message
Jürgen Gmach (jugmac00) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/oci/browser/ocirecipe.py b/lib/lp/oci/browser/ocirecipe.py
2index 0b9f4d2..1e5e06e 100644
3--- a/lib/lp/oci/browser/ocirecipe.py
4+++ b/lib/lp/oci/browser/ocirecipe.py
5@@ -61,7 +61,6 @@ from lp.oci.interfaces.ocipushrule import (
6 )
7 from lp.oci.interfaces.ocirecipe import (
8 OCI_RECIPE_ALLOW_CREATE,
9- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG,
10 IOCIRecipe,
11 IOCIRecipeSet,
12 NoSuchOCIRecipe,
13@@ -157,12 +156,7 @@ class OCIRecipeNavigationMenu(NavigationMenu):
14
15 @enabled_with_permission("launchpad.Edit")
16 def webhooks(self):
17- return Link(
18- "+webhooks",
19- "Manage webhooks",
20- icon="edit",
21- enabled=bool(getFeatureFlag(OCI_RECIPE_WEBHOOKS_FEATURE_FLAG)),
22- )
23+ return Link("+webhooks", "Manage webhooks", icon="edit")
24
25 @enabled_with_permission("launchpad.Edit")
26 def delete(self):
27diff --git a/lib/lp/oci/interfaces/ocirecipe.py b/lib/lp/oci/interfaces/ocirecipe.py
28index 516a0c3..0fbb391 100644
29--- a/lib/lp/oci/interfaces/ocirecipe.py
30+++ b/lib/lp/oci/interfaces/ocirecipe.py
31@@ -21,7 +21,6 @@ __all__ = [
32 "OCIRecipePrivacyMismatch",
33 "OCI_RECIPE_ALLOW_CREATE",
34 "OCI_RECIPE_BUILD_DISTRIBUTION",
35- "OCI_RECIPE_WEBHOOKS_FEATURE_FLAG",
36 "UsingDistributionCredentials",
37 ]
38
39@@ -72,7 +71,6 @@ from lp.services.database.constants import DEFAULT
40 from lp.services.fields import PersonChoice, PublicPersonChoice
41 from lp.services.webhooks.interfaces import IWebhookTarget
42
43-OCI_RECIPE_WEBHOOKS_FEATURE_FLAG = "oci.recipe.webhooks.enabled"
44 OCI_RECIPE_ALLOW_CREATE = "oci.recipe.create.enabled"
45 OCI_RECIPE_BUILD_DISTRIBUTION = "oci.default_build_distribution"
46 OCI_RECIPE_PRIVATE_FEATURE_FLAG = "oci.recipe.allow_private"
47diff --git a/lib/lp/oci/subscribers/ocirecipebuild.py b/lib/lp/oci/subscribers/ocirecipebuild.py
48index abdc541..9ecc7cf 100644
49--- a/lib/lp/oci/subscribers/ocirecipebuild.py
50+++ b/lib/lp/oci/subscribers/ocirecipebuild.py
51@@ -6,10 +6,8 @@
52 from zope.component import getUtility
53
54 from lp.buildmaster.enums import BuildStatus
55-from lp.oci.interfaces.ocirecipe import OCI_RECIPE_WEBHOOKS_FEATURE_FLAG
56 from lp.oci.interfaces.ocirecipebuild import IOCIRecipeBuild
57 from lp.oci.interfaces.ocirecipebuildjob import IOCIRegistryUploadJobSource
58-from lp.services.features import getFeatureFlag
59 from lp.services.scripts import log
60 from lp.services.webapp.publisher import canonical_url
61 from lp.services.webhooks.interfaces import IWebhookSet
62@@ -17,26 +15,25 @@ from lp.services.webhooks.payload import compose_webhook_payload
63
64
65 def _trigger_oci_recipe_build_webhook(build, action):
66- if getFeatureFlag(OCI_RECIPE_WEBHOOKS_FEATURE_FLAG):
67- payload = {
68- "recipe_build": canonical_url(build, force_local_path=True),
69- "action": action,
70- }
71- payload.update(
72- compose_webhook_payload(
73- IOCIRecipeBuild,
74- build,
75- [
76- "recipe",
77- "build_request",
78- "status",
79- "registry_upload_status",
80- ],
81- )
82- )
83- getUtility(IWebhookSet).trigger(
84- build.recipe, "oci-recipe:build:0.1", payload
85+ payload = {
86+ "recipe_build": canonical_url(build, force_local_path=True),
87+ "action": action,
88+ }
89+ payload.update(
90+ compose_webhook_payload(
91+ IOCIRecipeBuild,
92+ build,
93+ [
94+ "recipe",
95+ "build_request",
96+ "status",
97+ "registry_upload_status",
98+ ],
99 )
100+ )
101+ getUtility(IWebhookSet).trigger(
102+ build.recipe, "oci-recipe:build:0.1", payload
103+ )
104
105
106 def oci_recipe_build_created(build, event):
107diff --git a/lib/lp/oci/tests/test_ocirecipe.py b/lib/lp/oci/tests/test_ocirecipe.py
108index bc212a2..1d2a7f4 100644
109--- a/lib/lp/oci/tests/test_ocirecipe.py
110+++ b/lib/lp/oci/tests/test_ocirecipe.py
111@@ -36,7 +36,6 @@ from lp.oci.interfaces.ocipushrule import (
112 from lp.oci.interfaces.ocirecipe import (
113 OCI_RECIPE_ALLOW_CREATE,
114 OCI_RECIPE_BUILD_DISTRIBUTION,
115- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG,
116 CannotModifyOCIRecipeProcessor,
117 DuplicateOCIRecipeName,
118 IOCIRecipe,
119@@ -275,12 +274,7 @@ class TestOCIRecipe(OCIConfigHelperMixin, TestCaseWithFactory):
120 def test_requestBuild_triggers_webhooks(self):
121 # Requesting a build triggers webhooks.
122 logger = self.useFixture(FakeLogger())
123- with FeatureFixture(
124- {
125- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on",
126- OCI_RECIPE_ALLOW_CREATE: "on",
127- }
128- ):
129+ with FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"}):
130 recipe = self.factory.makeOCIRecipe()
131 das = self.factory.makeDistroArchSeries()
132 hook = self.factory.makeWebhook(
133@@ -404,14 +398,7 @@ class TestOCIRecipe(OCIConfigHelperMixin, TestCaseWithFactory):
134 def test_requestBuildsFromJob_triggers_webhooks(self):
135 # requestBuildsFromJob triggers webhooks, and the payload includes a
136 # link to the build request.
137- self.useFixture(
138- FeatureFixture(
139- {
140- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on",
141- OCI_RECIPE_ALLOW_CREATE: "on",
142- }
143- )
144- )
145+ self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"}))
146 recipe = removeSecurityProxy(
147 self.factory.makeOCIRecipe(require_virtualized=False)
148 )
149@@ -507,12 +494,7 @@ class TestOCIRecipe(OCIConfigHelperMixin, TestCaseWithFactory):
150
151 def test_related_webhooks_deleted(self):
152 owner = self.factory.makePerson()
153- with FeatureFixture(
154- {
155- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on",
156- OCI_RECIPE_ALLOW_CREATE: "on",
157- }
158- ):
159+ with FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"}):
160 recipe = self.factory.makeOCIRecipe(registrant=owner, owner=owner)
161 webhook = self.factory.makeWebhook(target=recipe)
162 with person_logged_in(recipe.owner):
163diff --git a/lib/lp/oci/tests/test_ocirecipebuild.py b/lib/lp/oci/tests/test_ocirecipebuild.py
164index da54f9c..be8e24c 100644
165--- a/lib/lp/oci/tests/test_ocirecipebuild.py
166+++ b/lib/lp/oci/tests/test_ocirecipebuild.py
167@@ -28,10 +28,7 @@ from lp.buildmaster.enums import BuildStatus
168 from lp.buildmaster.interfaces.buildqueue import IBuildQueue
169 from lp.buildmaster.interfaces.packagebuild import IPackageBuild
170 from lp.buildmaster.interfaces.processor import IProcessorSet
171-from lp.oci.interfaces.ocirecipe import (
172- OCI_RECIPE_ALLOW_CREATE,
173- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG,
174-)
175+from lp.oci.interfaces.ocirecipe import OCI_RECIPE_ALLOW_CREATE
176 from lp.oci.interfaces.ocirecipebuild import (
177 CannotScheduleRegistryUpload,
178 IOCIFileSet,
179@@ -300,8 +297,7 @@ class TestOCIRecipeBuild(OCIConfigHelperMixin, TestCaseWithFactory):
180 hook = self.factory.makeWebhook(
181 target=self.build.recipe, event_types=["oci-recipe:build:0.1"]
182 )
183- with FeatureFixture({OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on"}):
184- self.build.updateStatus(BuildStatus.FULLYBUILT)
185+ self.build.updateStatus(BuildStatus.FULLYBUILT)
186 expected_payload = {
187 "recipe_build": Equals(
188 canonical_url(self.build, force_local_path=True)
189@@ -343,8 +339,7 @@ class TestOCIRecipeBuild(OCIConfigHelperMixin, TestCaseWithFactory):
190 hook = self.factory.makeWebhook(
191 target=self.build.recipe, event_types=["oci-recipe:build:0.1"]
192 )
193- with FeatureFixture({OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on"}):
194- self.build.updateStatus(BuildStatus.BUILDING)
195+ self.build.updateStatus(BuildStatus.BUILDING)
196 expected_logs = [
197 (
198 hook,
199@@ -627,8 +622,7 @@ class TestOCIRecipeBuild(OCIConfigHelperMixin, TestCaseWithFactory):
200 hook = self.factory.makeWebhook(
201 target=self.build.recipe, event_types=["oci-recipe:build:0.1"]
202 )
203- with FeatureFixture({OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on"}):
204- self.build.scheduleRegistryUpload()
205+ self.build.scheduleRegistryUpload()
206 expected_payload = {
207 "recipe_build": Equals(
208 canonical_url(self.build, force_local_path=True)
209diff --git a/lib/lp/oci/tests/test_ocirecipebuildjob.py b/lib/lp/oci/tests/test_ocirecipebuildjob.py
210index 9722ae4..a8a1778 100644
211--- a/lib/lp/oci/tests/test_ocirecipebuildjob.py
212+++ b/lib/lp/oci/tests/test_ocirecipebuildjob.py
213@@ -22,10 +22,7 @@ from zope.security.proxy import removeSecurityProxy
214
215 from lp.buildmaster.enums import BuildStatus
216 from lp.buildmaster.interfaces.processor import IProcessorSet
217-from lp.oci.interfaces.ocirecipe import (
218- OCI_RECIPE_ALLOW_CREATE,
219- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG,
220-)
221+from lp.oci.interfaces.ocirecipe import OCI_RECIPE_ALLOW_CREATE
222 from lp.oci.interfaces.ocirecipebuildjob import (
223 IOCIRecipeBuildJob,
224 IOCIRegistryUploadJob,
225@@ -212,14 +209,7 @@ class TestOCIRegistryUploadJob(
226
227 def setUp(self):
228 super().setUp()
229- self.useFixture(
230- FeatureFixture(
231- {
232- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on",
233- OCI_RECIPE_ALLOW_CREATE: "on",
234- }
235- )
236- )
237+ self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"}))
238 self.setUpStats()
239
240 def makeOCIRecipeBuild(self, **kwargs):
241@@ -641,7 +631,6 @@ class TestOCIRegistryUploadJobViaCelery(
242 self.useFixture(
243 FeatureFixture(
244 {
245- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on",
246 OCI_RECIPE_ALLOW_CREATE: "on",
247 "jobs.celery.enabled_classes": "OCIRegistryUploadJob",
248 }
249diff --git a/lib/lp/services/webhooks/tests/test_browser.py b/lib/lp/services/webhooks/tests/test_browser.py
250index fa282fc..65ba0c3 100644
251--- a/lib/lp/services/webhooks/tests/test_browser.py
252+++ b/lib/lp/services/webhooks/tests/test_browser.py
253@@ -14,10 +14,7 @@ from lp.charms.interfaces.charmrecipe import (
254 CHARM_RECIPE_ALLOW_CREATE,
255 CHARM_RECIPE_WEBHOOKS_FEATURE_FLAG,
256 )
257-from lp.oci.interfaces.ocirecipe import (
258- OCI_RECIPE_ALLOW_CREATE,
259- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG,
260-)
261+from lp.oci.interfaces.ocirecipe import OCI_RECIPE_ALLOW_CREATE
262 from lp.services.features.testing import FeatureFixture
263 from lp.services.webapp.interfaces import IPlacelessAuthUtility
264 from lp.services.webapp.publisher import canonical_url
265@@ -142,14 +139,7 @@ class OCIRecipeTestHelpers:
266 super().setUp()
267
268 def makeTarget(self):
269- self.useFixture(
270- FeatureFixture(
271- {
272- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on",
273- OCI_RECIPE_ALLOW_CREATE: "on",
274- }
275- )
276- )
277+ self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"}))
278 owner = self.factory.makePerson()
279 return self.factory.makeOCIRecipe(registrant=owner, owner=owner)
280
281diff --git a/lib/lp/services/webhooks/tests/test_job.py b/lib/lp/services/webhooks/tests/test_job.py
282index f7e5e71..d80b634 100644
283--- a/lib/lp/services/webhooks/tests/test_job.py
284+++ b/lib/lp/services/webhooks/tests/test_job.py
285@@ -37,10 +37,7 @@ from lp.charms.interfaces.charmrecipe import (
286 CHARM_RECIPE_ALLOW_CREATE,
287 CHARM_RECIPE_WEBHOOKS_FEATURE_FLAG,
288 )
289-from lp.oci.interfaces.ocirecipe import (
290- OCI_RECIPE_ALLOW_CREATE,
291- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG,
292-)
293+from lp.oci.interfaces.ocirecipe import OCI_RECIPE_ALLOW_CREATE
294 from lp.services.database.interfaces import IStore
295 from lp.services.features.testing import FeatureFixture
296 from lp.services.job.interfaces.job import JobStatus
297@@ -417,12 +414,7 @@ class TestWebhookDeliveryJob(TestCaseWithFactory):
298 def test_oci_recipe__repr__(self):
299 # `WebhookDeliveryJob` objects for OCI recipes have an informative
300 # __repr__.
301- with FeatureFixture(
302- {
303- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on",
304- OCI_RECIPE_ALLOW_CREATE: "on",
305- }
306- ):
307+ with FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"}):
308 recipe = self.factory.makeOCIRecipe()
309 hook = self.factory.makeWebhook(target=recipe)
310 job = WebhookDeliveryJob.create(hook, "test", payload={"foo": "bar"})
311diff --git a/lib/lp/services/webhooks/tests/test_model.py b/lib/lp/services/webhooks/tests/test_model.py
312index cfa0a35..85d2c40 100644
313--- a/lib/lp/services/webhooks/tests/test_model.py
314+++ b/lib/lp/services/webhooks/tests/test_model.py
315@@ -13,10 +13,7 @@ from lp.charms.interfaces.charmrecipe import (
316 CHARM_RECIPE_ALLOW_CREATE,
317 CHARM_RECIPE_WEBHOOKS_FEATURE_FLAG,
318 )
319-from lp.oci.interfaces.ocirecipe import (
320- OCI_RECIPE_ALLOW_CREATE,
321- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG,
322-)
323+from lp.oci.interfaces.ocirecipe import OCI_RECIPE_ALLOW_CREATE
324 from lp.registry.enums import BranchSharingPolicy
325 from lp.services.database.interfaces import IStore
326 from lp.services.features.testing import FeatureFixture
327@@ -500,12 +497,7 @@ class TestWebhookSetOCIRecipe(TestWebhookSetBase, TestCaseWithFactory):
328 if owner is None:
329 owner = self.factory.makePerson()
330
331- with FeatureFixture(
332- {
333- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on",
334- OCI_RECIPE_ALLOW_CREATE: "on",
335- }
336- ):
337+ with FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"}):
338 return self.factory.makeOCIRecipe(
339 registrant=owner, owner=owner, **kwargs
340 )
341diff --git a/lib/lp/services/webhooks/tests/test_webservice.py b/lib/lp/services/webhooks/tests/test_webservice.py
342index fed30a0..86d577a 100644
343--- a/lib/lp/services/webhooks/tests/test_webservice.py
344+++ b/lib/lp/services/webhooks/tests/test_webservice.py
345@@ -23,10 +23,7 @@ from lp.charms.interfaces.charmrecipe import (
346 CHARM_RECIPE_ALLOW_CREATE,
347 CHARM_RECIPE_WEBHOOKS_FEATURE_FLAG,
348 )
349-from lp.oci.interfaces.ocirecipe import (
350- OCI_RECIPE_ALLOW_CREATE,
351- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG,
352-)
353+from lp.oci.interfaces.ocirecipe import OCI_RECIPE_ALLOW_CREATE
354 from lp.services.features.testing import FeatureFixture
355 from lp.services.webapp.interfaces import OAuthPermission
356 from lp.soyuz.interfaces.livefs import (
357@@ -498,12 +495,7 @@ class TestWebhookTargetOCIRecipe(TestWebhookTargetBase, TestCaseWithFactory):
358
359 def makeTarget(self):
360 owner = self.factory.makePerson()
361- with FeatureFixture(
362- {
363- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on",
364- OCI_RECIPE_ALLOW_CREATE: "on",
365- }
366- ):
367+ with FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"}):
368 return self.factory.makeOCIRecipe(registrant=owner, owner=owner)
369
370

Subscribers

People subscribed via source and target branches

to status/vote changes: