launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #29651
[Merge] ~cjwatson/launchpad:remove-oci-recipe-webhooks-enabled-feature-rule into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:remove-oci-recipe-webhooks-enabled-feature-rule into launchpad:master.
Commit message:
Remove oci.recipe.webhooks.enabled feature rule
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/437043
It's been enabled everywhere for some time.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:remove-oci-recipe-webhooks-enabled-feature-rule into launchpad:master.
diff --git a/lib/lp/oci/browser/ocirecipe.py b/lib/lp/oci/browser/ocirecipe.py
index 0b9f4d2..1e5e06e 100644
--- a/lib/lp/oci/browser/ocirecipe.py
+++ b/lib/lp/oci/browser/ocirecipe.py
@@ -61,7 +61,6 @@ from lp.oci.interfaces.ocipushrule import (
)
from lp.oci.interfaces.ocirecipe import (
OCI_RECIPE_ALLOW_CREATE,
- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG,
IOCIRecipe,
IOCIRecipeSet,
NoSuchOCIRecipe,
@@ -157,12 +156,7 @@ class OCIRecipeNavigationMenu(NavigationMenu):
@enabled_with_permission("launchpad.Edit")
def webhooks(self):
- return Link(
- "+webhooks",
- "Manage webhooks",
- icon="edit",
- enabled=bool(getFeatureFlag(OCI_RECIPE_WEBHOOKS_FEATURE_FLAG)),
- )
+ return Link("+webhooks", "Manage webhooks", icon="edit")
@enabled_with_permission("launchpad.Edit")
def delete(self):
diff --git a/lib/lp/oci/interfaces/ocirecipe.py b/lib/lp/oci/interfaces/ocirecipe.py
index 516a0c3..0fbb391 100644
--- a/lib/lp/oci/interfaces/ocirecipe.py
+++ b/lib/lp/oci/interfaces/ocirecipe.py
@@ -21,7 +21,6 @@ __all__ = [
"OCIRecipePrivacyMismatch",
"OCI_RECIPE_ALLOW_CREATE",
"OCI_RECIPE_BUILD_DISTRIBUTION",
- "OCI_RECIPE_WEBHOOKS_FEATURE_FLAG",
"UsingDistributionCredentials",
]
@@ -72,7 +71,6 @@ from lp.services.database.constants import DEFAULT
from lp.services.fields import PersonChoice, PublicPersonChoice
from lp.services.webhooks.interfaces import IWebhookTarget
-OCI_RECIPE_WEBHOOKS_FEATURE_FLAG = "oci.recipe.webhooks.enabled"
OCI_RECIPE_ALLOW_CREATE = "oci.recipe.create.enabled"
OCI_RECIPE_BUILD_DISTRIBUTION = "oci.default_build_distribution"
OCI_RECIPE_PRIVATE_FEATURE_FLAG = "oci.recipe.allow_private"
diff --git a/lib/lp/oci/subscribers/ocirecipebuild.py b/lib/lp/oci/subscribers/ocirecipebuild.py
index abdc541..9ecc7cf 100644
--- a/lib/lp/oci/subscribers/ocirecipebuild.py
+++ b/lib/lp/oci/subscribers/ocirecipebuild.py
@@ -6,10 +6,8 @@
from zope.component import getUtility
from lp.buildmaster.enums import BuildStatus
-from lp.oci.interfaces.ocirecipe import OCI_RECIPE_WEBHOOKS_FEATURE_FLAG
from lp.oci.interfaces.ocirecipebuild import IOCIRecipeBuild
from lp.oci.interfaces.ocirecipebuildjob import IOCIRegistryUploadJobSource
-from lp.services.features import getFeatureFlag
from lp.services.scripts import log
from lp.services.webapp.publisher import canonical_url
from lp.services.webhooks.interfaces import IWebhookSet
@@ -17,26 +15,25 @@ from lp.services.webhooks.payload import compose_webhook_payload
def _trigger_oci_recipe_build_webhook(build, action):
- if getFeatureFlag(OCI_RECIPE_WEBHOOKS_FEATURE_FLAG):
- payload = {
- "recipe_build": canonical_url(build, force_local_path=True),
- "action": action,
- }
- payload.update(
- compose_webhook_payload(
- IOCIRecipeBuild,
- build,
- [
- "recipe",
- "build_request",
- "status",
- "registry_upload_status",
- ],
- )
- )
- getUtility(IWebhookSet).trigger(
- build.recipe, "oci-recipe:build:0.1", payload
+ payload = {
+ "recipe_build": canonical_url(build, force_local_path=True),
+ "action": action,
+ }
+ payload.update(
+ compose_webhook_payload(
+ IOCIRecipeBuild,
+ build,
+ [
+ "recipe",
+ "build_request",
+ "status",
+ "registry_upload_status",
+ ],
)
+ )
+ getUtility(IWebhookSet).trigger(
+ build.recipe, "oci-recipe:build:0.1", payload
+ )
def oci_recipe_build_created(build, event):
diff --git a/lib/lp/oci/tests/test_ocirecipe.py b/lib/lp/oci/tests/test_ocirecipe.py
index bc212a2..1d2a7f4 100644
--- a/lib/lp/oci/tests/test_ocirecipe.py
+++ b/lib/lp/oci/tests/test_ocirecipe.py
@@ -36,7 +36,6 @@ from lp.oci.interfaces.ocipushrule import (
from lp.oci.interfaces.ocirecipe import (
OCI_RECIPE_ALLOW_CREATE,
OCI_RECIPE_BUILD_DISTRIBUTION,
- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG,
CannotModifyOCIRecipeProcessor,
DuplicateOCIRecipeName,
IOCIRecipe,
@@ -275,12 +274,7 @@ class TestOCIRecipe(OCIConfigHelperMixin, TestCaseWithFactory):
def test_requestBuild_triggers_webhooks(self):
# Requesting a build triggers webhooks.
logger = self.useFixture(FakeLogger())
- with FeatureFixture(
- {
- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on",
- OCI_RECIPE_ALLOW_CREATE: "on",
- }
- ):
+ with FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"}):
recipe = self.factory.makeOCIRecipe()
das = self.factory.makeDistroArchSeries()
hook = self.factory.makeWebhook(
@@ -404,14 +398,7 @@ class TestOCIRecipe(OCIConfigHelperMixin, TestCaseWithFactory):
def test_requestBuildsFromJob_triggers_webhooks(self):
# requestBuildsFromJob triggers webhooks, and the payload includes a
# link to the build request.
- self.useFixture(
- FeatureFixture(
- {
- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on",
- OCI_RECIPE_ALLOW_CREATE: "on",
- }
- )
- )
+ self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"}))
recipe = removeSecurityProxy(
self.factory.makeOCIRecipe(require_virtualized=False)
)
@@ -507,12 +494,7 @@ class TestOCIRecipe(OCIConfigHelperMixin, TestCaseWithFactory):
def test_related_webhooks_deleted(self):
owner = self.factory.makePerson()
- with FeatureFixture(
- {
- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on",
- OCI_RECIPE_ALLOW_CREATE: "on",
- }
- ):
+ with FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"}):
recipe = self.factory.makeOCIRecipe(registrant=owner, owner=owner)
webhook = self.factory.makeWebhook(target=recipe)
with person_logged_in(recipe.owner):
diff --git a/lib/lp/oci/tests/test_ocirecipebuild.py b/lib/lp/oci/tests/test_ocirecipebuild.py
index da54f9c..be8e24c 100644
--- a/lib/lp/oci/tests/test_ocirecipebuild.py
+++ b/lib/lp/oci/tests/test_ocirecipebuild.py
@@ -28,10 +28,7 @@ from lp.buildmaster.enums import BuildStatus
from lp.buildmaster.interfaces.buildqueue import IBuildQueue
from lp.buildmaster.interfaces.packagebuild import IPackageBuild
from lp.buildmaster.interfaces.processor import IProcessorSet
-from lp.oci.interfaces.ocirecipe import (
- OCI_RECIPE_ALLOW_CREATE,
- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG,
-)
+from lp.oci.interfaces.ocirecipe import OCI_RECIPE_ALLOW_CREATE
from lp.oci.interfaces.ocirecipebuild import (
CannotScheduleRegistryUpload,
IOCIFileSet,
@@ -300,8 +297,7 @@ class TestOCIRecipeBuild(OCIConfigHelperMixin, TestCaseWithFactory):
hook = self.factory.makeWebhook(
target=self.build.recipe, event_types=["oci-recipe:build:0.1"]
)
- with FeatureFixture({OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on"}):
- self.build.updateStatus(BuildStatus.FULLYBUILT)
+ self.build.updateStatus(BuildStatus.FULLYBUILT)
expected_payload = {
"recipe_build": Equals(
canonical_url(self.build, force_local_path=True)
@@ -343,8 +339,7 @@ class TestOCIRecipeBuild(OCIConfigHelperMixin, TestCaseWithFactory):
hook = self.factory.makeWebhook(
target=self.build.recipe, event_types=["oci-recipe:build:0.1"]
)
- with FeatureFixture({OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on"}):
- self.build.updateStatus(BuildStatus.BUILDING)
+ self.build.updateStatus(BuildStatus.BUILDING)
expected_logs = [
(
hook,
@@ -627,8 +622,7 @@ class TestOCIRecipeBuild(OCIConfigHelperMixin, TestCaseWithFactory):
hook = self.factory.makeWebhook(
target=self.build.recipe, event_types=["oci-recipe:build:0.1"]
)
- with FeatureFixture({OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on"}):
- self.build.scheduleRegistryUpload()
+ self.build.scheduleRegistryUpload()
expected_payload = {
"recipe_build": Equals(
canonical_url(self.build, force_local_path=True)
diff --git a/lib/lp/oci/tests/test_ocirecipebuildjob.py b/lib/lp/oci/tests/test_ocirecipebuildjob.py
index 9722ae4..a8a1778 100644
--- a/lib/lp/oci/tests/test_ocirecipebuildjob.py
+++ b/lib/lp/oci/tests/test_ocirecipebuildjob.py
@@ -22,10 +22,7 @@ from zope.security.proxy import removeSecurityProxy
from lp.buildmaster.enums import BuildStatus
from lp.buildmaster.interfaces.processor import IProcessorSet
-from lp.oci.interfaces.ocirecipe import (
- OCI_RECIPE_ALLOW_CREATE,
- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG,
-)
+from lp.oci.interfaces.ocirecipe import OCI_RECIPE_ALLOW_CREATE
from lp.oci.interfaces.ocirecipebuildjob import (
IOCIRecipeBuildJob,
IOCIRegistryUploadJob,
@@ -212,14 +209,7 @@ class TestOCIRegistryUploadJob(
def setUp(self):
super().setUp()
- self.useFixture(
- FeatureFixture(
- {
- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on",
- OCI_RECIPE_ALLOW_CREATE: "on",
- }
- )
- )
+ self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"}))
self.setUpStats()
def makeOCIRecipeBuild(self, **kwargs):
@@ -641,7 +631,6 @@ class TestOCIRegistryUploadJobViaCelery(
self.useFixture(
FeatureFixture(
{
- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on",
OCI_RECIPE_ALLOW_CREATE: "on",
"jobs.celery.enabled_classes": "OCIRegistryUploadJob",
}
diff --git a/lib/lp/services/webhooks/tests/test_browser.py b/lib/lp/services/webhooks/tests/test_browser.py
index fa282fc..65ba0c3 100644
--- a/lib/lp/services/webhooks/tests/test_browser.py
+++ b/lib/lp/services/webhooks/tests/test_browser.py
@@ -14,10 +14,7 @@ from lp.charms.interfaces.charmrecipe import (
CHARM_RECIPE_ALLOW_CREATE,
CHARM_RECIPE_WEBHOOKS_FEATURE_FLAG,
)
-from lp.oci.interfaces.ocirecipe import (
- OCI_RECIPE_ALLOW_CREATE,
- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG,
-)
+from lp.oci.interfaces.ocirecipe import OCI_RECIPE_ALLOW_CREATE
from lp.services.features.testing import FeatureFixture
from lp.services.webapp.interfaces import IPlacelessAuthUtility
from lp.services.webapp.publisher import canonical_url
@@ -142,14 +139,7 @@ class OCIRecipeTestHelpers:
super().setUp()
def makeTarget(self):
- self.useFixture(
- FeatureFixture(
- {
- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on",
- OCI_RECIPE_ALLOW_CREATE: "on",
- }
- )
- )
+ self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"}))
owner = self.factory.makePerson()
return self.factory.makeOCIRecipe(registrant=owner, owner=owner)
diff --git a/lib/lp/services/webhooks/tests/test_job.py b/lib/lp/services/webhooks/tests/test_job.py
index f7e5e71..d80b634 100644
--- a/lib/lp/services/webhooks/tests/test_job.py
+++ b/lib/lp/services/webhooks/tests/test_job.py
@@ -37,10 +37,7 @@ from lp.charms.interfaces.charmrecipe import (
CHARM_RECIPE_ALLOW_CREATE,
CHARM_RECIPE_WEBHOOKS_FEATURE_FLAG,
)
-from lp.oci.interfaces.ocirecipe import (
- OCI_RECIPE_ALLOW_CREATE,
- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG,
-)
+from lp.oci.interfaces.ocirecipe import OCI_RECIPE_ALLOW_CREATE
from lp.services.database.interfaces import IStore
from lp.services.features.testing import FeatureFixture
from lp.services.job.interfaces.job import JobStatus
@@ -417,12 +414,7 @@ class TestWebhookDeliveryJob(TestCaseWithFactory):
def test_oci_recipe__repr__(self):
# `WebhookDeliveryJob` objects for OCI recipes have an informative
# __repr__.
- with FeatureFixture(
- {
- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on",
- OCI_RECIPE_ALLOW_CREATE: "on",
- }
- ):
+ with FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"}):
recipe = self.factory.makeOCIRecipe()
hook = self.factory.makeWebhook(target=recipe)
job = WebhookDeliveryJob.create(hook, "test", payload={"foo": "bar"})
diff --git a/lib/lp/services/webhooks/tests/test_model.py b/lib/lp/services/webhooks/tests/test_model.py
index cfa0a35..85d2c40 100644
--- a/lib/lp/services/webhooks/tests/test_model.py
+++ b/lib/lp/services/webhooks/tests/test_model.py
@@ -13,10 +13,7 @@ from lp.charms.interfaces.charmrecipe import (
CHARM_RECIPE_ALLOW_CREATE,
CHARM_RECIPE_WEBHOOKS_FEATURE_FLAG,
)
-from lp.oci.interfaces.ocirecipe import (
- OCI_RECIPE_ALLOW_CREATE,
- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG,
-)
+from lp.oci.interfaces.ocirecipe import OCI_RECIPE_ALLOW_CREATE
from lp.registry.enums import BranchSharingPolicy
from lp.services.database.interfaces import IStore
from lp.services.features.testing import FeatureFixture
@@ -500,12 +497,7 @@ class TestWebhookSetOCIRecipe(TestWebhookSetBase, TestCaseWithFactory):
if owner is None:
owner = self.factory.makePerson()
- with FeatureFixture(
- {
- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on",
- OCI_RECIPE_ALLOW_CREATE: "on",
- }
- ):
+ with FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"}):
return self.factory.makeOCIRecipe(
registrant=owner, owner=owner, **kwargs
)
diff --git a/lib/lp/services/webhooks/tests/test_webservice.py b/lib/lp/services/webhooks/tests/test_webservice.py
index fed30a0..86d577a 100644
--- a/lib/lp/services/webhooks/tests/test_webservice.py
+++ b/lib/lp/services/webhooks/tests/test_webservice.py
@@ -23,10 +23,7 @@ from lp.charms.interfaces.charmrecipe import (
CHARM_RECIPE_ALLOW_CREATE,
CHARM_RECIPE_WEBHOOKS_FEATURE_FLAG,
)
-from lp.oci.interfaces.ocirecipe import (
- OCI_RECIPE_ALLOW_CREATE,
- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG,
-)
+from lp.oci.interfaces.ocirecipe import OCI_RECIPE_ALLOW_CREATE
from lp.services.features.testing import FeatureFixture
from lp.services.webapp.interfaces import OAuthPermission
from lp.soyuz.interfaces.livefs import (
@@ -498,12 +495,7 @@ class TestWebhookTargetOCIRecipe(TestWebhookTargetBase, TestCaseWithFactory):
def makeTarget(self):
owner = self.factory.makePerson()
- with FeatureFixture(
- {
- OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on",
- OCI_RECIPE_ALLOW_CREATE: "on",
- }
- ):
+ with FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"}):
return self.factory.makeOCIRecipe(registrant=owner, owner=owner)