← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~jugmac00/launchpad:pass-cibuild-secrets-to-launchpad-buildd into launchpad:master

 

Jürgen Gmach has proposed merging ~jugmac00/launchpad:pass-cibuild-secrets-to-launchpad-buildd into launchpad:master.

Commit message:
Pass cibuild secrets to launchpad-buildd

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jugmac00/launchpad/+git/launchpad/+merge/426497
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~jugmac00/launchpad:pass-cibuild-secrets-to-launchpad-buildd into launchpad:master.
diff --git a/lib/lp/code/model/cibuildbehaviour.py b/lib/lp/code/model/cibuildbehaviour.py
index 16eece6..737c2ab 100644
--- a/lib/lp/code/model/cibuildbehaviour.py
+++ b/lib/lp/code/model/cibuildbehaviour.py
@@ -86,6 +86,17 @@ def build_plugin_settings(distribution_name: str) -> dict:
     return rv
 
 
+def build_secrets(distribution_name: str) -> dict:
+    # For now: load and return the soss read credentials
+    # In future this could also load secrets from repository settings.
+    try:
+        credentials = config["artifactory"]["read_credentials"]
+        # import pdb;pdb.set_trace()
+    except NoSectionError:
+        return {}
+    return {"soss_read_auth": credentials}
+
+
 @adapter(ICIBuild)
 @implementer(IBuildFarmJobBehaviour)
 class CIBuildBehaviour(BuilderProxyMixin, BuildFarmJobBehaviourBase):
@@ -157,6 +168,9 @@ class CIBuildBehaviour(BuilderProxyMixin, BuildFarmJobBehaviourBase):
                 distribution_name)
             args["plugin_settings"] = build_plugin_settings(
                 distribution_name)
+            args["secrets"] = build_secrets(
+                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 efbbd0b..59b3a16 100644
--- a/lib/lp/code/model/tests/test_cibuildbehaviour.py
+++ b/lib/lp/code/model/tests/test_cibuildbehaviour.py
@@ -384,6 +384,7 @@ class TestAsyncCIBuildBehaviour(StatsMixin, TestCIBuildBehaviourBase):
                     "miniconda_conda_channel": "https://user:pass@xxxxxxxxxxxxxxxxxxxxx/artifactory/soss-conda-stable-local/";,  # noqa: E501
                     "foo": "bar",
                 }),
+            "secrets": Equals({"soss_read_auth": "user:pass"})
 
             }))