launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #28498
[Merge] ~jugmac00/launchpad:base_url_has_a_scheme into launchpad:master
Jürgen Gmach has proposed merging ~jugmac00/launchpad:base_url_has_a_scheme into launchpad:master.
Commit message:
Fix building Artifactoy URLs
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~jugmac00/launchpad/+git/launchpad/+merge/423380
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~jugmac00/launchpad:base_url_has_a_scheme into launchpad:master.
diff --git a/lib/lp/code/model/cibuildbehaviour.py b/lib/lp/code/model/cibuildbehaviour.py
index 8bdb499..db860ac 100644
--- a/lib/lp/code/model/cibuildbehaviour.py
+++ b/lib/lp/code/model/cibuildbehaviour.py
@@ -37,19 +37,13 @@ from lp.soyuz.adapters.archivedependencies import (
)
-def replace_placeholders(s: str) -> str:
- # replace both `read_auth` and `base_url` from input value
- read_auth = config.artifactory.read_credentials
- base_url = config.artifactory.base_url
- return s % {
- "read_auth": read_auth,
- "base_url": base_url,
- }
+def replace_auth_placeholder(s: str) -> str:
+ return s % {"read_auth": config.artifactory.read_credentials}
def build_environment_variables(distribution_name: str) -> dict:
# - load key/value pairs from JSON Object
- # - replace authentication placeholders
+ # - replace authentication placeholder
try:
pairs = config["cibuild."+distribution_name]["environment_variables"]
except NoSectionError:
@@ -58,13 +52,13 @@ def build_environment_variables(distribution_name: str) -> dict:
return {}
rv = {}
for key, value in json.loads(pairs).items():
- rv[key] = replace_placeholders(value)
+ rv[key] = replace_auth_placeholder(value)
return rv
def build_apt_repositories(distribution_name: str) -> list:
# - load apt repository configuration lines from JSON Array
- # - replace authentication placeholders
+ # - replace authentication placeholder
try:
lines = config["cibuild."+distribution_name]["apt_repositories"]
except NoSectionError:
@@ -73,7 +67,7 @@ def build_apt_repositories(distribution_name: str) -> list:
return []
rv = []
for line in json.loads(lines):
- rv.append(replace_placeholders(line))
+ rv.append(replace_auth_placeholder(line))
return rv
diff --git a/lib/lp/code/model/tests/test_cibuildbehaviour.py b/lib/lp/code/model/tests/test_cibuildbehaviour.py
index 17b78e9..bd0f397 100644
--- a/lib/lp/code/model/tests/test_cibuildbehaviour.py
+++ b/lib/lp/code/model/tests/test_cibuildbehaviour.py
@@ -320,10 +320,10 @@ class TestAsyncCIBuildBehaviour(StatsMixin, TestCIBuildBehaviourBase):
self.pushConfig(
"cibuild.soss",
environment_variables=json.dumps({
- "PIP_INDEX_URL": "http://%(read_auth)s@%(base_url)s/simple",
+ "PIP_INDEX_URL": "https://%(read_auth)s@xxxxxxxxxxxxxxxxxxxxx/artifactory/soss-python-stable/simple/", # noqa: E501
"SOME_PATH": "/bin/zip"}),
apt_repositories=json.dumps([
- "deb https://%(read_auth)s@%(base_url)s/repository focal main",
+ "deb https://%(read_auth)s@xxxxxxxxxxxxxxxxxxxxx/artifactory/soss-deb-stable focal main universe", # noqa: E501
"deb https://public_ppa.example.net/repository focal main"])
)
package = self.factory.makeDistributionSourcePackage(
@@ -357,12 +357,12 @@ class TestAsyncCIBuildBehaviour(StatsMixin, TestCIBuildBehaviourBase):
"trusted_keys": Equals(expected_trusted_keys),
"environment_variables": Equals(
{
- "PIP_INDEX_URL":"http://user:pass@xxxxxxxxxxxxxxxxxxxxxxxxx/simple", # noqa: E501
+ "PIP_INDEX_URL":"https://user:pass@xxxxxxxxxxxxxxxxxxxxx/artifactory/soss-python-stable/simple/", # noqa: E501
"SOME_PATH":"/bin/zip",
}),
"apt_repositories": Equals(
[
- 'deb https://user:pass@xxxxxxxxxxxxxxxxxxxxxxxxx/repository focal main', # noqa: E501
+ 'deb https://user:pass@xxxxxxxxxxxxxxxxxxxxx/artifactory/soss-deb-stable focal main universe', # noqa: E501
'deb https://public_ppa.example.net/repository focal main'
]
)
diff --git a/lib/lp/services/config/schema-lazr.conf b/lib/lp/services/config/schema-lazr.conf
index 511ad24..40db0e1 100644
--- a/lib/lp/services/config/schema-lazr.conf
+++ b/lib/lp/services/config/schema-lazr.conf
@@ -35,6 +35,7 @@ run_parts_location: none
[artifactory]
# Base URL for publishing suitably-configured archives to Artifactory.
+# example: https://canonical.example.com/artifactory
# datatype: string
base_url: none
@@ -238,11 +239,15 @@ salsa.debian.org.token: none
[cibuild.soss]
# value is a JSON Object
# example:
+<<<<<<< lib/lp/services/config/schema-lazr.conf
# environment_variables: {"PIP_INDEX_URL": "http://%(read_auth)s@%(base_url)/simple"}
+=======
+# environment_variables: {"PIP_INDEX_URL": "https://%(read_auth)s@xxxxxxxxxxxxxxxxxxxxx/artifactory/soss-python-stable/simple/"}
+>>>>>>> lib/lp/services/config/schema-lazr.conf
environment_variables: none
# value is a JSON Array
# example:
-# apt_repositories: ["deb https://%(read_auth)s@%(base_url)s/repository focal main"]
+# apt_repositories: ["deb https://%(read_auth)s@xxxxxxxxxxxxxxxxxxxxx/artifactory/soss-deb-stable focal main universe"]
apt_repositories: none
Follow ups