Reconcile Gitea Actions failure with order-stable runtime checks
This commit is contained in:
@@ -15,15 +15,21 @@ SOURCE = Path(__file__).resolve().parent
|
||||
ENTRY = "deployment/actions-enable-v1.json"
|
||||
|
||||
|
||||
def bundle(patch_id):
|
||||
if not re.fullmatch(r"gitea-actions-enable-v1-[a-zA-Z0-9._-]{1,65}", patch_id):
|
||||
def descriptor_entry(patch_id):
|
||||
match = re.fullmatch(r"gitea-actions-enable-(v[12])-[a-zA-Z0-9._-]{1,65}", patch_id)
|
||||
if not match:
|
||||
raise ValueError("invalid_actions_transition_identity")
|
||||
descriptor = json.loads((SOURCE / "actions-enable-v1.json").read_text())
|
||||
return "deployment/actions-enable-" + match.group(1) + ".json"
|
||||
|
||||
|
||||
def bundle(patch_id):
|
||||
entry = descriptor_entry(patch_id)
|
||||
descriptor = json.loads((SOURCE / Path(entry).name).read_text())
|
||||
descriptor["releaseId"] = patch_id
|
||||
files = {
|
||||
"manifest.env": ("id=" + patch_id + "\ncomponent=gitea-actions-config\ntype=app-overlay\n").encode(),
|
||||
"files.txt": (ENTRY + "\n").encode(),
|
||||
"payload/" + ENTRY: (json.dumps(descriptor, indent=2) + "\n").encode(),
|
||||
"files.txt": (entry + "\n").encode(),
|
||||
"payload/" + entry: (json.dumps(descriptor, indent=2) + "\n").encode(),
|
||||
}
|
||||
output = io.BytesIO()
|
||||
with gzip.GzipFile(fileobj=output, mode="wb", filename="", mtime=0) as compressed:
|
||||
@@ -51,7 +57,7 @@ def main():
|
||||
stream.write(data)
|
||||
print(json.dumps({"artifact": str(path.resolve()), "patchId": args.patch_id,
|
||||
"component": "gitea-actions-config", "sourceCommit": actual,
|
||||
"sha256": hashlib.sha256(data).hexdigest(), "entries": [ENTRY],
|
||||
"sha256": hashlib.sha256(data).hexdigest(), "entries": [descriptor_entry(args.patch_id)],
|
||||
"services": ["gitea"], "newPorts": [], "productionDeployEnabled": False}))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user