initial commit
This commit is contained in:
24
deploy.py
Normal file
24
deploy.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import requests, os, sys
|
||||||
|
from typing import Dict
|
||||||
|
|
||||||
|
app: str = os.environ["SCD_APP"]
|
||||||
|
token: str = os.environ["SCD_TOKEN"]
|
||||||
|
prefix: str = os.environ["SCD_PREFIX"]
|
||||||
|
url: str = f"https://{prefix}-cd.gogacoder.com/api/v1/{app}/deploy"
|
||||||
|
|
||||||
|
headers: Dict[str, str] = {"Authorization": f"Bearer {token}"}
|
||||||
|
|
||||||
|
response = requests.post(url, headers=headers)
|
||||||
|
result: Dict[str, str] = response.json()
|
||||||
|
|
||||||
|
if response.status_code == 200:
|
||||||
|
print("Successfull deployment:")
|
||||||
|
print(result["log"])
|
||||||
|
else:
|
||||||
|
print("Failed deployment:", file=sys.stderr)
|
||||||
|
print(result["details"], file=sys.stderr)
|
||||||
|
print("Log:", file=sys.stderr)
|
||||||
|
print(result["log"], file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
Reference in New Issue
Block a user