Configure separate Windows and Linux Gitea release workflows with dedicated SHA-256 checksums
CI Test Suite / Run Component Tests & Pipeline Verification (push) Successful in 3m48s

This commit is contained in:
2026-09-04 15:46:35 +02:00
parent e7bf277fb9
commit 082b839965
6 changed files with 312 additions and 95 deletions
+46 -19
View File
@@ -7,6 +7,8 @@ import urllib.parse
import mimetypes
import package_dist
import time
DEFAULT_GITEA_URL = os.environ.get("GITEA_SERVER_URL", "https://gitea.eibl.tech")
DEFAULT_REPO = os.environ.get("GITEA_REPOSITORY", "me0nline/LOGAR")
@@ -28,7 +30,7 @@ def delete_asset(base_url, repo, release_id, asset_id, token):
except Exception:
pass
def upload_file_to_release(base_url, repo, release_id, token, file_path):
def upload_file_to_release(base_url, repo, release_id, token, file_path, max_retries=3):
filename = os.path.basename(file_path)
# Clean up existing asset with same name if already present
@@ -42,20 +44,30 @@ def upload_file_to_release(base_url, repo, release_id, token, file_path):
with open(file_path, "rb") as f:
file_bytes = f.read()
req = urllib.request.Request(url, data=file_bytes, method="POST")
req.add_header("Authorization", f"token {token}")
req.add_header("Content-Type", "application/octet-stream")
req.add_header("Accept", "application/json")
for attempt in range(1, max_retries + 1):
req = urllib.request.Request(url, data=file_bytes, method="POST")
req.add_header("Authorization", f"token {token}")
req.add_header("Content-Type", "application/octet-stream")
req.add_header("Accept", "application/json")
try:
with urllib.request.urlopen(req) as resp:
data = json.loads(resp.read().decode("utf-8"))
print(f"[+] Attached {filename} ({len(file_bytes)} bytes) to release.")
return data
except urllib.error.HTTPError as e:
err = e.read().decode("utf-8", errors="ignore")
print(f"[!] Error uploading {filename}: HTTP {e.code} - {err}")
return None
try:
with urllib.request.urlopen(req) as resp:
data = json.loads(resp.read().decode("utf-8"))
print(f"[+] Attached {filename} ({len(file_bytes)} bytes) to release.")
return data
except urllib.error.HTTPError as e:
err = e.read().decode("utf-8", errors="ignore")
print(f"[!] Attempt {attempt}/{max_retries} - Error uploading {filename}: HTTP {e.code} - {err}")
if attempt < max_retries:
time.sleep(2 * attempt)
else:
return None
except Exception as ex:
print(f"[!] Attempt {attempt}/{max_retries} - Exception uploading {filename}: {ex}")
if attempt < max_retries:
time.sleep(2 * attempt)
else:
return None
def create_or_get_release(base_url, repo, tag, token, title=None, notes=None):
url = f"{base_url}/api/v1/repos/{repo}/releases"
@@ -103,10 +115,23 @@ def create_or_get_release(base_url, repo, tag, token, title=None, notes=None):
"prerelease": False
}
req = urllib.request.Request(url, data=json.dumps(payload).encode("utf-8"), headers=headers, method="POST")
with urllib.request.urlopen(req) as resp:
created = json.loads(resp.read().decode("utf-8"))
print(f"[+] Created release {tag} (ID: {created['id']})")
return created["id"]
try:
with urllib.request.urlopen(req) as resp:
created = json.loads(resp.read().decode("utf-8"))
print(f"[+] Created release {tag} (ID: {created['id']})")
return created["id"]
except urllib.error.HTTPError as e:
print(f"[*] Release creation returned HTTP {e.code}. Checking if peer runner created it concurrently...")
for attempt in range(1, 6):
time.sleep(2)
try:
with urllib.request.urlopen(check_req) as resp:
existing = json.loads(resp.read().decode("utf-8"))
print(f"[+] Retrieved peer-created release for tag {tag} (ID: {existing['id']})")
return existing["id"]
except Exception:
pass
raise
def main():
parser = argparse.ArgumentParser(description="Upload LOGAR compiled binaries directly to Gitea Release")
@@ -144,11 +169,13 @@ def main():
notes = (
f"## LOGAR Release {tag}\n\n"
"### Changes in this Release:\n"
"- **Dual Platform Gitea Release Automation**: Added dedicated Windows (`release-windows.yml`) and Linux (`release-linux.yml`) Gitea Actions to compile native executables and publish assets concurrently.\n"
"- **Dedicated SHA-256 Checksums**: Release assets now include dedicated checksum files matching `[win/linux]_[client/agent]_sha256sum` (e.g., `win_client_sha256sum`, `win_agent_sha256sum`, `win_server_sha256sum`, `linux_client_sha256sum`, `linux_agent_sha256sum`, `linux_server_sha256sum`).\n"
"- **Removed Client Filter Logic**: Removed restrictive source-level noise filtering on edge forwarders. Clients now stream all candidate events from `INFO` up to `ERROR` across the lookback window instead of discarding them at the source.\n"
"- **State Tracking & Deduplication**: Added persistent state tracking (`client_state.json`) with cursor and record number deduplication so previously transmitted events are never resent.\n"
"- **24-Hour Lookback Window**: Forwarders now scan and upload events from the last 24 hours, skipping older entries.\n"
"- **Lightweight Distribution Structure**: Cleaned `out/` to strictly contain deployment documentation and sample configurations.\n"
"- **Automated Gitea CI/CD**: Integrated push testing workflow (`ci.yml`) and automated release asset packaging (`release.yml`).\n"
"- **Automated Gitea CI/CD**: Integrated push testing workflow (`ci.yml`) and automated release asset packaging.\n"
)
title = args.title or f"LOGAR Release {tag}"