← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~jugmac00/launchpad:revert-exposing-build-metadata-url into launchpad:master

 

Jürgen Gmach has proposed merging ~jugmac00/launchpad:revert-exposing-build-metadata-url into launchpad:master.

Commit message:
Revert "Expose CharmRecipeBuild.build_metadata_url"


Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jugmac00/launchpad/+git/launchpad/+merge/490528

This reverts commit 32255c2750feb86557322d62d843060da64225e7.
   
We have discovered possible performance regressions.

-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~jugmac00/launchpad:revert-exposing-build-metadata-url into launchpad:master.
diff --git a/lib/lp/charms/interfaces/charmrecipebuild.py b/lib/lp/charms/interfaces/charmrecipebuild.py
index db978c3..e744368 100644
--- a/lib/lp/charms/interfaces/charmrecipebuild.py
+++ b/lib/lp/charms/interfaces/charmrecipebuild.py
@@ -280,18 +280,6 @@ class ICharmRecipeBuildView(IPackageBuildView):
 
         :return: A collection of URLs for this build."""
 
-    build_metadata_url = exported(
-        TextLine(
-            title=_("URL of the build metadata file"),
-            description=_(
-                "URL of the metadata file generated by the fetch service, if "
-                "it exists."
-            ),
-            required=False,
-            readonly=True,
-        )
-    )
-
 
 class ICharmRecipeBuildEdit(IBuildFarmJobEdit):
     """`ICharmRecipeBuild` methods that require launchpad.Edit."""
diff --git a/lib/lp/charms/model/charmrecipebuild.py b/lib/lp/charms/model/charmrecipebuild.py
index 7a1648a..3e6e95b 100644
--- a/lib/lp/charms/model/charmrecipebuild.py
+++ b/lib/lp/charms/model/charmrecipebuild.py
@@ -31,7 +31,6 @@ from zope.component import getUtility
 from zope.interface import implementer
 
 from lp.app.errors import NotFoundError
-from lp.buildmaster.builderproxy import BUILD_METADATA_FILENAME_FORMAT
 from lp.buildmaster.enums import (
     BuildFarmJobType,
     BuildQueueStatus,
@@ -416,16 +415,6 @@ class CharmRecipeBuild(PackageBuildMixin, StormBase):
             for _, lfa, _ in self.getFiles()
         ]
 
-    @property
-    def build_metadata_url(self):
-        metadata_filename = BUILD_METADATA_FILENAME_FORMAT.format(
-            build_id=self.build_cookie
-        )
-        for url in self.getFileUrls():
-            if url.endswith(metadata_filename):
-                return url
-        return None
-
     def addFile(self, lfa):
         """See `ICharmRecipeBuild`."""
         charm_file = CharmFile(build=self, library_file=lfa)
diff --git a/lib/lp/charms/tests/test_charmrecipebuild.py b/lib/lp/charms/tests/test_charmrecipebuild.py
index a11d7fc..4b59b37 100644
--- a/lib/lp/charms/tests/test_charmrecipebuild.py
+++ b/lib/lp/charms/tests/test_charmrecipebuild.py
@@ -1035,50 +1035,3 @@ class TestCharmRecipeBuildWebservice(TestCaseWithFactory):
         browser.raiseHttpErrors = False
         for file_url in file_urls:
             self.assertCanOpenRedirectedUrl(browser, file_url)
-
-    def test_build_metadata_url(self):
-        # API clients can fetch the metadata from the build, generated by the
-        # fetch service
-        db_build = self.factory.makeCharmRecipeBuild(requester=self.person)
-        metadata_filename = f"{db_build.build_cookie}_metadata.json"
-        with person_logged_in(self.person):
-            file_1 = self.factory.makeLibraryFileAlias(
-                content="some_json",
-                filename="test_file.json",
-            )
-            db_build.addFile(file_1)
-            metadata_file = self.factory.makeLibraryFileAlias(
-                content="some_json",
-                filename=metadata_filename,
-            )
-            db_build.addFile(metadata_file)
-            file_2 = self.factory.makeLibraryFileAlias(
-                content="some_json",
-                filename="another_test_file.tar",
-            )
-            db_build.addFile(file_2)
-        build_url = api_url(db_build)
-        logout()
-        build = self.webservice.get(build_url).jsonBody()
-        self.assertIsNotNone(build["build_metadata_url"])
-        self.assertEndsWith(build["build_metadata_url"], metadata_filename)
-
-    def test_build_metadata_url_no_metadata_file(self):
-        # The attribute `build_metadata_url` returns None when metadata file
-        # does not exist.
-        db_build = self.factory.makeCharmRecipeBuild(requester=self.person)
-        with person_logged_in(self.person):
-            file_1 = self.factory.makeLibraryFileAlias(
-                content="some_json",
-                filename="test_file.json",
-            )
-            db_build.addFile(file_1)
-            file_2 = self.factory.makeLibraryFileAlias(
-                content="some_json",
-                filename="another_test_file.tar",
-            )
-            db_build.addFile(file_2)
-        build_url = api_url(db_build)
-        logout()
-        build = self.webservice.get(build_url).jsonBody()
-        self.assertIsNone(build["build_metadata_url"])