← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad-buildd/marshal-build-request-fields into lp:launchpad-buildd

 

Colin Watson has proposed merging lp:~cjwatson/launchpad-buildd/marshal-build-request-fields into lp:launchpad-buildd.

Commit message:
lpbuildd.snap: Pass build_request_id and build_request_timestamp through to the backend.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-buildd/marshal-build-request-fields/+merge/367094

Otherwise the changes to lpbuildd.target.build_snap don't do much as they never see the relevant parameters.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad-buildd/marshal-build-request-fields into lp:launchpad-buildd.
=== modified file 'debian/changelog'
--- debian/changelog	2019-04-26 13:25:07 +0000
+++ debian/changelog	2019-05-08 10:33:31 +0000
@@ -1,3 +1,10 @@
+launchpad-buildd (172) UNRELEASED; urgency=medium
+
+  * lpbuildd.snap: Pass build_request_id and build_request_timestamp through
+    to the backend.
+
+ -- Colin Watson <cjwatson@xxxxxxxxxx>  Wed, 08 May 2019 11:31:10 +0100
+
 launchpad-buildd (171) xenial; urgency=medium
 
   [ Matias Bordese ]

=== modified file 'lpbuildd/snap.py'
--- lpbuildd/snap.py	2019-03-12 16:09:00 +0000
+++ lpbuildd/snap.py	2019-05-08 10:33:31 +0000
@@ -258,6 +258,9 @@
         """Initiate a build with a given set of files and chroot."""
         self.name = extra_args["name"]
         self.channels = extra_args.get("channels", {})
+        self.build_request_id = extra_args.get("build_request_id")
+        self.build_request_timestamp = extra_args.get(
+            "build_request_timestamp")
         self.build_url = extra_args.get("build_url")
         self.branch = extra_args.get("branch")
         self.git_repository = extra_args.get("git_repository")
@@ -337,6 +340,11 @@
                 "Channels requested for unknown snaps: %s" %
                 " ".join(sorted(unknown_snaps)),
                 file=sys.stderr)
+        if self.build_request_id:
+            args.extend(["--build-request-id", str(self.build_request_id)])
+        if self.build_request_timestamp:
+            args.extend(
+                ["--build-request-timestamp", self.build_request_timestamp])
         if self.build_url:
             args.extend(["--build-url", self.build_url])
         args.extend(self.startProxy())

=== modified file 'lpbuildd/tests/test_snap.py'
--- lpbuildd/tests/test_snap.py	2019-03-12 16:42:45 +0000
+++ lpbuildd/tests/test_snap.py	2019-05-08 10:33:31 +0000
@@ -78,8 +78,6 @@
             "series": "xenial",
             "arch_tag": "i386",
             "name": "test-snap",
-            "git_repository": "https://git.launchpad.dev/~example/+git/snap";,
-            "git_path": "master",
             }
         if args is not None:
             extra_args.update(args)
@@ -98,8 +96,6 @@
         expected_command = [
             "sharepath/bin/in-target", "in-target", "buildsnap",
             "--backend=lxd", "--series=xenial", "--arch=i386", self.buildid,
-            "--git-repository", "https://git.launchpad.dev/~example/+git/snap";,
-            "--git-path", "master",
             ]
         if options is not None:
             expected_command.extend(options)
@@ -122,7 +118,21 @@
     @defer.inlineCallbacks
     def test_iterate(self):
         # The build manager iterates a normal build from start to finish.
-        yield self.startBuild()
+        args = {
+            "build_request_id": 13,
+            "build_request_timestamp": "2018-04-13T14:50:02Z",
+            "build_url": "https://launchpad.example/build";,
+            "git_repository": "https://git.launchpad.dev/~example/+git/snap";,
+            "git_path": "master",
+            }
+        expected_options = [
+            "--build-request-id", "13",
+            "--build-request-timestamp", "2018-04-13T14:50:02Z",
+            "--build-url", "https://launchpad.example/build";,
+            "--git-repository", "https://git.launchpad.dev/~example/+git/snap";,
+            "--git-path", "master",
+            ]
+        yield self.startBuild(args, expected_options)
 
         log_path = os.path.join(self.buildmanager._cachepath, "buildlog")
         with open(log_path, "w") as log:
@@ -162,7 +172,15 @@
     def test_iterate_with_manifest(self):
         # The build manager iterates a build that uploads a manifest from
         # start to finish.
-        yield self.startBuild()
+        args = {
+            "git_repository": "https://git.launchpad.dev/~example/+git/snap";,
+            "git_path": "master",
+            }
+        expected_options = [
+            "--git-repository", "https://git.launchpad.dev/~example/+git/snap";,
+            "--git-path", "master",
+            ]
+        yield self.startBuild(args, expected_options)
 
         log_path = os.path.join(self.buildmanager._cachepath, "buildlog")
         with open(log_path, "w") as log:
@@ -205,8 +223,17 @@
     def test_iterate_with_build_source_tarball(self):
         # The build manager iterates a build that uploads a source tarball
         # from start to finish.
-        yield self.startBuild(
-            {"build_source_tarball": True}, ["--build-source-tarball"])
+        args = {
+            "git_repository": "https://git.launchpad.dev/~example/+git/snap";,
+            "git_path": "master",
+            "build_source_tarball": True,
+            }
+        expected_options = [
+            "--git-repository", "https://git.launchpad.dev/~example/+git/snap";,
+            "--git-path", "master",
+            "--build-source-tarball",
+            ]
+        yield self.startBuild(args, expected_options)
 
         log_path = os.path.join(self.buildmanager._cachepath, "buildlog")
         with open(log_path, "w") as log:
@@ -248,7 +275,17 @@
     @defer.inlineCallbacks
     def test_iterate_private(self):
         # The build manager iterates a private build from start to finish.
-        yield self.startBuild({"private": True}, ["--private"])
+        args = {
+            "git_repository": "https://git.launchpad.dev/~example/+git/snap";,
+            "git_path": "master",
+            "private": True,
+            }
+        expected_options = [
+            "--git-repository", "https://git.launchpad.dev/~example/+git/snap";,
+            "--git-path", "master",
+            "--private",
+            ]
+        yield self.startBuild(args, expected_options)
 
         log_path = os.path.join(self.buildmanager._cachepath, "buildlog")
         with open(log_path, "w") as log: