aboutsummaryrefslogtreecommitdiff
path: root/releng/environment.py
blob: 643eb69d9da5925653c6ccb11f825f5c1440d20f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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',
}


@dataclasses.dataclass
class RelengEnvironment:
    name: str

    aws_profile: str
    cache_store_overlay: dict[str, str]
    cache_bucket: str
    releases_bucket: str
    git_repo: str

    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',
    aws_profile='garage_staging',
    cache_bucket='s3://staging-cache',
    cache_store_overlay={
        'secret-key': 'staging.key'
    },
    releases_bucket='s3://staging-releases',
    git_repo='ssh://git@git.lix.systems/lix-project/lix-releng-staging',
)


@dataclasses.dataclass
class S3Credentials:
    name: str
    id: str
    secret_key: str