aboutsummaryrefslogtreecommitdiff
path: root/releng/environment.py
diff options
context:
space:
mode:
authorJade Lovelace <lix@jade.fyi>2024-06-06 22:28:49 -0700
committerJade Lovelace <lix@jade.fyi>2024-06-09 00:30:12 -0700
commitff95b980d4913e90bc334227f8f3f7b3daf18b36 (patch)
tree08799eda970630ea1cc59142698fa99068db8fc6 /releng/environment.py
parent98e847514795f53f485b6dbd029ecb545ce38236 (diff)
Implement docker upload in the releng tools
This uses skopeo to not think about docker daemons. I, however, noticed that the docker image we had would have totally terrible cache hits, so I rewrote it. Fixes: https://git.lix.systems/lix-project/lix/issues/252 Change-Id: I3c5b6c1f3ba0b9dfcac212b2148f390e0cd542b7
Diffstat (limited to 'releng/environment.py')
-rw-r--r--releng/environment.py32
1 files changed, 29 insertions, 3 deletions
diff --git a/releng/environment.py b/releng/environment.py
index 58633d548..e8e7e771e 100644
--- a/releng/environment.py
+++ b/releng/environment.py
@@ -17,6 +17,21 @@ DEFAULT_STORE_URI_BITS = {
@dataclasses.dataclass
+class DockerTarget:
+ registry_path: str
+
+ def resolve(self, version: str) -> str:
+ """Applies templates:
+ - version: the Lix version
+ """
+ return self.registry_path.format(version=version)
+
+ def registry_name(self) -> str:
+ [a, _, _] = self.registry_path.partition('/')
+ return a
+
+
+@dataclasses.dataclass
class RelengEnvironment:
name: str
@@ -26,22 +41,33 @@ class RelengEnvironment:
docs_bucket: str
git_repo: str
+ docker_targets: list[DockerTarget]
+
def cache_store_uri(self):
qs = DEFAULT_STORE_URI_BITS.copy()
qs.update(self.cache_store_overlay)
return self.cache_bucket + "?" + urllib.parse.urlencode(qs)
+
STAGING = RelengEnvironment(
name='staging',
docs_bucket='s3://staging-docs',
cache_bucket='s3://staging-cache',
- cache_store_overlay={
- 'secret-key': 'staging.key'
- },
+ cache_store_overlay={'secret-key': 'staging.key'},
releases_bucket='s3://staging-releases',
git_repo='ssh://git@git.lix.systems/lix-project/lix-releng-staging',
+ docker_targets=[
+ DockerTarget(
+ 'git.lix.systems/lix-project/lix-releng-staging:{version}'),
+ DockerTarget(
+ 'ghcr.io/lix-project/lix-releng-staging:{version}'),
+ ],
)
+ENVIRONMENTS = {
+ 'staging': STAGING,
+}
+
@dataclasses.dataclass
class S3Credentials: