launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #31538
[Merge] ~pelpsi/launchpad-buildd:fix-buildproxy-invocation-for-snaps into launchpad-buildd:master
Simone Pelosi has proposed merging ~pelpsi/launchpad-buildd:fix-buildproxy-invocation-for-snaps into launchpad-buildd:master.
Commit message:
snap: pass use_fetch_service flag to build_proxy_environment
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~pelpsi/launchpad-buildd/+git/launchpad-buildd/+merge/473782
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~pelpsi/launchpad-buildd:fix-buildproxy-invocation-for-snaps into launchpad-buildd:master.
diff --git a/lpbuildd/target/build_snap.py b/lpbuildd/target/build_snap.py
index 1418f18..cfdf5ad 100644
--- a/lpbuildd/target/build_snap.py
+++ b/lpbuildd/target/build_snap.py
@@ -175,7 +175,10 @@ class BuildSnap(
def repo(self):
"""Collect git or bzr branch."""
logger.info("Running repo phase...")
- env = self.build_proxy_environment(proxy_url=self.args.proxy_url)
+ env = self.build_proxy_environment(
+ proxy_url=self.args.proxy_url,
+ use_fetch_service=self.args.use_fetch_service
+ )
self.vcs_fetch(self.args.name, cwd="/build", env=env)
self.vcs_update_status(os.path.join("/build", self.args.name))
@@ -193,7 +196,10 @@ class BuildSnap(
def pull(self):
"""Run pull phase."""
logger.info("Running pull phase...")
- env = self.build_proxy_environment(proxy_url=self.args.proxy_url)
+ env = self.build_proxy_environment(
+ proxy_url=self.args.proxy_url,
+ use_fetch_service=self.args.use_fetch_service
+ )
env["SNAPCRAFT_LOCAL_SOURCES"] = "1"
env["SNAPCRAFT_SETUP_CORE"] = "1"
if not self.args.private:
@@ -239,7 +245,10 @@ class BuildSnap(
def build(self):
"""Run all build, stage and snap phases."""
logger.info("Running build phase...")
- env = self.build_proxy_environment(proxy_url=self.args.proxy_url)
+ env = self.build_proxy_environment(
+ proxy_url=self.args.proxy_url,
+ use_fetch_service=self.args.use_fetch_service
+ )
if not self.args.private:
env["SNAPCRAFT_BUILD_INFO"] = "1"
env["SNAPCRAFT_IMAGE_INFO"] = self.image_info
diff --git a/lpbuildd/target/tests/test_build_snap.py b/lpbuildd/target/tests/test_build_snap.py
index 3a7bc6c..da7a7ba 100644
--- a/lpbuildd/target/tests/test_build_snap.py
+++ b/lpbuildd/target/tests/test_build_snap.py
@@ -640,6 +640,69 @@ class TestBuildSnap(TestCase):
with open(status_path) as status:
self.assertEqual({"revision_id": "0" * 40}, json.load(status))
+ def test_repo_fetch_service(self):
+ args = [
+ "buildsnap",
+ "--backend=fake",
+ "--series=xenial",
+ "--arch=amd64",
+ "1",
+ "--git-repository",
+ "lp:foo",
+ "--proxy-url",
+ "http://proxy.example:3128/",
+ "test-snap",
+ "--use_fetch_service",
+ ]
+ build_snap = parse_args(args=args).operation
+ build_snap.backend.build_path = self.useFixture(TempDir()).path
+ build_snap.backend.run = FakeRevisionID("0" * 40)
+ build_snap.repo()
+ env = {
+ "http_proxy": "http://proxy.example:3128/",
+ "https_proxy": "http://proxy.example:3128/",
+ "GIT_PROXY_COMMAND": "/usr/local/bin/lpbuildd-git-proxy",
+ "SNAPPY_STORE_NO_CDN": "1",
+ 'GIT_PROTOCOL': 'version=2'
+ }
+ self.assertThat(
+ build_snap.backend.run.calls,
+ MatchesListwise(
+ [
+ RanBuildCommand(
+ ["git", "clone", "-n", "lp:foo", "test-snap"],
+ cwd="/build",
+ **env,
+ ),
+ RanBuildCommand(
+ ["git", "checkout", "-q", "HEAD"],
+ cwd="/build/test-snap",
+ **env,
+ ),
+ RanBuildCommand(
+ [
+ "git",
+ "submodule",
+ "update",
+ "--init",
+ "--recursive",
+ ],
+ cwd="/build/test-snap",
+ **env,
+ ),
+ RanBuildCommand(
+ ["git", "rev-parse", "HEAD^{}"],
+ cwd="/build/test-snap",
+ get_output=True,
+ universal_newlines=True,
+ ),
+ ]
+ ),
+ )
+ status_path = os.path.join(build_snap.backend.build_path, "status")
+ with open(status_path) as status:
+ self.assertEqual({"revision_id": "0" * 40}, json.load(status))
+
def test_pull(self):
args = [
"buildsnap",
Follow ups