← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~blr/launchpad-buildd/snap_http_proxy into lp:launchpad-buildd

 

Bayard 'kit' Randel has proposed merging lp:~blr/launchpad-buildd/snap_http_proxy into lp:launchpad-buildd.

Commit message:
Add http_proxy to buildsnap args.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~blr/launchpad-buildd/snap_http_proxy/+merge/273355

Add http_proxy environment variable to buildsnap args, providing time limited external access. 
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~blr/launchpad-buildd/snap_http_proxy into lp:launchpad-buildd.
=== modified file 'lpbuildd/snap.py'
--- lpbuildd/snap.py	2015-07-31 11:54:07 +0000
+++ lpbuildd/snap.py	2015-10-04 21:30:50 +0000
@@ -40,18 +40,32 @@
 
         self.name = extra_args["name"]
         self.branch = extra_args.get("branch")
+        self.build_cookie = extra_args.get("build_cookie")
         self.git_repository = extra_args.get("git_repository")
         self.git_path = extra_args.get("git_path")
+        self.proxy_host = extra_args.get("proxy_host")
+        self.proxy_port = extra_args.get("proxy_port")
+        self.proxy_token = extra_args.get("proxy_token")
 
         super(SnapBuildManager, self).initiate(files, chroot, extra_args)
 
     def doRunBuild(self):
         """Run the process to build the snap."""
+
         args = [
             "buildsnap",
             "--build-id", self._buildid,
             "--arch", self.arch_tag,
             ]
+        if self.proxy_token:
+            proxy_env = (
+                "http_proxy=http://{username}:{password}";
+                "@{host}:{port}".format(
+                    username=self.build_cookie,
+                    password=self.proxy_token,
+                    host=self.proxy_host,
+                    port=self.proxy_port))
+            args.insert(0, proxy_env)
         if self.branch is not None:
             args.extend(["--branch", self.branch])
         if self.git_repository is not None:


Follow ups