← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~jugmac00/launchpad:add-support-for-conda-channels into launchpad:master

 

Jürgen Gmach has proposed merging ~jugmac00/launchpad:add-support-for-conda-channels into launchpad:master.

Commit message:
Add support for Conda channels

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jugmac00/launchpad/+git/launchpad/+merge/424376
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~jugmac00/launchpad:add-support-for-conda-channels into launchpad:master.
diff --git a/lib/lp/code/model/cibuildbehaviour.py b/lib/lp/code/model/cibuildbehaviour.py
index db860ac..16eece6 100644
--- a/lib/lp/code/model/cibuildbehaviour.py
+++ b/lib/lp/code/model/cibuildbehaviour.py
@@ -71,6 +71,21 @@ def build_apt_repositories(distribution_name: str) -> list:
     return rv
 
 
+def build_plugin_settings(distribution_name: str) -> dict:
+    # - load key/value pairs from JSON Object
+    # - replace authentication placeholder
+    try:
+        pairs = config["cibuild."+distribution_name]["plugin_settings"]
+    except NoSectionError:
+        return {}
+    if pairs is None:
+        return {}
+    rv = {}
+    for key, value in json.loads(pairs).items():
+        rv[key] = replace_auth_placeholder(value)
+    return rv
+
+
 @adapter(ICIBuild)
 @implementer(IBuildFarmJobBehaviour)
 class CIBuildBehaviour(BuilderProxyMixin, BuildFarmJobBehaviourBase):
@@ -140,6 +155,8 @@ class CIBuildBehaviour(BuilderProxyMixin, BuildFarmJobBehaviourBase):
                 distribution_name)
             args["apt_repositories"] = build_apt_repositories(
                 distribution_name)
+            args["plugin_settings"] = build_plugin_settings(
+                distribution_name)
         return args
 
     def verifySuccessfulBuild(self):
diff --git a/lib/lp/code/model/tests/test_cibuildbehaviour.py b/lib/lp/code/model/tests/test_cibuildbehaviour.py
index c30bb25..1d25aa3 100644
--- a/lib/lp/code/model/tests/test_cibuildbehaviour.py
+++ b/lib/lp/code/model/tests/test_cibuildbehaviour.py
@@ -324,7 +324,10 @@ class TestAsyncCIBuildBehaviour(StatsMixin, TestCIBuildBehaviourBase):
                 "SOME_PATH": "/bin/zip"}),
             apt_repositories=json.dumps([
                 "deb https://%(read_auth)s@xxxxxxxxxxxxxxxxxxxxx/artifactory/soss-deb-stable focal main universe",  # noqa: E501
-                "deb https://public_ppa.example.net/repository focal main"])
+                "deb https://public_ppa.example.net/repository focal main"]),
+            plugin_settings=json.dumps({
+                "miniconda_conda_channel": "https://%(read_auth)s@xxxxxxxxxxxxxxxxxxxxx/artifactory/soss-conda-stable-local/",  # noqa: E501
+                "foo": "bar"}),
         )
         package = self.factory.makeDistributionSourcePackage(
             distribution=self.factory.makeDistribution(name="soss")
@@ -358,14 +361,20 @@ class TestAsyncCIBuildBehaviour(StatsMixin, TestCIBuildBehaviourBase):
             "environment_variables": Equals(
                 {
                     "PIP_INDEX_URL":"https://user:pass@xxxxxxxxxxxxxxxxxxxxx/artifactory/api/pypi/soss-python-stable/simple/";,  # noqa: E501
-                    "SOME_PATH":"/bin/zip",
+                    "SOME_PATH": "/bin/zip",
                 }),
             "apt_repositories": Equals(
                 [
                     'deb https://user:pass@xxxxxxxxxxxxxxxxxxxxx/artifactory/soss-deb-stable focal main universe',  # noqa: E501
                     'deb https://public_ppa.example.net/repository focal main'
                 ]
-            )
+            ),
+            "plugin_settings": Equals(
+                {
+                    "miniconda_conda_channel": "https://user:pass@xxxxxxxxxxxxxxxxxxxxx/artifactory/soss-conda-stable-local/";,  # noqa: E501
+                    "foo": "bar",
+                }),
+
             }))
 
     @defer.inlineCallbacks
diff --git a/lib/lp/services/config/schema-lazr.conf b/lib/lp/services/config/schema-lazr.conf
index 5cb262c..428c447 100644
--- a/lib/lp/services/config/schema-lazr.conf
+++ b/lib/lp/services/config/schema-lazr.conf
@@ -245,6 +245,10 @@ environment_variables: none
 # example:
 # apt_repositories: ["deb https://%(read_auth)s@xxxxxxxxxxxxxxxxxxxxx/artifactory/soss-deb-stable focal main universe"]
 apt_repositories: none
+# value is a JSON Object
+# example:
+# plugin_settings: {"miniconda_conda_channel": "https://%(read_auth)s@xxxxxxxxxxxxxxxxxxxxx/artifactory/soss-conda-stable-local/"}
+plugin_settings: none
 
 
 [codebrowse]