← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~pelpsi/launchpad:propagate-launchpad-context-to-builders into launchpad:master

 

Simone Pelosi has proposed merging ~pelpsi/launchpad:propagate-launchpad-context-to-builders into launchpad:master.

Commit message:
Propagate launchpad context to builders
    
This change is required in order to use the correct craft URLs.
The starcraft team will set the craft urls accordingly.


Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~pelpsi/launchpad/+git/launchpad/+merge/475535
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~pelpsi/launchpad:propagate-launchpad-context-to-builders into launchpad:master.
diff --git a/lib/lp/buildmaster/model/buildfarmjobbehaviour.py b/lib/lp/buildmaster/model/buildfarmjobbehaviour.py
index 4dd258a..f44d203 100644
--- a/lib/lp/buildmaster/model/buildfarmjobbehaviour.py
+++ b/lib/lp/buildmaster/model/buildfarmjobbehaviour.py
@@ -98,6 +98,14 @@ class BuildFarmJobBehaviourBase:
 
     def extraBuildArgs(self, logger=None) -> BuildArgs:
         """The default behaviour is to send only common extra arguments."""
+        launchpad_urls = {
+            "launchpad.net": "production",
+            "qastaging.launchpad.net": "qastaging",
+            "staging.launchpad.net": "staging",
+            "launchpad.test": "develop",
+        }
+        launchpad_server_url = config.vhost.mainsite.hostname
+        launchpad_instance = launchpad_urls.get(launchpad_server_url)
         return {
             "arch_tag": self.distro_arch_series.architecturetag,
             "archive_private": self.archive.private,
@@ -107,6 +115,8 @@ class BuildFarmJobBehaviourBase:
             ),
             "fast_cleanup": self._builder.virtualized,
             "series": self.distro_arch_series.distroseries.name,
+            "launchpad_instance": launchpad_instance,
+            "launchpad_server_url": launchpad_server_url,
         }
 
     @defer.inlineCallbacks
diff --git a/lib/lp/charms/tests/test_charmrecipebuildbehaviour.py b/lib/lp/charms/tests/test_charmrecipebuildbehaviour.py
index aaff515..1512ccc 100644
--- a/lib/lp/charms/tests/test_charmrecipebuildbehaviour.py
+++ b/lib/lp/charms/tests/test_charmrecipebuildbehaviour.py
@@ -316,6 +316,8 @@ class TestAsyncCharmRecipeBuildBehaviour(
                     "series": Equals("unstable"),
                     "trusted_keys": Equals(expected_trusted_keys),
                     "use_fetch_service": Is(False),
+                    "launchpad_instance": Equals("develop"),
+                    "launchpad_server_url": Equals("launchpad.test"),
                 }
             ),
         )
@@ -358,6 +360,8 @@ class TestAsyncCharmRecipeBuildBehaviour(
                     "series": Equals("unstable"),
                     "trusted_keys": Equals(expected_trusted_keys),
                     "use_fetch_service": Is(False),
+                    "launchpad_instance": Equals("develop"),
+                    "launchpad_server_url": Equals("launchpad.test"),
                 }
             ),
         )
diff --git a/lib/lp/code/model/tests/test_cibuildbehaviour.py b/lib/lp/code/model/tests/test_cibuildbehaviour.py
index d0c2beb..8364fb8 100644
--- a/lib/lp/code/model/tests/test_cibuildbehaviour.py
+++ b/lib/lp/code/model/tests/test_cibuildbehaviour.py
@@ -312,6 +312,8 @@ class TestAsyncCIBuildBehaviour(StatsMixin, TestCIBuildBehaviourBase):
                     "series": Equals(job.build.distro_series.name),
                     "trusted_keys": Equals(expected_trusted_keys),
                     "use_fetch_service": Is(False),
+                    "launchpad_instance": Equals("develop"),
+                    "launchpad_server_url": Equals("launchpad.test"),
                 }
             ),
         )
@@ -469,6 +471,8 @@ class TestAsyncCIBuildBehaviour(StatsMixin, TestCIBuildBehaviourBase):
                     ),
                     "secrets": Equals({"soss_read_auth": "user:pass"}),
                     "use_fetch_service": Is(False),
+                    "launchpad_instance": Equals("develop"),
+                    "launchpad_server_url": Equals("launchpad.test"),
                 }
             ),
         )
@@ -651,6 +655,8 @@ class TestAsyncCIBuildBehaviour(StatsMixin, TestCIBuildBehaviourBase):
                     "series": Equals(job.build.distro_series.name),
                     "trusted_keys": Equals(expected_trusted_keys),
                     "use_fetch_service": Is(False),
+                    "launchpad_instance": Equals("develop"),
+                    "launchpad_server_url": Equals("launchpad.test"),
                 }
             ),
         )
diff --git a/lib/lp/crafts/tests/test_craftrecipebuildbehaviour.py b/lib/lp/crafts/tests/test_craftrecipebuildbehaviour.py
index e3cb8dc..83c0058 100644
--- a/lib/lp/crafts/tests/test_craftrecipebuildbehaviour.py
+++ b/lib/lp/crafts/tests/test_craftrecipebuildbehaviour.py
@@ -324,6 +324,8 @@ class TestAsyncCraftRecipeBuildBehaviour(
                     "series": Equals("unstable"),
                     "trusted_keys": Equals(expected_trusted_keys),
                     "use_fetch_service": Is(False),
+                    "launchpad_instance": Equals("develop"),
+                    "launchpad_server_url": Equals("launchpad.test"),
                 }
             ),
         )
@@ -367,6 +369,8 @@ class TestAsyncCraftRecipeBuildBehaviour(
                     "series": Equals("unstable"),
                     "trusted_keys": Equals(expected_trusted_keys),
                     "use_fetch_service": Is(False),
+                    "launchpad_instance": Equals("develop"),
+                    "launchpad_server_url": Equals("launchpad.test"),
                 }
             ),
         )
@@ -500,6 +504,8 @@ class TestAsyncCraftRecipeBuildBehaviour(
                     "series": Equals("unstable"),
                     "trusted_keys": Equals(expected_trusted_keys),
                     "use_fetch_service": Is(False),
+                    "launchpad_instance": Equals("develop"),
+                    "launchpad_server_url": Equals("launchpad.test"),
                 }
             ),
         )
diff --git a/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py b/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py
index 6d74c78..0e2c1a4 100644
--- a/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py
+++ b/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py
@@ -522,6 +522,8 @@ class TestAsyncOCIRecipeBuildBehaviour(
                         }
                     ),
                     "use_fetch_service": Is(False),
+                    "launchpad_instance": Equals("develop"),
+                    "launchpad_server_url": Equals("launchpad.test"),
                 }
             ),
         )
@@ -626,6 +628,8 @@ class TestAsyncOCIRecipeBuildBehaviour(
                         }
                     ),
                     "use_fetch_service": Is(False),
+                    "launchpad_instance": Equals("develop"),
+                    "launchpad_server_url": Equals("launchpad.test"),
                 }
             ),
         )
@@ -687,6 +691,8 @@ class TestAsyncOCIRecipeBuildBehaviour(
                         }
                     ),
                     "use_fetch_service": Is(False),
+                    "launchpad_instance": Equals("develop"),
+                    "launchpad_server_url": Equals("launchpad.test"),
                 }
             ),
         )
diff --git a/lib/lp/rocks/tests/test_rockrecipebuildbehaviour.py b/lib/lp/rocks/tests/test_rockrecipebuildbehaviour.py
index 8310102..70fe487 100644
--- a/lib/lp/rocks/tests/test_rockrecipebuildbehaviour.py
+++ b/lib/lp/rocks/tests/test_rockrecipebuildbehaviour.py
@@ -324,6 +324,8 @@ class TestAsyncRockRecipeBuildBehaviour(
                     "series": Equals("unstable"),
                     "trusted_keys": Equals(expected_trusted_keys),
                     "use_fetch_service": Is(False),
+                    "launchpad_instance": Equals("develop"),
+                    "launchpad_server_url": Equals("launchpad.test"),
                 }
             ),
         )
@@ -367,6 +369,8 @@ class TestAsyncRockRecipeBuildBehaviour(
                     "series": Equals("unstable"),
                     "trusted_keys": Equals(expected_trusted_keys),
                     "use_fetch_service": Is(False),
+                    "launchpad_instance": Equals("develop"),
+                    "launchpad_server_url": Equals("launchpad.test"),
                 }
             ),
         )
@@ -501,6 +505,8 @@ class TestAsyncRockRecipeBuildBehaviour(
                     "series": Equals("unstable"),
                     "trusted_keys": Equals(expected_trusted_keys),
                     "use_fetch_service": Is(False),
+                    "launchpad_instance": Equals("develop"),
+                    "launchpad_server_url": Equals("launchpad.test"),
                 }
             ),
         )
diff --git a/lib/lp/snappy/tests/test_snapbuildbehaviour.py b/lib/lp/snappy/tests/test_snapbuildbehaviour.py
index 1686a1d..255cd96 100644
--- a/lib/lp/snappy/tests/test_snapbuildbehaviour.py
+++ b/lib/lp/snappy/tests/test_snapbuildbehaviour.py
@@ -829,6 +829,8 @@ class TestAsyncSnapBuildBehaviourBuilderProxy(
                     "trusted_keys": Equals(expected_trusted_keys),
                     "target_architectures": Equals(["i386"]),
                     "use_fetch_service": Is(None),
+                    "launchpad_instance": Equals("develop"),
+                    "launchpad_server_url": Equals("launchpad.test"),
                 }
             ),
         )
@@ -883,6 +885,8 @@ class TestAsyncSnapBuildBehaviourBuilderProxy(
                     "trusted_keys": Equals(expected_trusted_keys),
                     "target_architectures": Equals(["i386"]),
                     "use_fetch_service": Is(None),
+                    "launchpad_instance": Equals("develop"),
+                    "launchpad_server_url": Equals("launchpad.test"),
                 }
             ),
         )
@@ -926,6 +930,8 @@ class TestAsyncSnapBuildBehaviourBuilderProxy(
                     "trusted_keys": Equals(expected_trusted_keys),
                     "target_architectures": Equals(["i386"]),
                     "use_fetch_service": Is(None),
+                    "launchpad_instance": Equals("develop"),
+                    "launchpad_server_url": Equals("launchpad.test"),
                 }
             ),
         )
@@ -1000,6 +1006,8 @@ class TestAsyncSnapBuildBehaviourBuilderProxy(
                     "trusted_keys": Equals(expected_trusted_keys),
                     "target_architectures": Equals(["i386"]),
                     "use_fetch_service": Is(None),
+                    "launchpad_instance": Equals("develop"),
+                    "launchpad_server_url": Equals("launchpad.test"),
                 }
             ),
         )
@@ -1046,6 +1054,8 @@ class TestAsyncSnapBuildBehaviourBuilderProxy(
                     "trusted_keys": Equals(expected_trusted_keys),
                     "target_architectures": Equals(["i386"]),
                     "use_fetch_service": Is(None),
+                    "launchpad_instance": Equals("develop"),
+                    "launchpad_server_url": Equals("launchpad.test"),
                 }
             ),
         )
@@ -1089,6 +1099,8 @@ class TestAsyncSnapBuildBehaviourBuilderProxy(
                     "trusted_keys": Equals(expected_trusted_keys),
                     "target_architectures": Equals(["i386"]),
                     "use_fetch_service": Is(None),
+                    "launchpad_instance": Equals("develop"),
+                    "launchpad_server_url": Equals("launchpad.test"),
                 }
             ),
         )

Follow ups