← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~jugmac00/launchpad-buildd:set-env-variable-for-requests into launchpad-buildd:master

 

Jürgen Gmach has proposed merging ~jugmac00/launchpad-buildd:set-env-variable-for-requests into launchpad-buildd:master.

Commit message:
Enable craft to fetch files via enabling `REQUESTS_CA_BUNDLE`.

This is necessary when running the craft tools with the fetch service.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jugmac00/launchpad-buildd/+git/launchpad-buildd/+merge/477054
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~jugmac00/launchpad-buildd:set-env-variable-for-requests into launchpad-buildd:master.
diff --git a/debian/changelog b/debian/changelog
index fce35d4..6444ec9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+launchpad-buildd (248) UNRELEASED; urgency=medium
+
+  * Set REQUESTS_CA_BUNDLE so craft tools can fetch files via requests.
+
+ -- Jürgen Gmach <juergen.gmach@xxxxxxxxxxxxx>  Fri, 22 Nov 2024 13:53:23 +0100
+
 launchpad-buildd (247) focal; urgency=medium
 
   * Wait for pre-seeded snaps to seed and boot up before running LXD commands
diff --git a/lpbuildd/target/proxy.py b/lpbuildd/target/proxy.py
index 893e749..81b473f 100644
--- a/lpbuildd/target/proxy.py
+++ b/lpbuildd/target/proxy.py
@@ -126,6 +126,7 @@ class BuilderProxyOperationMixin:
         # Avoid circular import using __class__.__name__
         if use_fetch_service:
             full_env["CARGO_HTTP_CAINFO"] = self.mitm_certificate_path
+            full_env["REQUESTS_CA_BUNDLE"] = self.mitm_certificate_path
             full_env["GOPROXY"] = "direct"
 
         return full_env
diff --git a/lpbuildd/target/tests/test_build_craft.py b/lpbuildd/target/tests/test_build_craft.py
index d7f66a8..ed37e86 100644
--- a/lpbuildd/target/tests/test_build_craft.py
+++ b/lpbuildd/target/tests/test_build_craft.py
@@ -820,6 +820,9 @@ class TestBuildCraft(TestCase):
             "CARGO_HTTP_CAINFO": (
                 "/usr/local/share/ca-certificates/local-ca.crt"
             ),
+            "REQUESTS_CA_BUNDLE": (
+                "/usr/local/share/ca-certificates/local-ca.crt"
+            ),
             "GOPROXY": "direct",
         }
         self.assertThat(
@@ -1016,6 +1019,9 @@ class TestBuildCraft(TestCase):
             "CARGO_HTTP_CAINFO": (
                 "/usr/local/share/ca-certificates/local-ca.crt"
             ),
+            "REQUESTS_CA_BUNDLE": (
+                "/usr/local/share/ca-certificates/local-ca.crt"
+            ),
             "GOPROXY": "direct",
         }
         self.assertThat(
diff --git a/lpbuildd/target/tests/test_build_rock.py b/lpbuildd/target/tests/test_build_rock.py
index 3112549..bd3b0e9 100644
--- a/lpbuildd/target/tests/test_build_rock.py
+++ b/lpbuildd/target/tests/test_build_rock.py
@@ -817,6 +817,9 @@ class TestBuildRock(TestCase):
             "CARGO_HTTP_CAINFO": (
                 "/usr/local/share/ca-certificates/local-ca.crt"
             ),
+            "REQUESTS_CA_BUNDLE": (
+                "/usr/local/share/ca-certificates/local-ca.crt"
+            ),
             "GOPROXY": "direct",
         }
         self.assertThat(
@@ -1013,6 +1016,9 @@ class TestBuildRock(TestCase):
             "CARGO_HTTP_CAINFO": (
                 "/usr/local/share/ca-certificates/local-ca.crt"
             ),
+            "REQUESTS_CA_BUNDLE": (
+                "/usr/local/share/ca-certificates/local-ca.crt"
+            ),
             "GOPROXY": "direct",
         }
         self.assertThat(
diff --git a/lpbuildd/target/tests/test_build_snap.py b/lpbuildd/target/tests/test_build_snap.py
index aef2b82..133ba60 100644
--- a/lpbuildd/target/tests/test_build_snap.py
+++ b/lpbuildd/target/tests/test_build_snap.py
@@ -756,6 +756,9 @@ class TestBuildSnap(TestCase):
             "CARGO_HTTP_CAINFO": (
                 "/usr/local/share/ca-certificates/local-ca.crt"
             ),
+            "REQUESTS_CA_BUNDLE": (
+                "/usr/local/share/ca-certificates/local-ca.crt"
+            ),
             "GOPROXY": "direct",
         }
         self.assertThat(