← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/snap-build-send-private into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/snap-build-send-private into lp:launchpad.

Commit message:
Send "private": True to launchpad-buildd for builds of private snaps.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1639975 in Launchpad itself: "support for building private snaps"
  https://bugs.launchpad.net/launchpad/+bug/1639975

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/snap-build-send-private/+merge/364067

Before we can do anything else with private snap builds, we need to ensure that launchpad-buildd doesn't leak information via SNAPCRAFT_BUILD_INFO, and that means it needs to be told whether the build is private or public.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/snap-build-send-private into lp:launchpad.
=== modified file 'lib/lp/snappy/model/snapbuildbehaviour.py'
--- lib/lp/snappy/model/snapbuildbehaviour.py	2019-02-07 19:17:52 +0000
+++ lib/lp/snappy/model/snapbuildbehaviour.py	2019-03-06 22:35:09 +0000
@@ -141,6 +141,7 @@
                 "Source branch/repository for ~%s/%s has been deleted." %
                 (build.snap.owner.name, build.snap.name))
         args["build_source_tarball"] = build.snap.build_source_tarball
+        args["private"] = build.snap.private
         defer.returnValue(args)
 
     @defer.inlineCallbacks

=== modified file 'lib/lp/snappy/tests/test_snapbuildbehaviour.py'
--- lib/lp/snappy/tests/test_snapbuildbehaviour.py	2019-02-07 19:17:52 +0000
+++ lib/lp/snappy/tests/test_snapbuildbehaviour.py	2019-03-06 22:35:09 +0000
@@ -82,6 +82,7 @@
     )
 from lp.services.webapp import canonical_url
 from lp.snappy.interfaces.snap import (
+    SNAP_PRIVATE_FEATURE_FLAG,
     SNAP_SNAPCRAFT_CHANNEL_FEATURE_FLAG,
     SnapBuildArchiveOwnerMismatch,
     )
@@ -396,6 +397,7 @@
             "build_url": Equals(canonical_url(job.build)),
             "fast_cleanup": Is(True),
             "name": Equals("test-snap"),
+            "private": Is(False),
             "proxy_url": self.getProxyURLMatcher(job),
             "revocation_endpoint": self.getRevocationEndpointMatcher(job),
             "series": Equals("unstable"),
@@ -422,6 +424,7 @@
             "git_repository": Equals(ref.repository.git_https_url),
             "git_path": Equals(ref.name),
             "name": Equals("test-snap"),
+            "private": Is(False),
             "proxy_url": self.getProxyURLMatcher(job),
             "revocation_endpoint": self.getRevocationEndpointMatcher(job),
             "series": Equals("unstable"),
@@ -448,6 +451,7 @@
             "fast_cleanup": Is(True),
             "git_repository": Equals(ref.repository.git_https_url),
             "name": Equals("test-snap"),
+            "private": Is(False),
             "proxy_url": self.getProxyURLMatcher(job),
             "revocation_endpoint": self.getRevocationEndpointMatcher(job),
             "series": Equals("unstable"),
@@ -476,6 +480,7 @@
             "git_repository": Equals(url),
             "git_path": Equals("master"),
             "name": Equals("test-snap"),
+            "private": Is(False),
             "proxy_url": self.getProxyURLMatcher(job),
             "revocation_endpoint": self.getRevocationEndpointMatcher(job),
             "series": Equals("unstable"),
@@ -502,6 +507,7 @@
             "fast_cleanup": Is(True),
             "git_repository": Equals(url),
             "name": Equals("test-snap"),
+            "private": Is(False),
             "proxy_url": self.getProxyURLMatcher(job),
             "revocation_endpoint": self.getRevocationEndpointMatcher(job),
             "series": Equals("unstable"),
@@ -600,6 +606,15 @@
         self.assertTrue(args["build_source_tarball"])
 
     @defer.inlineCallbacks
+    def test_extraBuildArgs_private(self):
+        # If the snap is private, extraBuildArgs sends the appropriate
+        # arguments.
+        self.useFixture(FeatureFixture({SNAP_PRIVATE_FEATURE_FLAG: "on"}))
+        job = self.makeJob(private=True)
+        args = yield job.extraBuildArgs()
+        self.assertTrue(args["private"])
+
+    @defer.inlineCallbacks
     def test_composeBuildRequest_proxy_url_set(self):
         job = self.makeJob()
         build_request = yield job.composeBuildRequest(None)


Follow ups