26 lines
559 B
Python
26 lines
559 B
Python
from dataclasses import dataclass
|
|
import subprocess
|
|
import os
|
|
|
|
@dataclass
|
|
class DeployerRequest:
|
|
repo: str
|
|
branch: str
|
|
clone_url: str
|
|
commit_hash: str
|
|
|
|
DEPLOYERDIR = "/home/drm/deployer/production"
|
|
|
|
def handle_request(rq: DeployerRequest):
|
|
subprocess.Popen(
|
|
["sudo", "-E", "./deploy.sh"],
|
|
env=dict(
|
|
os.environ,
|
|
DEPLOYERDIR=DEPLOYERDIR,
|
|
REPO=rq.repo,
|
|
BRANCH=rq.branch,
|
|
CLONE_URL=rq.clone_url,
|
|
COMMIT_HASH=rq.commit_hash,
|
|
),
|
|
)
|