Revert "Allow configuring gen_build_info.py through environment variables" (#25201)
Revert "Allow configuring gen_build_info.py through environment variables (#2…"
This reverts commit 163e6d2f89.
This commit is contained in:
committed by
GitHub
parent
9c4e883c9b
commit
dd128cf79b
@@ -19,11 +19,11 @@ SERVER_FILES = [
|
|||||||
"SS14.Server_osx-x64.zip"
|
"SS14.Server_osx-x64.zip"
|
||||||
]
|
]
|
||||||
|
|
||||||
FORK_ID = os.environ.get("CDN_FORK_ID", "wizards")
|
VERSION = os.environ['GITHUB_SHA']
|
||||||
HOSTNAME = os.environ.get("CDN_HOSTNAME", "cdn.centcomm.spacestation14.com")
|
FORK_ID = "wizards"
|
||||||
BUILD_URL = f"https://{HOSTNAME}/builds/{FORK_ID}/builds/{{FORK_VERSION}}/{FILE}"
|
BUILD_URL = f"https://cdn.centcomm.spacestation14.com/builds/wizards/builds/{{FORK_VERSION}}/{FILE}"
|
||||||
MANIFEST_URL = f"https://{HOSTNAME}/version/{{FORK_VERSION}}/manifest"
|
MANIFEST_URL = f"https://cdn.centcomm.spacestation14.com/cdn/version/{{FORK_VERSION}}/manifest"
|
||||||
MANIFEST_DOWNLOAD_URL = f"https://{HOSTNAME}/version/{{FORK_VERSION}}/download"
|
MANIFEST_DOWNLOAD_URL = f"https://cdn.centcomm.spacestation14.com/cdn/version/{{FORK_VERSION}}/download"
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
client_file = os.path.join("release", FILE)
|
client_file = os.path.join("release", FILE)
|
||||||
@@ -38,25 +38,17 @@ def inject_manifest(zip_path: str, manifest: str) -> None:
|
|||||||
z.writestr("build.json", manifest)
|
z.writestr("build.json", manifest)
|
||||||
|
|
||||||
|
|
||||||
def get_git_sha() -> str:
|
|
||||||
proc = subprocess.run(["git", "rev-parse", "HEAD"], stdout=subprocess.PIPE, check=True, encoding="UTF-8")
|
|
||||||
tag = proc.stdout.strip()
|
|
||||||
return tag
|
|
||||||
|
|
||||||
def generate_build_json(file: str) -> str:
|
def generate_build_json(file: str) -> str:
|
||||||
# Env variables set by Jenkins.
|
# Env variables set by Jenkins.
|
||||||
|
|
||||||
hash = sha256_file(file)
|
hash = sha256_file(file)
|
||||||
engine_version = get_engine_version()
|
engine_version = get_engine_version()
|
||||||
manifest_hash = generate_manifest_hash(file)
|
manifest_hash = generate_manifest_hash(file)
|
||||||
version = os.environ.get("GITHUB_SHA")
|
|
||||||
if not version:
|
|
||||||
version = get_git_sha()
|
|
||||||
|
|
||||||
return json.dumps({
|
return json.dumps({
|
||||||
"download": BUILD_URL,
|
"download": BUILD_URL,
|
||||||
"hash": hash,
|
"hash": hash,
|
||||||
"version": version,
|
"version": VERSION,
|
||||||
"fork_id": FORK_ID,
|
"fork_id": FORK_ID,
|
||||||
"engine_version": engine_version,
|
"engine_version": engine_version,
|
||||||
"manifest_url": MANIFEST_URL,
|
"manifest_url": MANIFEST_URL,
|
||||||
@@ -64,7 +56,6 @@ def generate_build_json(file: str) -> str:
|
|||||||
"manifest_hash": manifest_hash
|
"manifest_hash": manifest_hash
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def generate_manifest_hash(file: str) -> str:
|
def generate_manifest_hash(file: str) -> str:
|
||||||
zip = ZipFile(file)
|
zip = ZipFile(file)
|
||||||
infos = zip.infolist()
|
infos = zip.infolist()
|
||||||
@@ -92,6 +83,7 @@ def get_engine_version() -> str:
|
|||||||
assert tag.startswith("v")
|
assert tag.startswith("v")
|
||||||
return tag[1:] # Cut off v prefix.
|
return tag[1:] # Cut off v prefix.
|
||||||
|
|
||||||
|
|
||||||
def sha256_file(path: str) -> str:
|
def sha256_file(path: str) -> str:
|
||||||
with open(path, "rb") as f:
|
with open(path, "rb") as f:
|
||||||
h = hashlib.sha256()
|
h = hashlib.sha256()
|
||||||
|
|||||||
Reference in New Issue
Block a user