2024-05-31 23:35:13 +00:00
|
|
|
import dataclasses
|
|
|
|
import urllib.parse
|
|
|
|
|
|
|
|
S3_HOST = 's3.lix.systems'
|
|
|
|
S3_ENDPOINT = 'https://s3.lix.systems'
|
|
|
|
|
|
|
|
DEFAULT_STORE_URI_BITS = {
|
|
|
|
'region': 'garage',
|
|
|
|
'endpoint': 's3.lix.systems',
|
|
|
|
'want-mass-query': 'true',
|
|
|
|
'write-nar-listing': 'true',
|
|
|
|
'ls-compression': 'zstd',
|
|
|
|
'narinfo-compression': 'zstd',
|
|
|
|
'compression': 'zstd',
|
|
|
|
'parallel-compression': 'true',
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-06-07 05:28:49 +00:00
|
|
|
@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
|
|
|
|
|
|
|
|
|
2024-05-31 23:35:13 +00:00
|
|
|
@dataclasses.dataclass
|
|
|
|
class RelengEnvironment:
|
|
|
|
name: str
|
|
|
|
|
|
|
|
cache_store_overlay: dict[str, str]
|
|
|
|
cache_bucket: str
|
|
|
|
releases_bucket: str
|
2024-06-06 21:40:59 +00:00
|
|
|
docs_bucket: str
|
2024-05-31 23:35:13 +00:00
|
|
|
git_repo: str
|
|
|
|
|
2024-06-07 05:28:49 +00:00
|
|
|
docker_targets: list[DockerTarget]
|
|
|
|
|
2024-05-31 23:35:13 +00:00
|
|
|
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)
|
|
|
|
|
2024-06-07 05:28:49 +00:00
|
|
|
|
2024-05-31 23:35:13 +00:00
|
|
|
STAGING = RelengEnvironment(
|
|
|
|
name='staging',
|
2024-06-06 21:40:59 +00:00
|
|
|
docs_bucket='s3://staging-docs',
|
2024-05-31 23:35:13 +00:00
|
|
|
cache_bucket='s3://staging-cache',
|
2024-06-07 05:28:49 +00:00
|
|
|
cache_store_overlay={'secret-key': 'staging.key'},
|
2024-05-31 23:35:13 +00:00
|
|
|
releases_bucket='s3://staging-releases',
|
|
|
|
git_repo='ssh://git@git.lix.systems/lix-project/lix-releng-staging',
|
2024-06-07 05:28:49 +00:00
|
|
|
docker_targets=[
|
|
|
|
DockerTarget(
|
|
|
|
'git.lix.systems/lix-project/lix-releng-staging:{version}'),
|
|
|
|
DockerTarget(
|
|
|
|
'ghcr.io/lix-project/lix-releng-staging:{version}'),
|
|
|
|
],
|
2024-05-31 23:35:13 +00:00
|
|
|
)
|
|
|
|
|
2024-06-07 05:28:49 +00:00
|
|
|
ENVIRONMENTS = {
|
|
|
|
'staging': STAGING,
|
|
|
|
}
|
|
|
|
|
2024-05-31 23:35:13 +00:00
|
|
|
|
|
|
|
@dataclasses.dataclass
|
|
|
|
class S3Credentials:
|
|
|
|
name: str
|
|
|
|
id: str
|
|
|
|
secret_key: str
|