feat(shard): 🎉 Initialize the rewrite.

This commit is contained in:
Nyeki.py
2024-11-13 02:09:47 -03:00
parent a7f64de5b4
commit d9d752c730
85 changed files with 1912 additions and 7626 deletions
-47
View File
@@ -1,47 +0,0 @@
import os
import sys
import getpass
try:
import requests
except ImportError:
print(
"You need to install `requests` to use this file. Run `pip install requests` and try "
"again."
)
sys.exit()
username = input("Username for git.nyeki.dev: ")
password = getpass.getpass("Password for git.nyeki.dev: ")
tags = requests.get(
"https://git.nyeki.dev/v2/payphone/payphone-shard/tags/list",
auth=(username, password),
).json()["tags"]
latest_version = 1
for tag in tags:
tag: str
if tag[1:].isdecimal():
version = int(tag[1:])
if version > latest_version:
latest_version = version
print(f"Updating to tag v{version}...")
os.system(f"git pull https://{username}:{password}@git.nyeki.dev/payphone/payphone")
os.system(
f"microk8s kubectl set image sts/bot bot=git.nyeki.dev/payphone/payphone-shard:v{version}"
)
os.system(
f"""
microk8s kubectl set image deploy/tasks \
flush=git.nyeki.dev/payphone/payphone-shard:v{version} \
delete-accounts=git.nyeki.dev/payphone/payphone-shard:v{version} \
hangup-inactive-calls=git.nyeki.dev/payphone/payphone-shard:v{version}
"""
)
-33
View File
@@ -1,33 +0,0 @@
import os
import sys
try:
import toml
except ImportError:
print(
"You need to install `toml` to use this file. Run `pip install toml` and try again."
)
sys.exit()
data = toml.load(open("pyproject.toml"))
version = data["project"]["version"].split(".")
version[1] = str(int(version[1]) + 1)
data["project"]["version"] = ".".join(version)
version_num = version[1]
targets = ["tasks", "shard"]
for t in targets:
tag = f"git.nyeki.dev/payphone/payphone-{t}:v{version_num}"
os.system(f"docker build --target {t} --tag {tag} .")
os.system(f"docker push {tag}")
tag = f"git.nyeki.dev/payphone/payphone-{t}:latest"
os.system(f"docker build --target {t} --tag {tag} .")
os.system(f"docker push {tag}")
toml.dump(data, open("pyproject.toml", "w"))