Files
lix/releng/keys.py
T
KFearsoffandjade 3f811a415b releng: add local environment
This takes the first baby steps towards resolving #765. This first
test/workflow isn't the most useful thing ever, because it doesn't
test the code path for building the manual. Still, it does a decent job
at testing the basic git workflow, and the upload functionality.

Change-Id: I16dd3a39addd6308ad3eb37c2e3dc3466584a4e3
2025-05-09 00:01:22 +00:00

23 lines
815 B
Python

import subprocess
import json
from . import environment
def get_ephemeral_key(
env: environment.RelengEnvironment) -> environment.S3Credentials:
output = None
command = [
'garage-ephemeral-key', 'new', '--name', f'releng-{env.name}', '--read',
'--write', '--age-secs', '3600',
env.releases_bucket.removeprefix('s3://'),
env.cache_bucket.removeprefix('s3://'),
env.docs_bucket.removeprefix('s3://'),
]
if env.s3_ssh_host is not None:
command = ['ssh', '-l', 'root', env.s3_ssh_host, *command]
output = subprocess.check_output(command)
d = json.loads(output.decode())
return environment.S3Credentials(name=d['name'],
id=d['id'],
secret_key=d['secret_key'])